Skip to main content

Sharanga is a fast, asynchronous port scanner written in Python. It supports domain/IP/CIDR scanning, custom ports, banner grabbing, and service detection. Ideal for recon, pentesting, and network analysis.

Project description

sharanga

Sharanga is a high-performance, asynchronous Python-based port scanner inspired by the legendary bow of Lord Vishnu, Sharanga, symbolizing precision and power. Designed to be faster and more efficient than traditional tools like Nmap, Sharanga leverages modern Python async capabilities for scanning multiple targets and ports concurrently with detailed service detection and banner grabbing.


Table of Contents

Overview

Sharanga is a powerful port scanner implemented in Python 3, built with asyncio to efficiently scan IP addresses, CIDR blocks, and domain names with concurrency control. It identifies open ports, attempts to detect services by common port numbers, and grabs banners for additional information. It aims to combine speed, simplicity, and extensibility while maintaining clear, user-friendly output.

The name Sharanga is taken from Hindu scriptures, representing Lord Vishnu’s celestial bow—signifying precision, strength, and divine protection, much like how this tool "targets" open services swiftly and accurately.

Features

  • Fast, asynchronous scanning using Python's asyncio and concurrency control (Semaphore)
  • Supports scanning single IPs, CIDR ranges, and domain names
  • Automatic DNS resolution for domain targets
  • Port specification with single ports, ranges, and mixed lists (e.g., 22,80,443,1000-1010)
  • Basic service detection for common ports (FTP, SSH, HTTP, SMTP, DNS, MySQL, PostgreSQL, etc.)
  • Banner grabbing with simple HTTP GET probes for enhanced service info
  • Supports concurrent scans with configurable limits
  • Multiple output formats: detailed reports or simple subdomain:port lists (ideal for scripting)
  • Graceful error handling and user interrupts
  • Minimal dependencies — pure Python 3 standard library
  • Cross-platform compatible (Linux, macOS, Windows) with appropriate event loop policy handling

Installation

  1. Prerequisites:

    • Python 3.7+ (asyncio improvements)
    • No additional packages required
  2. Install: Install the tool using pipx or pip

    pipx install sharanga
    

Usage

usage: sharanga [-h] [-p PORTS] [-iL INPUT_FILE] [-t TIMEOUT] [-c CONCURRENT] [-sP] [--version] [target]

Sharanga - High-performance Python port scanner

positional arguments:
  target                Target IP address, CIDR, or domain name

optional arguments:
  -h, --help            show this help message and exit
  -p PORTS, --ports PORTS
                        Ports to scan (default: 1-1000)
  -iL INPUT_FILE, --input-file INPUT_FILE
                        Read targets from file (one per line)
  -t TIMEOUT, --timeout TIMEOUT
                        Connection timeout in seconds (default: 1.0)
  -c CONCURRENT, --concurrent CONCURRENT
                        Max concurrent connections (default: 100)
  -sP, --simple-port    Simple output format: subdomain:port (for subdomain scanning)
  --version             show program's version number and exit

Examples

  • Scan a single IP for ports 22, 80, and 443:

    sharanga 192.168.1.1 -p 22,80,443
    
  • Scan a CIDR subnet for ports 1 through 1000:

    sharanga 192.168.1.0/24 -p 1-1000
    
  • Scan targets from a file with a custom port range:

    sharanga -iL targets.txt -p 80,443,8080-8090
    
  • Simple output format for subdomain and port pairs:

    sharanga -iL subdomains.txt -p 80,443 -sP
    

How It Works

  1. Target parsing: Supports single IPs, CIDR notation, and domain names. Domains are resolved asynchronously to IPv4 addresses.

  2. Port scanning: Each port is scanned asynchronously with configurable concurrency and timeout. Open ports return a ScanResult.

  3. Service detection & Banner grabbing: Common ports are mapped to service names. Banner grabbing attempts simple TCP probes (including HTTP GET requests) to grab response headers or welcome messages.

  4. Output: Displays detailed reports with latency, port states, detected services, and banners, or simple subdomain:port lines for automation.

Output Formats

  • Detailed report (default): Lists each host scanned, open ports with port number, state, detected service, and banner info if available. Also includes scan duration and host latency.

  • Simple format (-sP flag): Prints only lines like subdomain:port for quick parsing or integration with other tools.

Limitations

  • Currently supports only TCP port scanning.
  • Banner grabbing is basic and may not work with all protocols.
  • Only IPv4 is supported for domain resolution and scanning.
  • No OS detection or advanced Nmap-like fingerprinting.
  • Does not yet support UDP or ICMP scans.
  • Requires Python 3.7+ for best async support.

Contributing

Contributions, bug reports, and feature requests are welcome! Please fork the repository and submit a pull request or open an issue.

License

Sharanga is released under the MIT License. See LICENSE for details.

Acknowledgements

Sharanga’s name and spirit are inspired by Hindu scriptures and the divine bow of Lord Vishnu, symbolizing the precision and power we strive to achieve in network scanning.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

sharanga-1.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

sharanga-1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file sharanga-1.0.tar.gz.

File metadata

  • Download URL: sharanga-1.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for sharanga-1.0.tar.gz
Algorithm Hash digest
SHA256 89c1f6a978e88bdf00a9799e58e4930d7d91a43421b6ade92dc6e33ae1eb9e3d
MD5 a448de683442488bfafb88dc3e992530
BLAKE2b-256 7f1c0ac058de1dd64b74087b0f284ab8d2a2e3dc612246aef6d272301747a031

See more details on using hashes here.

File details

Details for the file sharanga-1.0-py3-none-any.whl.

File metadata

  • Download URL: sharanga-1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for sharanga-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66f36e3734c944aa2af9712c580075284b2565c744dda42028482aa132490ce1
MD5 080dca78c71bd6c8bfde86273fd3111f
BLAKE2b-256 e25af5c461d3cc5980f84273ba768ea752f32c0be11b77c3f74f9fc486c7e425

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