Automatic web server monitoring and defensive DoS/DDoS detection with blocking
Project description
webnetwork
webnetwork is a Python package that automatically monitors your web server traffic, detects DoS/DDoS attacks, and blocks malicious IPs in real-time. It supports Linux, Windows, and macOS servers.
Features
- Automatic host IP detection
- Web server log monitoring (Nginx, Apache)
- Live packet sniffing for TCP/SYN floods
- Automatic IP blocking (iptables on Linux/macOS, Windows firewall)
- Cross-platform support
- Minimal configuration required
Installation
pip install webnetwork
Usage
Fully Automatic
Automatically detects logs and interfaces:
import webnetwork
webnetwork.start()
Specify Logfile or Network Interface
import webnetwork
# Only monitor log file
webnetwork.start(logfile="/var/log/nginx/access.log")
# Only monitor network interface
webnetwork.start(iface="eth0")
# Monitor both
webnetwork.start(logfile="/var/log/nginx/access.log", iface="eth0")
Notes
- Local blocking requires admin/root privileges.
- Automatically tries to detect common log files (
/var/log/nginx/access.log,/var/log/apache2/access.log,/var/log/httpd/access_log). - Live packet sniffing requires
scapyand may need root/admin privileges. - Monitors traffic continuously and logs alerts to
alerts.csv.
Configuration
Thresholds for detection can be tuned by modifying detector.py:
LOG_CHECK_INTERVAL = 1.0
WINDOW_SECONDS = 10
REQS_PER_IP_THRESHOLD = 50
TOTAL_RPS_THRESHOLD = 200
UNIQUE_IP_ENTROPY_THRESHOLD = 0.5
SYN_RATE_THRESHOLD = 100
SYN_TO_ACK_RATIO = 5.0
License
MIT License
Author
HackingLab | Email : hackinglab | GitHub : webnetwork
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 webnetwork-1.2.3.tar.gz.
File metadata
- Download URL: webnetwork-1.2.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df711dfee81f5dfcc12b11f6c28f2635807b260da22507dc06cd93d938f9c379
|
|
| MD5 |
1412facc8d4ae5101000ad12b33db6f7
|
|
| BLAKE2b-256 |
cc62d92c079684a8052eba88561a6d42ff85737b63dd17843f9d200b0f3071c4
|
File details
Details for the file webnetwork-1.2.3-py3-none-any.whl.
File metadata
- Download URL: webnetwork-1.2.3-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
795193d614a83175927fc5ea8647f04805da49e3aa44e55a3eb09c5129a1607b
|
|
| MD5 |
a9dc0513016bb0f4dfc77593ff03a7d0
|
|
| BLAKE2b-256 |
d4252d953163e364ff833693652aae3111d56c5ec8756e540db5eb219f7e0f4f
|