Skip to content

Stoicmehedi/Network-Scanner-and-Exploit-Finder

Repository files navigation

Network Scanner and Exploit Finder

A set of Python tools for scanning networks, detecting open ports, identifying service versions, and automatically searching for exploits using an integrated exploit database.

Features

  • 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

Requirements

  • Python 3.6+
  • Nmap

Installation

  1. Clone this repository:
git clone https://github.com/Stoicmehedi/network-scanner.git
cd network-scanner
  1. Install the required Python packages:
pip install -r requirements.txt
  1. Install Nmap:
    • Windows: Download and install from nmap.org
    • Linux: sudo apt install nmap (Debian/Ubuntu) or sudo yum install nmap (CentOS/RHEL)
    • macOS: brew install nmap

Usage

Basic Network Scan

python network_scanner.py -t 192.168.1.0/24 -p 1-1000

Scan with Exploit Checking

python network_scanner.py -t 192.168.1.0/24 -p 1-1000 -e

Disable Tabular Output Format

python network_scanner.py -t 192.168.1.0/24 -p 1-1000 -e --no-table

Save Formatted Results to a File

python network_scanner.py -t 192.168.1.0/24 -p 1-1000 -e --format-output results.txt

Change Table Style

python network_scanner.py -t 192.168.1.0/24 -p 1-1000 -e --table-style grid

Run Scan in Background

python background_scanner.py -t 192.168.1.0/24 -p 1-1000 -e

Run Scan in Background and Wait for Results

python background_scanner.py -t 192.168.1.0/24 -p 1-1000 -e -w

Search for Exploits Directly

python exploit_finder.py

Format Existing Results

python table_formatter.py scan_results.json [output_file.txt]

Integrated Exploit Database

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

Tabular Output Format

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

Command Line Arguments

network_scanner.py

  • -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)

background_scanner.py

  • -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)

table_formatter.py

  • <scan_results.json>: Path to the scan results JSON file
  • [output_file.txt]: Optional path to save the formatted results

Table Styles

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 lines
  • simple: A simple table with minimal formatting
  • plain: A plain table with no formatting
  • pipe: A table with pipe separators
  • orgtbl: An org-mode table
  • presto: A table with double borders
  • psql: A PostgreSQL-style table
  • rst: A reStructuredText-style table

Examples

Scan a Single Host

python network_scanner.py -t 192.168.1.1 -p 1-1000 -e

Scan Common Web Ports

python network_scanner.py -t 192.168.1.0/24 -p 80,443,8080,8443 -e

Scan All Ports

python network_scanner.py -t 192.168.1.1 -p 1-65535 -e

Run a Quick Scan in the Background

python background_scanner.py -t 192.168.1.0/24 -p 1-1000 -e

Troubleshooting

If you encounter issues with the exploit database:

  1. 404 Errors: The tool will automatically try alternative sources and fall back to the built-in sample database.
  2. Connection Issues: If you're behind a firewall or have no internet connection, the tool will use its built-in sample database.
  3. Manual Update: You can force an update of the exploit database by deleting the cache folder at ~/.local/share/exploit-db/.

Output

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"
          }
        ]
      }
    }
  }
}

Security Notice

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.

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages