# evogix/netraptor architecture

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

- Interactive diagram: https://gitdiagram.com/evogix/netraptor
- Repository: https://github.com/evogix/netraptor

## Overview

##### Project Type & Purpose
- NetRaptor is a specialized command-line tool used for network reconnaissance. It integrates multiple functions like random IP generation, port scanning, service detection, and web analysis.

##### Analyzing the File Structure
- Top-level files (netraptor.py, requirements.txt, pyproject.toml) indicate that netraptor.py acts as the starting point (the CLI) for executing commands.
- The modules directory contains the core functionalities:
- ip_generator.py for generating random IPs,
- port_scanner.py for identifying open ports,
- service_detector.py for detecting available services,
- web_analyzer.py for analyzing target websites.
- The utils folder, with the output_formatter.py module, suggests a dedicated utility to format and present the tool’s output neatly.
- Other files like the attached_assets and web_tested demonstrate additional resources and test inputs, but the main structure focuses on command processing and module functionality.

##### Key Components
a. The Command-Line Interface (CLI):
- Netraptor.py as the entry point.
- How it parses command-line arguments (e.g., flags like –r, –i, --service-detection, --web-analysis) to determine which feature to invoke.

b. Core Functional Modules:
- From netraptor.py, show directed flows to:
- IP Generator (ip_generator.py): corresponds to the “Random IP Generator” feature.
- Port Scanner (port_scanner.py): carries out port-scanning against target IPs.
- Service Detector (service_detector.py): identifies which services are active or exploitable.
- Web Analyzer (web_analyzer.py): inspects and analyzes web targets.

c. Utility Layer:
- Output Formatter (output_formatter.py) from the utils directory that takes the results from the various modules and formats them for the user.

d. External Dependencies & Resources:
- Assets (attached_assets) and configuration files as peripheral components that support branding, logging, or testing (e.g., web_tested).

##### Architectural Patterns & Design Principles
- Modular Design: Each feature (IP generation, port scanning, etc.) is encapsulated in its own module, promoting separation of concerns.
- Command-line orchestration: The central script (netraptor.py) dispatches tasks based on arguments, which further promotes a plug-in style pattern. This makes it easy to extend or update individual modules without altering the overall framework.
- Utility Layer for output: Separating the output formatting logic ensures presentation logic is decoupled from business logic.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U["User Command Input"]:::input
    CLI["CLI (netraptor.py)"]:::cli
    U -->|"sends_command"| CLI

    subgraph "Core Modules"
        IPGen["IP Generator Module"]:::module
        PortScan["Port Scanner Module"]:::module
        ServiceDetect["Service Detector Module"]:::module
        WebAnalyst["Web Analyzer Module"]:::module
    end

    CLI -->|"dispatches"| IPGen
    CLI -->|"dispatches"| PortScan
    CLI -->|"dispatches"| ServiceDetect
    CLI -->|"dispatches"| WebAnalyst

    OutputFmt["Output Formatter Utility"]:::utility
    IPGen -->|"returns_results"| OutputFmt
    PortScan -->|"returns_results"| OutputFmt
    ServiceDetect -->|"returns_results"| OutputFmt
    WebAnalyst -->|"returns_results"| OutputFmt

    Terminal["Terminal Output"]:::input
    OutputFmt -->|"formats_output"| Terminal

    subgraph "External Resources"
        Assets["External Assets/Resources"]:::external
        WebTest["Web Tested Directory"]:::external
        Req["Core Config: requirements.txt"]:::external
        PyProj["Core Config: pyproject.toml"]:::external
    end

    CLI ---|"uses"| Assets
    CLI ---|"uses"| WebTest
    CLI ---|"reads"| Req
    CLI ---|"reads"| PyProj

    click CLI "https://github.com/evogix/netraptor/blob/main/netraptor.py"
    click IPGen "https://github.com/evogix/netraptor/blob/main/modules/ip_generator.py"
    click PortScan "https://github.com/evogix/netraptor/blob/main/modules/port_scanner.py"
    click ServiceDetect "https://github.com/evogix/netraptor/blob/main/modules/service_detector.py"
    click WebAnalyst "https://github.com/evogix/netraptor/blob/main/modules/web_analyzer.py"
    click OutputFmt "https://github.com/evogix/netraptor/blob/main/utils/output_formatter.py"
    click Assets "https://github.com/evogix/netraptor/tree/main/attached_assets"
    click WebTest "https://github.com/evogix/netraptor/tree/main/web_tested"
    click Req "https://github.com/evogix/netraptor/blob/main/requirements.txt"
    click PyProj "https://github.com/evogix/netraptor/blob/main/pyproject.toml"

    classDef cli fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef module fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef utility fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef input fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
