Introduction to Nettacker
Relevant source files
The following files were used as context for generating this wiki page:
OWASP Nettacker is an open-source, Python-based automated penetration testing and information-gathering framework. It is designed to assist security professionals and ethical hackers in performing reconnaissance, vulnerability assessments, and network audits. The framework automates complex tasks such as port scanning, service detection, subdomain enumeration, and credential brute-forcing across various protocols including HTTP, SSH, and SMB.
Sources: README.md:1-26, pyproject.toml:3-5
The system is built with a modular architecture, allowing users to execute specific tasks as independent modules. It provides multiple interfaces for interaction, including a Command Line Interface (CLI), a REST API, and a Web User Interface (Web UI). Additionally, Nettacker features a built-in database for scan history and "drift detection," which helps identify new assets or vulnerabilities by comparing current results with historical data.
Sources: README.md:28-40, AGENTS.md:5-10
Project Architecture and Structure
Nettacker follows a structured organization where core logic, API services, and scanning modules are separated into distinct directories. The project is managed using poetry and supports Python versions 3.10 through 3.12.
Directory Layout
| Path | Description |
|---|---|
nettacker/main.py | The main entry point for the CLI application. |
nettacker/api/ | Contains the REST API implementation and core API functions. |
nettacker/core/ | Internal libraries for handling alerts, arguments, networking, and target processing. |
nettacker/modules/ | Independent scanning modules (e.g., port scanners, brute-force tools). |
nettacker/web/static/ | Assets for the Web UI. |
.nettacker/data/ | Runtime data storage, including the SQLite database and scan results. |
Sources: AGENTS.md:5-12, nettacker/api/readme.md:3-10, nettacker/core/readme.md:3-18
System Components Flow
The following diagram illustrates how the different interfaces interact with the core engine and the scanning modules.
The framework utilizes multi-processing to manage concurrent attacks and module execution.
Sources: nettacker/core/readme.md:13-15, README.md:38-40
Core Features and Functionality
Scanning and Reconnaissance
Nettacker supports a wide array of scanning capabilities designed for both internal and external assets:
- Multi-protocol Support: Handles HTTP/HTTPS, FTP, SSH, SMB, SMTP, ICMP, TELNET, and XML-RPC.
- Target Flexibility: Accepts single IPs, IP ranges, CIDR blocks, domains, and URLs.
- Evasion: Features configurable delays, proxy support (SOCKS4/5), and randomized user-agents.
Sources: README.md:30-45, nettacker/config.py:125-140
Key Components in nettacker/core/
The core functionality is distributed across several key files:
args_loader.py: Processes ARGV commands and applies execution rules.scan_targets.py: Manages the start of new attacks and multi-processing logic.targets.py: Calculates, processes, and counts targets.load_modules.py: Handles the dynamic loading of scanning modules and their requirements.
Sources: nettacker/core/readme.md:3-18
Configuration and Environment
Nettacker uses a centralized configuration system located in nettacker/config.py. This file defines default settings for the engine, API, and database.
Configuration Categories
| Class | Description | Key Attributes |
|---|---|---|
ApiConfig | Settings for the REST API server. | api_port (5000), api_hostname, api_access_key |
DbConfig | Database connection strings. | engine (sqlite/mysql/postgres), name (db path) |
DefaultSettings | Global scan preferences. | thread_per_host (100), timeout (3.0), language (en) |
PathConfig | System file paths. | data_dir, results_dir, modules_dir |
Sources: nettacker/config.py:65-155
Database Interaction
Nettacker supports multiple database backends, primarily SQLite (via APSW or SQLAlchemy), MySQL, and PostgreSQL. The database stores logs and reports, facilitating the drift detection feature.
Sources: nettacker/config.py:90-110, nettacker/api/readme.md:5-7
API and Web Interface
The API serves as the bridge between the Web UI and the core engine. It is implemented in nettacker/api/ and managed by engine.py.
Web UI Functionalities
The Web UI (index.html) provides a dashboard for:
- New Scan: Configuring targets, profiles, scan methods, and engine options (threads, retries).
- Results: Viewing and filtering historical scan data.
- Compare: Utilizing the drift detection feature by providing two scan IDs to generate a comparison report.
- Crawler: Visualizing discovered assets.
Sources: nettacker/web/static/index.html:130-220, README.md:33-40
Security and Compliance
The project maintains a strict security policy. All commits must be signed, and vulnerabilities are handled through a private disclosure process via GitHub Security Advisories.
Sources: AGENTS.md:50-55, SECURITY.md:15-35
Disclaimer: Users must obtain explicit permission before targeting systems. Contributors are not responsible for illegal usage.
Sources: README.md:17-21