# iamarit/hunter architecture

> Architecture diagram of the GitHub repository iamarit/hunter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iamarit/hunter
- Repository: https://github.com/iamarit/hunter

## Overview

##### Project type and purpose
- Type: Standalone command‐line utility (open‐source tool)
- Purpose: Automate password brute‐forcing over FTP and SSH

##### File structure
- Top level:
- hunter.py – the main script containing all logic
- requirements.txt – external dependencies (e.g., paramiko for SSH)
- README.md, LICENSE
- No subdirectories: all functionality lives in hunter.py but can be logically broken out

##### Key insights from README
- Uses Python3 with minimal dependencies
- Accepts command‐line args (`argparse`) for service type, host, user, port, wordlist
- Supports two protocols: FTP and SSH
- Cross‐platform, lightweight

##### Main components
a. Command‑Line Interface (CLI) Layer
- Argument Parser (argparse)
- Help/Usage Display
b. Input Processing
- Validation of host, port, protocol, wordlist path
c. Brute‑Force Engine
- Wordlist Loader (reads file, streams or batches passwords)
- Connector Factory
- FTP Connector (wraps ftplib)
- SSH Connector (wraps paramiko or native SSH library)
- Attempt Loop
- For each password → call connector.attempt_login()
- Handles timeouts, exceptions, success/failure responses
d. Output & Logging
- Console Logger (prints progress, successes, failures)
- Optional File Logger (if extended)
e. External Service
- Target Host running FTP or SSH service

##### Relationships & interactions
- CLI → Input Processor → Brute‑Force Engine
- Engine → Wordlist Loader → yields passwords → Connector → Target Service
- Connector ←→ Target Service (network roundtrip)
- Engine → Logger → Console (and file if enabled)

##### Architectural patterns & principles
- Modular pipeline: separate parsing → engine → connecting → logging
- Factory pattern for protocol connectors
- Extensibility: easy to add new protocols by adding new Connector

##### Technologies & libraries
- Python 3.x
- argparse (CLI parsing)
- ftplib or socket (FTP)
- paramiko (SSH)
- logging or print statements

##### Essential elements
- Optional notes next to connectors: “uses paramiko,” “uses ftplib”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Local Application Layer
    subgraph "Local Application"
        CLI["Command-Line Interface"]:::user
        Parser["Argument Parser"]:::user
        InputProc["Input Processing"]:::user
        Engine["Brute-Force Engine"]:::core
        subgraph "Engine Components"
            Wordlist["Wordlist Loader"]:::util
            Factory["Connector Factory"]:::core
            FTP["FTP Connector"]:::core
            SSH["SSH Connector"]:::core
        end
        Logger["Console Logger"]:::util
        Requirements["requirements.txt"]:::doc
        README["README.md"]:::doc
        LICENSE["LICENSE"]:::doc
    end

    %% External Network
    subgraph "External Network"
        Target["Target Host (FTP/SSH Service)"]:::external
    end

    %% Connections
    CLI -->|"parse args"| Parser
    Parser -->|"validate input"| InputProc
    InputProc -->|"start attack"| Engine
    Engine -->|"load password"| Wordlist
    Wordlist -->|"password"| Factory
    Factory -->|"select FTP"| FTP
    Factory -->|"select SSH"| SSH
    FTP -->|"attempt login"| Target
    SSH -->|"attempt login"| Target
    Target -->|"response"| FTP
    Target -->|"response"| SSH
    FTP -->|"status"| Engine
    SSH -->|"status"| Engine
    Engine -->|"report success/failure"| Logger

    %% Documentation and Dependencies
    Requirements -.-> CLI
    README -.-> CLI
    LICENSE -.-> CLI

    %% Click Events
    click CLI "https://github.com/iamarit/hunter/blob/main/hunter.py"
    click Parser "https://github.com/iamarit/hunter/blob/main/hunter.py"
    click InputProc "https://github.com/iamarit/hunter/blob/main/hunter.py"
    click Engine "https://github.com/iamarit/hunter/blob/main/hunter.py"
    click Wordlist "https://github.com/iamarit/hunter/blob/main/hunter.py"
    click Factory "https://github.com/iamarit/hunter/blob/main/hunter.py"
    click FTP "https://github.com/iamarit/hunter/blob/main/hunter.py"
    click SSH "https://github.com/iamarit/hunter/blob/main/hunter.py"
    click Logger "https://github.com/iamarit/hunter/blob/main/hunter.py"
    click Requirements "https://github.com/iamarit/hunter/blob/main/requirements.txt"
    click README "https://github.com/iamarit/hunter/blob/main/README.md"
    click LICENSE "https://github.com/iamarit/hunter/tree/main/LICENSE"

    %% Styles
    classDef user fill:#e0ffe0,stroke:#2d862d,stroke-width:1px
    classDef core fill:#d0e0ff,stroke:#1a3d7c,stroke-width:1px
    classDef util fill:#f0f0f0,stroke:#666666,stroke-width:1px
    classDef external fill:#ffe0b3,stroke:#b36b00,stroke-width:1px
    classDef doc fill:#f5e6ff,stroke:#664d99,stroke-width:1px
```
