A command-line based network scanning utility built with Python. This application simplifies network reconnaissance by providing a clean, interactive interface to execute and parse complex Nmap scans effortlessly.
- Interactive CLI: Features a styled terminal interface using
richandpyfigletfor easy reading and clear navigation. - Versatile Scan Modes: Wraps standard Nmap arguments into user-friendly prompts. Supports Stealth (-sS), Aggressive (-A), Fast (-F), Version (-sV), OS (-O), and Ping (-sn) scans.
- Input Validation: Built-in verification using the
ipaddressmodule to ensure target IPs are properly formatted before initiating a scan, alongside automatic routing forlocalhost. - Parsed Output: Extracts data directly from the Nmap scan dictionary to display clean, readable results (Port states, probable Operating Systems, and service versions) without the clutter of raw Nmap output.
- Language: Python 3.11.4
- Core Dependency: Nmap (must be installed on the host machine)
- Network & Parsing:
python-nmap,ipaddress - CLI Styling:
rich,pyfiglet
-
Install Nmap on your system
- Linux:
sudo apt install nmap - Mac:
brew install nmap - Windows: Download the installer from the official Nmap website.
- Linux:
-
Clone the repository
git clone https://github.com/YourUsername/NetworkScanner.gitcd NetworkScanner
-
Install Python Dependencies
- This project requires a few external Python libraries to handle the wrapper and CLI styling.
pip install python-nmap pyfiglet rich
-
Run the Application
python network_scanner.py- Note: Some scans (like Stealth/SYN scans or OS detection) require root/administrator privileges. You may need to run the script using
sudo python network_scanner.pydepending on your OS and the scan chosen.
This application acts as a simplified wrapper around the powerful Nmap engine:
- Argument Mapping: When a user selects a scan type, the string is passed through a dictionary (
scan_modes) that translates the human-readable choice into the exact Nmap execution flags (e.g., "stealth" becomes-sS). - Execution: The app instantiates the
nmap.PortScanner()class. It takes the validated IP address and the mapped flags to run the process silently in the background. - Data Extraction: Once the scan completes, the script navigates the nested dictionaries generated by
python-nmapto pull out specific keys (likeosmatch,name,product, andversion), presenting the user with a highly readable summary instead of raw XML or grepable terminal outputs.