> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/es/hacking-wifi/wpa-wpa2-psk-network-attacks/precomputed-attacks/pyrit-installation-compilation-and-handshake-validation.md).

# Instalación, compilación y validación de handshakes de Pyrit

Compila Pyrit heredado de forma segura y úsalo para validar capturas de handshake WPA/WPA2.

Pyrit puede ayudar a validar capturas de handshakes WPA/WPA2 y reducir los falsos positivos. Úselo con capturas aprobadas y un alcance documentado.

{% embed url="<https://github.com/JPaulMora/Pyrit>" %}

{% hint style="warning" %}
Pyrit está abandonado. Depende de Python 2.7 y OpenSSL 1.1.1, que han llegado al fin de su vida útil. No lo instale en un sistema de producción.
{% endhint %}

### Resumen de compilación

Esta compilación necesita una instalación aparte de OpenSSL, Python 2.7 y parches de compatibilidad. Utilice una máquina virtual o un contenedor desechable.

1. Instale las dependencias de compilación.
2. Compile OpenSSL 1.1.1w y Python 2.7.18.
3. Aplique parches y compile Pyrit.
4. Configure la ruta de la biblioteca en tiempo de ejecución y verifique el resultado.

### Prerrequisitos

Instale estas dependencias de compilación:

`build-essential git libssl-dev libpcap-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libncurses5-dev libgdbm-dev libffi-dev libnss3-dev wget`

`python2-dev` ya no está disponible. Compile Python 2.7.18 desde el código fuente en su lugar.

### Compile las dependencias heredadas

#### OpenSSL 1.1.1w

OpenSSL 3.x del sistema es incompatible con este flujo de trabajo de Python 2. Compile OpenSSL 1.1.1w por separado:

```bash
./config --prefix=/opt/openssl-1.1.1w --openssldir=/opt/openssl-1.1.1w shared zlib
make && sudo make install_sw
```

#### Python 2.7.18

Compile Python contra la instalación de OpenSSL anterior:

```bash
CPPFLAGS="-I/opt/openssl-1.1.1w/include" LDFLAGS="-L/opt/openssl-1.1.1w/lib -Wl,-rpath=/opt/openssl-1.1.1w/lib" ./configure --enable-optimizations
make && sudo make altinstall
```

Esto instala `python2.7` sin cambiar la versión de Python del sistema.

### Prepare y compile Pyrit

#### Instale pip2

Ejecuta `get-pip.py` con `python2.7`.

#### Parchear `setup.py`

Pyrit utiliza una clase de estilo antiguo de Python. Reemplace `super().build_extension(ext)` con `build_ext.build_extension(self, ext)`.

Añadir `include_dirs` y `library_dirs` las entradas que apuntan a la instalación de OpenSSL.

#### Compile con banderas de compatibilidad para GCC 14

El código C heredado provoca errores estrictos del compilador en versiones modernas de GCC:

```bash
CFLAGS="-Wno-error=implicit-int -Wno-error=implicit-function-declaration -Wno-error=int-conversion -Wno-error=incompatible-pointer-types" python2.7 setup.py build/install
```

#### Parchear la sintaxis mixta de Python

Algunos archivos contienen sintaxis incompatible con Python 3. Aplique estos cambios de compatibilidad:

* Reemplace las f-strings con `%` formato.
* Reemplace `print(..., file=sys.stderr)` con `print >> sys.stderr`.
* Elimine `de e` de `raise` las sentencias.
* Reemplace `import queue` con `import Queue as queue`.
* Reemplace `xmlrpc.client` y `xmlrpc.server` con `xmlrpclib` y `SimpleXMLRPCServer`.

### Configure la ruta de la biblioteca en tiempo de ejecución

Establezca `LD_LIBRARY_PATH=/opt/openssl-1.1.1w/lib` en `.zshrc`. Pyrit entonces encuentra en tiempo de ejecución la biblioteca de OpenSSL requerida.

### Verifique la instalación

Confirme que Pyrit detecta los núcleos de procesamiento disponibles. Luego ejecute su benchmark:

```bash
pyrit list_cores
pyrit benchmark
```

### Alternativas recomendadas

Prefiera herramientas mantenidas para nuevas evaluaciones:

* `hashcat`
* `aircrack-ng`

Evitan la cadena de dependencias de Python 2 y de OpenSSL heredado.

### Capture y valide handshakes

Use este flujo de trabajo en una red inalámbrica que le pertenezca o que esté autorizado a evaluar.

#### Capture el tráfico del objetivo

Capture el tráfico de la red objetivo en su canal conocido:

{% code overflow="wrap" %}

```bash
airodump-ng --channel 1 -w CAPTURE --essid WIFI wlan0mon
```

{% endcode %}

#### Genere tráfico de validación

Con la aprobación explícita del alcance, envíe tramas de desautenticación al cliente especificado. Esto puede provocar una reconexión y producir un nuevo handshake:

{% code overflow="wrap" %}

```bash
aireplay-ng --deauth 0 -e WIFI -c FF:FF:FF:FF:FF:FF wlan0mon
```

{% endcode %}

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FY0DLasTq31XPJXAolpiV%2F%7B3632C541-1951-464D-8587-E548F8772AC4%7D.png?alt=media&amp;token=9cd47df5-667a-4607-80a4-345c7b748081" alt=""><figcaption></figcaption></figure>

#### Valide los handshakes capturados

Analice la captura con Pyrit. Informa de los handshakes disponibles de las estaciones observadas:

{% code overflow="wrap" %}

```bash
pyrit -r CAPTURE-01.cap analyze
```

{% endcode %}

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F1BDYkAbZzJcwBmMIZ9O1%2F%7BD80376D6-C44D-4F8C-BCD0-9C8BF854C729%7D.png?alt=media&amp;token=533d329d-00cf-4bbd-baa6-942c5ca21be1" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/es/hacking-wifi/wpa-wpa2-psk-network-attacks/precomputed-attacks/pyrit-installation-compilation-and-handshake-validation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
