> For the complete documentation index, see [llms.txt](https://pentesting.mrw0l05zyn.cl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pentesting.mrw0l05zyn.cl/explotacion/ataques-de-contrasenas/fuera-de-linea-offline/archivo-passwd-y-shadow.md).

# Archivo passwd y shadow

## John the Ripper

### Copiar archivos passwd y shadow

```shell
cp /etc/passwd /<path>/passwd.txt
cp /etc/shadow /<path>/shadow.txt
```

### Unificar archivos passwd y shadow

```shell
unshadow passwd.txt shadow.txt > passwords.txt
```

### Cracking de contraseñas

```shell
john passwords.txt --wordlist=<path-wordlist> --format=md5crypt
john passwords.txt --wordlist=<path-wordlist> --format=md5crypt-long
```

* \<path-wordlist> = ruta de wordlist.

## Hashcat

```shell
hashcat -a 0 -m 500 hashes.hash <path-wordlist> -o outfile.txt
hashcat -a 0 -m 1800 hashes.hash <path-wordlist> -o outfile.txt
```

* -a = modo de ataque.
  * 0 = wordlist.
* -m = tipo de hash.
  * 500 = md5crypt, MD5 (Unix), Cisco-IOS $1$ (MD5).
  * 1800 = sha512crypt $6$, SHA512 (Unix).
* \<path-wordlist> = ruta de wordlist.
* -o = el archivo de salida para el hash recuperado.
