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 |
|---|---|
-f, --file |
Target txt file with IP/CIDR/domain (new-line-separated) |
-t, --target |
Target IP/CIDR/domain (comma-separated) |
-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
usage with input file with docker
docker run -v $(pwd)/results:/data --rm portfinder -f /data/input_data.txt -p 1-9000 -o scan_result_ -jl
input_data.txt example
192.168.1.1
example.com
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.6.tar.gz
(9.6 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.6.tar.gz.
File metadata
- Download URL: portfinder-0.1.6.tar.gz
- Upload date:
- Size: 9.6 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 |
920f94c0c8668ab1e6d412deb90856ef1bef51c0cf0e382bf3ecaa531e547660
|
|
| MD5 |
de5a1e27e0a25cdfd1c65d20894173b8
|
|
| BLAKE2b-256 |
c2d9a4b7a06a5f3a2b7d73be70543fe2ab0383027b220d29c270db231077234a
|
File details
Details for the file portfinder-0.1.6-py3-none-any.whl.
File metadata
- Download URL: portfinder-0.1.6-py3-none-any.whl
- Upload date:
- Size: 10.1 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 |
f4fbd509975139eb41ea6eda04e59b3ed073bcd9e42cebc3a3534ab5a8e8dfa0
|
|
| MD5 |
e74d5c45c92eff358d40d456fbea1fb2
|
|
| BLAKE2b-256 |
1a9b5ef52dcaa0c5e346e9eb399aed3fd10bf7d8e1d4a627f39adcf6f9dd5934
|