Skip to main content

port scanner

Project description

PORTFINDER

Portfinder is a powerful asynchronous port scanner for Python that allows you to quickly scan multiple targets with flexible configuration options.

Features Scan multiple IPs, CIDR ranges or domains

Custom port ranges support (e.g., 1-1000,3389,8080)

Protocol-specific scanning (TCP, UDP, HTTP, HTTPS)

High performance with async I/O and thread pooling

Multiple output formats (JSON, JSON Lines)

Quiet mode for scripting

installation as python library

pip install portfinder

Доступно на PyPI

run basic scan

portfinder -t example.com

advanced scan

portfinder -t 192.168.1.1,10.0.0.0/24,example.com -p 1-1024,3389,8080 -P http -T 1.5 -c 500 -tps 300 -o scan_results -j
Argument Description
-t, --target Target IP/CIDR/domain (comma-separated) (required)
-p, --ports Ports to scan (default: 80,443,53)
-P, --protocol Protocol to check (tcp, udp, http, https)
-T, --timeout Timeout in seconds (default: 2.0)
-c, --concurrency Maximum concurrent connections per host (default: 300) no more than ~500-1000 on CPU cores
-ips, -ip-pool-size Thread pool size for hosts scanning (default: 200)
-o, --outfile Output file path (without extension)
-j, --js Output in JSON format
-jl, --jsl Output in JSON Lines format
-q, --quiet Disable all stdout output

basic python usage

from portfinder.scanner import Scanner
from portfinder.dto import Protocol, Result

async def run_scan():
    ...
    scanner = Scanner(
        target="0.0.0.0",
        ports="80-23000",
        protocol=Protocol.HTTP,
        timeout=4.0,
        concurrency=400,
        ip_pool_size=200,
    )
    results: list[Result] = await scanner.run()
    ...
  • Result is a active port item (dataclass) with attributes:
    • host: str
    • port: int
    • ip_version: IpVersion
    • protocols: list[Protocol]
  • Protocol enum:
    • HTTP,
    • HTTPS,
    • TCP,
    • UDP

output files format:

  • txt file
...
0.0.0.0:21 [ipv4] (tcp)
...
  • json file
[
  ...
  {
    "host": "0.0.0.0",
    "port": 21,
    "ip_version": "ipv4",
    "protocols": [
      [
        "tcp"
      ]
    ]
  },
...
]
  • jsonl file
...
{"host": "0.0.0.0", "port": 53, "ip_version": "ipv4", "protocols": [["tcp"]]}
...

powered by lynkey.io

License MIT

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

portfinder-0.1.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

portfinder-0.1.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file portfinder-0.1.1.tar.gz.

File metadata

  • Download URL: portfinder-0.1.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.13 Darwin/24.3.0

File hashes

Hashes for portfinder-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e47be14258bb0c6b2c1b89ffd7d23b95726f2d1f9e9bb43fa91311f5dc950bcc
MD5 fdf31e7bb6d34f11f5d364528d34d6b0
BLAKE2b-256 d86208ac26b1ed1da7006c68f13f96d93966ef0240092fc0dab1a2eb6618072b

See more details on using hashes here.

File details

Details for the file portfinder-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: portfinder-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.13 Darwin/24.3.0

File hashes

Hashes for portfinder-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8281558a64dd0544f3b7bd6ef6dc8bfc23bbe87935fcc4e1babb1474bfbccda
MD5 13f2d2173e8573e1cb8023a3c4c1bc71
BLAKE2b-256 1acc5ccdb19790ad00472c0af51da4922a36bb759e1804f5b21f155cc6c66383

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