Command Line Interface (CLI)
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Command Line Interface (CLI) is the primary entry point for OWASP Nettacker, designed for automated penetration testing and information gathering. It allows users to perform reconnaissance, vulnerability assessments, and network security audits through a terminal or as part of automated CI/CD pipelines. The CLI handles target specification, module selection, and engine configuration to execute complex security scans efficiently.
The CLI is implemented in Python and supports high-concurrency execution through multithreading and multi-processing. It integrates closely with the project's modular architecture, allowing users to invoke specific scan methods such as port scanning, subdomain enumeration, and vulnerability checks directly from the command line.
Sources: README.md:28-40, AGENTS.md:10-15
CLI Entry Points and Execution
OWASP Nettacker provides multiple ways to invoke the CLI depending on the installation environment. The primary methods include direct Python execution and using Poetry.
- Python Script: The framework can be started using
python nettacker.py. - Poetry Script: If installed via Poetry, the command
nettacker(mapped tonettacker.main:run) is available. - Docker: The CLI is frequently utilized via Docker containers for isolated execution.
Execution Flow
The following diagram illustrates the high-level initialization flow when the CLI is invoked.
The CLI utilizes argparse to handle user inputs and pyproject.toml to define the executable script mapping.
Sources: AGENTS.md:12-25, pyproject.toml:50-51, nettacker/config.py:120-160
Configuration and Defaults
The CLI's behavior is governed by a robust configuration system defined in nettacker/config.py. While users can pass flags to override settings, the DefaultSettings class provides the baseline for the engine's operation.
Key Default Parameters
| Parameter | Default Value | Description |
|---|---|---|
thread_per_host | 100 | Number of threads allowed per target host. |
timeout | 3.0 | Default request timeout in seconds. |
retries | 1 | Number of connection retries. |
language | "en" | Default reporting and UI language. |
set_hardware_usage | "maximum" | Resource allocation level (low, normal, high, maximum). |
graph_name | "d3_tree_v2_graph" | Default graph visualization module for HTML reports. |
Sources: nettacker/config.py:120-170
CLI Arguments and Flag Groups
The CLI categorizes flags into several logical groups: Engine options, Target input, and Scan method options.
Engine Options
These flags control the operational mechanics of the scanner, such as concurrency, timeouts, and output paths.
--verbose-mode: Sets the verbosity level (0-5).--thread-per-host: Configures the number of concurrent connections per host.--output: Specifies the filename for saving logs in various formats (HTML, JSON, CSV, TXT).--ping-before-scan: If enabled, the engine pings the host before initiating modules to verify availability.
Target Input Options
Nettacker supports flexible target definitions, allowing for individual IPs, CIDR blocks, or domains.
-i,--targets: A list of targets separated by commas.-l,--targets-list: A path to a file containing a list of targets.-s,--scan-subdomains: Enables automatic discovery and scanning of subdomains for a given domain.
Scan Method Options
Users can explicitly select or exclude modules to tailor the scan's scope.
-m,--modules: Select specific modules (e.g.,port_scan,http_status_scan).-x,--exclude-modules: Prevents specific modules from running.--modules-extra-args: Passes specific parameters to modules, such as API keys or custom wordlists.
Sources: nettacker/locale/en.yaml:20-100, README.md:70-85, nettacker/config.py:120-170
Data Flow: From CLI to Report
When a user initiates a scan, the CLI processes the input and coordinates with the database and report generators.
Language and Localization
The CLI supports multiple languages for its output and help menus. Localization strings are stored in YAML files within the nettacker/locale/ directory.
Locale Examples (en.yaml)
The following snippets represent the standardized terminology used across the CLI:
engine: "Engine"target: "Target"scan_started: "Nettacker engine started ..."thread_number_connections: "thread numbers for connections to a host"
The framework supports languages including Arabic (ar), Persian (fa), Chinese (zh-cn), Greek (el), and English (en).
Sources: nettacker/locale/en.yaml:1-20, nettacker/locale/ar.yaml, nettacker/locale/fa.yaml, nettacker/locale/zh-cn.yaml, nettacker/locale/el.yaml
Conclusion
The CLI serves as the versatile command center for OWASP Nettacker, providing deep configuration capabilities and high-performance scanning through a standardized interface. By leveraging multithreading, a modular engine, and comprehensive output options, it enables security professionals to automate complex reconnaissance and audit tasks across diverse network environments.
Sources: README.md:30-40, AGENTS.md:10-15