diff --git a/README.md b/README.md index 5ef1ba629..da17cb350 100644 --- a/README.md +++ b/README.md @@ -21,14 +21,14 @@ OWASP Nettacker OWASP Nettacker is an open-source, Python-based automated penetration testing and information-gathering framework designed to help cyber security professionals and ethical hackers perform reconnaissance, vulnerability assessments, and network security audits efficiently. Nettacker automates tasks like port scanning, service detection, subdomain enumeration, network mapping, vulnerability scanning, credential brute-force testing making it a powerful tool for identifying weaknesses in networks, web applications, IoT devices and APIs. ### Key Features - - **Modular architecture** - Each task — like port scanning, directory discovery, subdomain enumeration, vulnerability checks, or credential brute-forcing - is implemented as its own module, giving you control over what runs. - **Multi-protocol & multithreaded scanning** - Supports HTTP/HTTPS, FTP, SSH, SMB, SMTP, ICMP, TELNET, XML-RPC, and can run scans in parallel for speed. - **Comprehensive output** - Export reports in HTML, JSON, CSV, and plain text. - **Built-in database & drift detection** - Stores past scans in the database for easy search and comparison with current results: useful to detect new hosts, open ports, or vulnerabilities in CI/CD pipelines. - **CLI, REST API & Web UI** - Offers both programmatic integration and a user-friendly web interface for defining scans and viewing results. - **Evasion techniques** - Enables configurable delays, proxy support, and randomized user-agents to reduce detection by firewalls or IDS systems. -- **Flexible targets** - Accepts single IPv4s, IP ranges, CIDR blocks, domain names, and full HTTP/HTTPS URLs. Targets can be mixed in a single command or loaded from a file using the `-l/--targets-list` flag. +- **Flexible targets**: Accepts single IPv4s, IP ranges, CIDR blocks, domain names, and full HTTP/HTTPS URLs. +These methods ensure full compatibility and avoid runtime errors ### Use Cases diff --git a/nettacker/core/arg_parser.py b/nettacker/core/arg_parser.py index 459d7c9b2..2552a4e82 100644 --- a/nettacker/core/arg_parser.py +++ b/nettacker/core/arg_parser.py @@ -1,6 +1,7 @@ +import difflib import json import sys -from argparse import ArgumentParser +from argparse import ArgumentParser, RawTextHelpFormatter import yaml @@ -26,7 +27,27 @@ class ArgParser(ArgumentParser): def __init__(self, api_arguments=None) -> None: - super().__init__(prog="Nettacker", add_help=False) + super().__init__( + prog="Nettacker", + description=_("OWASP Nettacker - Automated Penetration Testing Framework"), + epilog=(""" + Examples: + + Scan a target: + python nettacker.py -i 192.168.1.1 + + Scan multiple targets: + python nettacker.py -l targets.txt + + Run specific module: + python nettacker.py -i example.com -m port_scan + + Show all modules: + python nettacker.py --show-all-modules + """), + formatter_class=RawTextHelpFormatter, + add_help=False + ) self.api_arguments = api_arguments self.graphs = self.load_graphs() @@ -518,7 +539,32 @@ def parse_arguments(self): all ARGS with applied rules """ # Checking Requirements - options = self.api_arguments or self.parse_args() + if self.api_arguments: + options = self.api_arguments + else: + known_args, unknown_args = self.parse_known_args() + + if unknown_args: + valid_flags = [] + for action in self._actions: + valid_flags.extend(action.option_strings) + + for arg in unknown_args: + if arg.startswith("--") and len(arg) > 1: + suggestion = difflib.get_close_matches(arg, valid_flags, n=1) + if suggestion: + print( + f"Error: Unknown argument '{arg}'. Did you mean '{suggestion[0]}'?", + file=sys.stderr, + ) + else: + print(f"Error: Unknown argument '{arg}'", file=sys.stderr) + else: + print(f"Error: Unexpected argument '{arg}'", file=sys.stderr) + + sys.exit(1) + + options = known_args if options.language not in self.languages: die_failure("Please select one of these languages {0}".format(self.languages))