Python SDK for the ZMap network scanner
Project description
PyZmap
A Python SDK for the ZMap network scanner that provides an easy-to-use interface for network scanning operations with REST API support.
Features
- Simple API - Intuitive Python interface for ZMap network scanner
- Flexible Configuration - Comprehensive scan configuration options
- Blocklist/Allowlist Support - Easily manage blocklists and allowlists
- Output Control - Customize output formats and fields
- Result Parsing - Built-in parsers for CSV and JSON output formats
- REST API - FastAPI-based HTTP API for remote scanning operations
- Input Validation - Robust validation for IP addresses, subnets, and ports
- Type Hints - Full type annotation support for better IDE integration
- Well Tested - Comprehensive test suite included
Installation
See SETUP.md for detailed installation instructions.
Quick Start
from pyzmap import ZMap
# Initialize the PyZmap
zmap = ZMap() # Uses 'zmap' from PATH by default
# Run a basic scan on port 80
results = zmap.scan(
target_port=80,
subnets=["192.168.1.0/24"], # Scan your local network
bandwidth="1M" # Limit bandwidth to 1 Mbps
)
# Print the results
print(f"Found {len(results)} open ports")
for ip in results:
print(f"Open port at: {ip}")
# Create a blocklist
zmap.create_blocklist_file(["192.168.0.0/16", "10.0.0.0/8"], "private_ranges.txt")
# Generate a standard blocklist
zmap.generate_standard_blocklist("standard_blocklist.txt")
Core Components
The PyZmap consists of several core components:
- ZMap: The main class that provides the interface to ZMap
- ZMapScanConfig: Handles scan configuration parameters
- ZMapInput: Manages input sources (subnets, allowlists, blocklists)
- ZMapOutput: Controls output formatting and destinations
- ZMapRunner: Executes ZMap commands and captures results
- ZMapParser: Parses ZMap output into structured data
USAGE
See USAGE.md for detailed setup and usage instructions.
API Reference
See API_REFERENCE.md for detailed API documentation.
Examples
Check out the examples/ directory for practical examples:
basic-scan.py- Simple port scanning example showing essential PyZmap usageadvanced-scan.py- Advanced scanning example with custom configurations and output processing
System Requirements
- Python: 3.10 or higher
- ZMap: Latest version recommended (tested with v4.3.4)
- Operating System: Linux (primary), macOS (supported)
- Dependencies: FastAPI, uvicorn, psutil, click, httpx
Recommended System Specifications
For optimal performance when conducting network scans:
- CPU: Multi-core processor (4+ cores recommended)
- RAM: 4GB minimum, 8GB+ recommended for large scans
- Network: High-bandwidth connection for internet-wide scans
- Privileges: Root/sudo access may be required for raw socket operations
Contributing
Contributions to PyZmap are welcome! Here's how you can contribute:
Ways to Contribute
- Report Issues - Found a bug? Open an issue on GitHub with details
- Submit Pull Requests - Implement features or fix bugs
- Improve Documentation - Help improve docs or add examples
- Share Feedback - Let us know how you're using PyZmap
Coding Standards
- Style: Follow PEP 8, use Black formatter (88 char line limit)
- Type Hints: Add type annotations to all functions
- Testing: Write unit tests for new features (pytest)
- Documentation: Update README and docstrings
- Commits: Write clear, descriptive commit messages
Pull Request Process
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes and commit (
git commit -m 'Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request with a clear description
Frequently Asked Questions
See FAQ.md for answers to common questions about PyZmap.
Changelog
See CHANGELOG.md for a detailed list of changes and updates.
Acknowledgements
This project is inspired by the ZMap Project and aims to provide a user-friendly Python interface for network security researchers, system administrators, and developers.
Related Projects
- ZMap - Fast network scanner
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
License
MIT License - see LICENSE file for details
Copyright (c) 2025 Atilla
Disclaimer
The pyzmap is provided for legitimate network research and security assessments only. Please use this tool responsibly and ethically.
Important considerations:
- Always ensure you have proper authorization before scanning any network or system.
- Comply with all applicable laws and regulations regarding network scanning in your jurisdiction.
- Be aware that network scanning may be interpreted as malicious activity by network administrators and may trigger security alerts.
- The authors and contributors of this SDK are not responsible for any misuse or damage caused by this software.
- Network scanning may cause disruption to services or systems; use appropriate bandwidth and rate limiting settings.
Before using this SDK for any network scanning operation, especially on production networks, consult with network administrators and obtain proper written permission.
⚠️ Legal Notice: The pyzmap is provided for legitimate network research and security assessments only. Always ensure you have proper authorization before scanning any network or system. Unauthorized network scanning may be illegal in your jurisdiction.
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
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 pyzmap-0.1.4.tar.gz.
File metadata
- Download URL: pyzmap-0.1.4.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96f35f6e3f56d1a25620c079d05d611ff50133a75128665604ad19b596c50bfe
|
|
| MD5 |
ed313914b3df1d70ae7198456e5c8601
|
|
| BLAKE2b-256 |
2f3ec468f58495d9d26eda4387c000eaaacd3cc2a731fb387b3979a6b63d7c1b
|
File details
Details for the file pyzmap-0.1.4-py3-none-any.whl.
File metadata
- Download URL: pyzmap-0.1.4-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1162db1ce686f4ac3feec8e1579f01093fe35b0154c3e13797311410b3ae0f00
|
|
| MD5 |
ff4fac5ce923405b8cf54179703a29d6
|
|
| BLAKE2b-256 |
4cc2d312f99e238ad7fa7302294e7708088154d2ce7aefaba33726b9a3a640d2
|