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.
Navigation
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 async I/O implementation
- Multiple output formats (JSON, JSON Lines, plain text)
- Quiet mode for scripting
Installation as Python Library 
pip install portfinder
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 |
-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 |
usage with docker
docker run --rm stanley0507/portfinder:latest -t 192.168.1.1 -p 1-1000
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()
...
Resultis a active port item (dataclass) with attributes:- host: str
- port: int
- ip_version: IpVersion
- protocols: list[Protocol]
Protocolenum:- 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.5.tar.gz
(7.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file portfinder-0.1.5.tar.gz.
File metadata
- Download URL: portfinder-0.1.5.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73c2ffaad83400dc02fffac03b9cd6e69eef9e302f5fde2c46a80afe7a1a8de1
|
|
| MD5 |
cec1553f6f190249fc1f1364f56d6ba7
|
|
| BLAKE2b-256 |
57dffa20d6ed8a325282b929410976c60e58f85b755a6b95654de64306cc4b82
|
File details
Details for the file portfinder-0.1.5-py3-none-any.whl.
File metadata
- Download URL: portfinder-0.1.5-py3-none-any.whl
- Upload date:
- Size: 8.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b7ee0c36204d426b826bc99d399eba95d79193e0a61243b4493348f31fe20a2
|
|
| MD5 |
d3ed8fc63459f3c9d798f7b405161fbc
|
|
| BLAKE2b-256 |
5ded93417edb3360f1a6a7984ec0fe1e8c43551c85075932ab48f9ba308080a5
|