# t6x/reaver-wps-fork-t6x architecture

> Architecture diagram of the GitHub repository t6x/reaver-wps-fork-t6x, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/t6x/reaver-wps-fork-t6x
- Repository: https://github.com/t6x/reaver-wps-fork-t6x

## Overview

##### Project’s Main Purpose and Type
- The project is a network security tool (a penetration testing utility) focused on exploiting WPS vulnerabilities.
- It includes both online brute force attacks and offline (Pixie Dust) attack methods.
- The README outlines key operational flows, installation, usage examples, and dependency requirements (e.g., libpcap, libnl variants, pixiewps).

##### File Structure for Architectural Clues
- Top-level files (README.md, docs folder, install scripts) give usage information and documentation.
- The main source folder “src” contains:
– Core modules for handling 802.11 protocols (files like 80211.c/.h, iface.c/.h).
– Modular separation into components such as “common”, “crypto”, “tls”, “utils”, “libwps”, “lwe”, and “wps”:
▪ The “common” directory contains shared definitions and routines (e.g., EAPOL, common WPA functions).
▪ The “crypto” directory holds several cryptographic algorithm implementations – from AES variants to hash functions like MD5 and SHA1 – and selection code that might decide which library backend to use.
▪ The “tls” directory is focused on handling TLS interactions, certificate tasks, and RSA operations.
▪ The “utils” directory includes utility code for base64 encoding, file I/O, error logging, and other supporting functions.
▪ The “wps” directory contains modules directly related to the WPS protocol handling (e.g., processing WPS attributes, packet generation/parsing).
▪ Additional modules like “argsparser”, “builder”, and “cracker” indicate that the system includes dedicated logic for input processing, attack orchestration, and possibly recovering keys.
- Supporting directories (e.g., “tools”) include supplementary scripts (logfilter.py) that can assist in post-processing or live debugging.

##### Main Components and Their Relationships
a. Command-line Interface/Argument Parsing:
– Handled in files like main.c and argsparser.* to process user inputs (e.g., selecting attack type, setting interface parameters).
b. Wireless Interaction Layer:
– Modules such as 80211.c/.h and iface.c/.h manage interactions with the Wi-Fi hardware (e.g., sending/receiving packets, channel management).
c. Cryptographic Operations:
– The crypto and tls modules implement encryption, decryption, and hashing routines required during the WPS protocol’s handshake and subsequent cracking steps.
d. Protocol Handling and WPS-specific Logic:
– The “wps” module encapsulates functions for generating, parsing, and processing WPS messages.
– The “exchange” files indicate there’s a flow where messages are constructed and exchanged with access points, including special handling for features like the Pixie Dust attack.
e. Auxiliary Modules:
– “utils” provides supporting logic (debugging, state machine tracking, logging, etc.).
– “libwps” might offer services for parsing WPS attributes or interfacing with other protocol parts.
f. External Dependencies:
– Dependencies like libpcap (for capturing network packets) and optionally external tools (pixiewps for offline attack support) are crucial.
– Build scripts and configuration files (Makefile, configure.ac, config.mak.in) indicate automated build processes and dependency checks.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Layer: CLI
    CLI["Command-Line Interface/Argument Parsing"]:::cli

    %% Wireless Layer
    WIRELESS["Wireless Interaction Layer"]:::wireless

    %% WPS & Attack Processing Cluster
    WPS["WPS Protocol Handling"]:::wps
    ATTACK["Attack Orchestration/Cracking Module"]:::attack
    LIBWPS["WPS Processing Library (libwps)"]:::wps

    %% Cryptographic Operations
    CRYPTO["Cryptographic Operations (crypto & tls)"]:::crypto

    %% Support Utilities and Extensions
    UTILS["Utility & Support Functions"]:::utility
    LWE["Wireless Extensions (lwe)"]:::wireless

    %% External Dependencies
    LIBPCAP["libpcap"]:::external
    LIBNL["libnl"]:::external
    PIXIEWPS["pixiewps"]:::external

    %% Control and Data Flow Connections
    CLI -->|"triggers"| WIRELESS
    WIRELESS -->|"packet_capture"| WPS
    WPS -->|"crypto_calls"| CRYPTO
    WPS -->|"init_attack"| ATTACK
    ATTACK -->|"uses_crypto"| CRYPTO
    WPS -->|"uses_libwps"| LIBWPS
    WIRELESS -->|"uses_extension"| LWE

    %% Support Utilities Connections (dotted arrows)
    CLI ---|"supports"| UTILS
    WIRELESS ---|"supports"| UTILS
    WPS ---|"supports"| UTILS
    CRYPTO ---|"supports"| UTILS
    ATTACK ---|"supports"| UTILS
    LIBWPS ---|"supports"| UTILS
    LWE ---|"supports"| UTILS

    %% External Dependencies Connections
    WIRELESS -->|"requires"| LIBPCAP
    WIRELESS -->|"requires"| LIBNL
    CRYPTO -->|"offline_support"| PIXIEWPS

    %% Click Events for Component Mapping
    click CLI "https://github.com/t6x/reaver-wps-fork-t6x/blob/master/src/main.c"
    click CLI "https://github.com/t6x/reaver-wps-fork-t6x/blob/master/src/argsparser.c"
    click WIRELESS "https://github.com/t6x/reaver-wps-fork-t6x/blob/master/src/80211.c"
    click WIRELESS "https://github.com/t6x/reaver-wps-fork-t6x/blob/master/src/iface.c"
    click CRYPTO "https://github.com/t6x/reaver-wps-fork-t6x/tree/master/src/crypto"
    click CRYPTO "https://github.com/t6x/reaver-wps-fork-t6x/tree/master/src/tls"
    click WPS "https://github.com/t6x/reaver-wps-fork-t6x/tree/master/src/wps"
    click WPS "https://github.com/t6x/reaver-wps-fork-t6x/blob/master/src/wps/wps.c"
    click WPS "https://github.com/t6x/reaver-wps-fork-t6x/blob/master/src/wps/wps_attr_build.c"
    click ATTACK "https://github.com/t6x/reaver-wps-fork-t6x/blob/master/src/cracker.c"
    click ATTACK "https://github.com/t6x/reaver-wps-fork-t6x/blob/master/src/wpscrack.c"
    click UTILS "https://github.com/t6x/reaver-wps-fork-t6x/tree/master/src/utils"
    click LIBWPS "https://github.com/t6x/reaver-wps-fork-t6x/tree/master/src/libwps"
    click LWE "https://github.com/t6x/reaver-wps-fork-t6x/tree/master/src/lwe"

    %% Styles
    classDef cli fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef wireless fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef wps fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef crypto fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef utility fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef external fill:#E6E6FA,stroke:#000,stroke-width:2px;
    classDef attack fill:#FFD700,stroke:#000,stroke-width:2px;
```
