A set of Python tools for scanning networks, detecting open ports, identifying service versions, and automatically searching for exploits using an integrated exploit database.
- Scan networks for open ports
- Identify service versions running on open ports
- Automatically search for exploits using an integrated exploit database
- Run scans in the background
- Save scan results to JSON files
- View and download exploits
- No need to install searchsploit separately - exploit database is integrated!
- Works offline - includes a sample database for common exploits
- Automatic tabular output - results are displayed in a clean, organized table by default
- Python 3.6+
- Nmap
- Clone this repository:
git clone https://github.com/Stoicmehedi/network-scanner.git
cd network-scanner- Install the required Python packages:
pip install -r requirements.txt- Install Nmap:
- Windows: Download and install from nmap.org
- Linux:
sudo apt install nmap(Debian/Ubuntu) orsudo yum install nmap(CentOS/RHEL) - macOS:
brew install nmap
python network_scanner.py -t 192.168.1.0/24 -p 1-1000python network_scanner.py -t 192.168.1.0/24 -p 1-1000 -epython network_scanner.py -t 192.168.1.0/24 -p 1-1000 -e --no-tablepython network_scanner.py -t 192.168.1.0/24 -p 1-1000 -e --format-output results.txtpython network_scanner.py -t 192.168.1.0/24 -p 1-1000 -e --table-style gridpython background_scanner.py -t 192.168.1.0/24 -p 1-1000 -epython background_scanner.py -t 192.168.1.0/24 -p 1-1000 -e -wpython exploit_finder.pypython table_formatter.py scan_results.json [output_file.txt]This tool includes an integrated exploit database that automatically downloads and caches exploit information from the Exploit Database GitHub repository. The database is updated automatically when needed, and exploits are downloaded on-demand.
Benefits:
- No need to install searchsploit separately
- Automatic updates of the exploit database
- Caching of exploit information for faster searches
- Works on all platforms (Windows, Linux, macOS)
- Multiple fallback sources if the primary source is unavailable
- Built-in sample database for offline use
The tool automatically displays scan results in a clean, organized table format. This makes it easier to read and analyze the results, especially for large scans.
Features:
- Host summary table showing all hosts and their status
- Detailed port information for each host
- Exploit information for each service
- Multiple table styles (fancy_grid, grid, simple, etc.)
- Save formatted results to a file
-t, --target: Target IP address or network range (e.g., 192.168.1.1 or 192.168.1.0/24)-p, --ports: Ports to scan (e.g., '22,80,443' or '1-1000')-s, --scan-type: Type of scan to perform (default: -sV)-o, --output: Output file for scan results (default: scan_results.json)-e, --exploits: Check for exploits after scanning--no-table: Disable tabular output format--format-output: Output file for formatted results--table-style: Table style for formatted output (default: fancy_grid)
-t, --target: Target IP address or network range (e.g., 192.168.1.1 or 192.168.1.0/24)-p, --ports: Ports to scan (e.g., '22,80,443' or '1-1000')-s, --scan-type: Type of scan to perform (default: -sV)-o, --output: Output file for scan results-e, --exploits: Check for exploits after scanning (default: True)-w, --wait: Wait for the scan to complete and show results--no-table: Disable tabular output format--format-output: Output file for formatted results--table-style: Table style for formatted output (default: fancy_grid)
<scan_results.json>: Path to the scan results JSON file[output_file.txt]: Optional path to save the formatted results
The tool supports various table styles from the tabulate package:
fancy_grid: A fancy grid with rounded corners (default)grid: A simple grid with straight linessimple: A simple table with minimal formattingplain: A plain table with no formattingpipe: A table with pipe separatorsorgtbl: An org-mode tablepresto: A table with double borderspsql: A PostgreSQL-style tablerst: A reStructuredText-style table
python network_scanner.py -t 192.168.1.1 -p 1-1000 -epython network_scanner.py -t 192.168.1.0/24 -p 80,443,8080,8443 -epython network_scanner.py -t 192.168.1.1 -p 1-65535 -epython background_scanner.py -t 192.168.1.0/24 -p 1-1000 -eIf you encounter issues with the exploit database:
- 404 Errors: The tool will automatically try alternative sources and fall back to the built-in sample database.
- Connection Issues: If you're behind a firewall or have no internet connection, the tool will use its built-in sample database.
- Manual Update: You can force an update of the exploit database by deleting the cache folder at
~/.local/share/exploit-db/.
The scan results are saved in JSON format with the following structure:
{
"192.168.1.1": {
"status": "up",
"ports": {
"22": {
"service": "ssh",
"version": "OpenSSH 8.2p1 Ubuntu 4ubuntu0.5",
"state": "open",
"exploits": [
{
"id": "12345",
"title": "OpenSSH 8.2p1 - Remote Code Execution",
"date": "2020-01-01",
"author": "John Doe",
"type": "remote",
"platform": "linux",
"path": "exploits/linux/remote/12345.py"
}
]
}
}
}
}This tool is intended for legitimate security testing and network administration purposes only. Always ensure you have permission to scan the target network or systems. Unauthorized scanning may be illegal in many jurisdictions.
MIT License