Skip to main content

Unlock the potential of your network with this powerful IPv4 address scanner. Easily scan IP address ranges, identify active hosts, and even extract IPv4 addresses from IPv6 environments. Enhance your network monitoring, troubleshooting, and security analysis!

Project description

🐍 SnakeScan: A Reliable Python Port Scanner

A versatile and efficient Python library designed for comprehensive network port scanning.

PyPI MIT License Python 3.7+ Status: Stable

SnakeScan provides a flexible and powerful solution for network administrators, security professionals, and developers who need reliable port scanning capabilities. From simple port checks to advanced, multi-threaded subnet analysis, SnakeScan provides the tools necessary for effective network assessment.

⚙️ Key Features:

  • Flexible Port Specification: Define target ports as individual values, ranges, or through preconfigured sets.

  • Multi-Threaded Architecture: Accelerate scanning operations with parallel processing for rapid analysis.

  • IP Address Information Retrieval: Obtain detailed information about target IP addresses, supporting both IPv4 and IPv6.

  • Real-Time Port Monitoring: Utilize the Watcher class for continuous monitoring of the status of critical ports.

  • Concise Command-Line Interface and API: Easily integrate SnakeScan into workflows via command-line or programmatic access.

  • UDP Port Scanning: Built-in support for scanning UDP ports.

  • Customizable Port Dictionaries: Add your own port descriptions from JSON files and easily revert to the default set.

  • Automatic Home Directory Detection: Uses pathlib to automatically detect the user's home directory, storing configuration files in a dedicated folder. All configuration files are now located in this dedicated directory, ensuring that changes to SnakeScan's configuration do not affect the installed library files. This provides a secure and resilient setup.

⬇️ Installation:

Installation via pip (recommended):

bash

pip install SnakeScan

Alternative Installation from Source Code Archive:

SnakeScan is distributed with open source code. This means you can download the code archive, examine it, make necessary changes, and fix any errors that occur during use.

Note: Installing from the archive requires the Flit package to be installed. After downloading the archive, you need to unpack it and navigate to the directory containing the unpacked files. The command to unpack the archive depends on the archive format and the operating system being used.

bash

pip install flit

cd [directory where the archive was unpacked]

flit install

⌨️ Command Line Usage:

    • Commands for individual actions (Updating 1.9.8): scan{save}, info, dict.
    • Commands cannot be used in one line: Snake scan -t info -i dict -d ~ cause an error due to incorrect command input.
    • The optional "save" command was added to the "scan" command.
    • "save" ~ Attributes - "-s", "--save", help= Gives permission to save the file. "-n", "--name", help= The name of the file to be saved. "-p", "--path", help= Specify your own file save path. "-a", "--append", help= Add an existing file with data. **WARNING: By default, the file is overwritten every time you save it using this argument, the file will be supplemented without overwriting the content.

💡 Attribute Reference:

  • -hs --host: Provides the ability to enter a host. **WARNING: If the value is not specified, the default value will be used. **Default value: localhost.`

  • -time: Sets a timeout for each port. Examples: snake scan -time 4

  • -p: Specify target ports to scan (single port or range). Examples: snake scan -p 80,443 or snake scan -p 80,3437,8080,20-30,79-443

  • -u: Enable scanning of UDP ports. Example: snake scan -p 53 -u

  • -h: Show the full list of available command-line attributes and their descriptions. Example: snake -h or snake -help

  • -v: Display the current version of the SnakeScan library. Example: snake info -v

  • -gs: Retrieve an SSL/TLS certificate from a specified web server. Example: snake www.google.com info -gs (Requires a valid hostname to avoid connection errors.)

  • -t: Enable multithreading for improved scanning performance. Example: snake scan -t

  • -ch: Scan the subnet for active IP addresses within the network. Example: snake info -ch

  • -l: Display your public IP address (requires an active internet connection). Example: snake info -l

  • -i: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: snake www.google.com info -i

  • -a --asynchronous: Uses all ports from the predefined dictionary for asynchronous port scanning. Example: snake scan -a. If you want to scan all ports using your own port file, use the -d argument to specify the path to that file.

  • -d: Specify the path to a JSON file containing TCP port definitions and optionally, a second JSON file containing UDP port definitions. Note: Upon the first use of this argument, the paths to the JSON files must be provided with each command execution and separated by a comma. After the initial use, SnakeScan can remember these paths for subsequent scans.

    Example: snake dict -d /path/to/tcp_ports.json,/path/to/udp_ports.json (if you want to specify both TCP and UDP, if only TCP: snake dict -d /path/to/tcp_ports.json)

    Subsequent Use: After the initial setup, you can simply use the -d flag without the file paths, and SnakeScan can utilize the previously defined JSON files.

    Example (after initial setup): snake dict -d (may use previously stored paths)

    JSON File Format: The JSON file should be formatted as a dictionary where the keys are port numbers (as strings), and the values are the corresponding service names or descriptions.

    {
        "53": "DNS",
        "80": "HTTP",
        "443": "HTTPS"
    }
    
  • -dr: Reset custom port dictionaries to their default state and revert to standard SnakeScan port definitions. Example: snake dict -dr

  • -ds: Display the paths to the currently used custom port dictionaries (TCP and UDP). This is useful for verifying which custom definitions are loaded. Example: snake dict -ds

  • -home --homedir: Display the user's home directory and the location of the config.ini file. The home directory is determined automatically using the pathlib library. Example: snake info -home, snake info --homedir

💻 Python Code Integration:

⏱️ Watcher Class: Real-Time Port Status

The Watcher class allows you to continuously monitor a specified port.

python

from SnakeScan import Watcher

watcher = Watcher("localhost", 53, 2) # Host, Port, Check Interval (in seconds)

watcher.start() # Start monitoring!

Watcher Methods:

  • Watcher.start() - Start the port monitoring process.

  • Watcher.stop() - Terminate the port monitoring process.


Last Updated: 1.9.8 (Bug fix)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snakescan-1.9.8.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snakescan-1.9.8-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file snakescan-1.9.8.tar.gz.

File metadata

  • Download URL: snakescan-1.9.8.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for snakescan-1.9.8.tar.gz
Algorithm Hash digest
SHA256 2467f0533aa77d22e23be385c24c9a662b1310b214e89d8bbc7fb7952ff272d5
MD5 bd708b479e2d41b643554a89ee685d4a
BLAKE2b-256 585599456e9c389385a092765f9091e55270c7891955b18ec0bafcce2388776a

See more details on using hashes here.

File details

Details for the file snakescan-1.9.8-py3-none-any.whl.

File metadata

  • Download URL: snakescan-1.9.8-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for snakescan-1.9.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6e714b3b8e7f89f2436b56f91ed7c2aaa174e183c7fcec2c1406b5d0e1435f5b
MD5 f7c9948afc8746bb7dbcd8ba40bea313
BLAKE2b-256 010d6f49e0f2ece82fb8523e32b2e0951b6c6b4e34304cba867baab6503ba08b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page