https://github.com/luhuadong/zapnet
A high-performance network diagnostics toolkit with Multi-Protocol Support, including TCP and UDP.
https://github.com/luhuadong/zapnet
network pypi-package python python-package python3 socket
Last synced: about 1 year ago
JSON representation
A high-performance network diagnostics toolkit with Multi-Protocol Support, including TCP and UDP.
- Host: GitHub
- URL: https://github.com/luhuadong/zapnet
- Owner: luhuadong
- License: mit
- Created: 2025-03-23T18:06:53.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-24T10:01:08.000Z (about 1 year ago)
- Last Synced: 2025-03-24T10:39:03.368Z (about 1 year ago)
- Topics: network, pypi-package, python, python-package, python3, socket
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZapNet β‘
[](https://opensource.org/licenses/MIT) [](https://www.python.org/) [](https://pypi.org/project/zapnet/)
[δΈζ](README_zh.md) | [English](README.md)
ZapNet is a high-performance network diagnostics toolkit with Multi-Protocol Support, including TCP and UDP.
## Key Features
- π **Dual Protocol Engine**: TCP full-duplex / UDP broadcast
- π **Traffic Analytics**: Real-time connection monitoring
- π§ **Smart Config**: YAML-driven test scenarios
- πΎ **Data Archiving**: Raw packet capture (ASCII/Hex)
- π **Cross-Platform**: Windows/macOS/Linux support
## Installation
```python
# For production use
pip install zapnet
# Development setup
git clone https://github.com/luhuadong/zapnet.git
cd zapnet && pip install -e .[dev]
```
## Quick Start
### TCP Server/Client
```bash
# Start TCP server
zapnet tcp server --port 5555
# Start TCP client
zapnet tcp client --host 127.0.0.1 --port 5555 --data "Hello, World"
# Send hexadecimal content
zapnet tcp client --host 127.0.0.1 --port 5555 --hex "A1B2C3D4"
# Another form to fill in target IP and port
zapnet tcp client --target 127.0.0.1:5555 --hex "A1B2C3D4"
```
### UDP Server/Client
```bash
# Start UDP server
zapnet udp server --port 6666
# Start UDP client
zapnet udp client --host 127.0.0.1 --port 6666 --data "Hello, World"
# Send hexadecimal content
zapnet udp client --host 127.0.0.1 --port 6666 --hex "A1B2C3D4"
# Another form to fill in target IP and port
zapnet udp client --target 127.0.0.1:6666 --hex "A1B2C3D4"
```
### Device Discovery (UDP Broadcast)
```bash
# Send probe broadcast
zapnet udp client --target 192.168.1.255:9999 --broadcast --hex "A1B2C3D4"
# Monitor responses
zapnet udp server --port 9999 --filter "hex_contains(payload, 'C3D4')" --output devices.log
```
### Network Sniffing (UDP)
```bash
# Capture DNS queries
zapnet udp server --port 53 --hex --stats 5
# Send custom DNS query
zapnet udp client --target 8.8.8.8:53 --hex "b362010000010000000000000377777706676f6f676c6503636f6d0000010001"
```
### TCP Stress Testing
```bash
# Start TCP server
zapnet tcp server --port 9000 --max-conn 50 --timeout 300
# Simulate high concurrency
zapnet tcp client --host 127.0.0.1 --port 9000 --threads 10 --duration 60 --message "LOAD_TEST"
```
### File Transfer
```bash
# Send file (TCP)
zapnet tcp client --host 192.168.1.100 --port 8888 --file data.zip
# Receive files
zapnet tcp server --port 8888 --output received_files/
```
## Advanced Configuration
You can set default parameters through ZapNet's configuration file `config.yaml`, for example:
```yaml
network:
tcp:
buffer_size: 4096
keepalive: true
udp:
broadcast_ttl: 64
logging:
level: debug
rotation: 100MB
security:
allowed_ips: ["192.168.1.0/24"]
```
Launch with:
```bash
zapnet --config config.yaml
```
## License
Distributed under the MIT License. See [LICENSE](LICENSE.md) for more information.