Skip to main content

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 scapy and 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

mrfidal – mrfidal@proton.me

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

webnetwork-1.1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webnetwork-1.1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file webnetwork-1.1.1.tar.gz.

File metadata

  • Download URL: webnetwork-1.1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for webnetwork-1.1.1.tar.gz
Algorithm Hash digest
SHA256 88e4f1fc6926adf2be615cc41751fd31cd8a76d36a75bdcb15d1e3d09ab17a69
MD5 222f173f82de0215f7aa37c5ef2d2ab6
BLAKE2b-256 61a75e9ae206616167d91cc92bb7f5d799af9ab9e503d82ee167de4ab3d66d21

See more details on using hashes here.

File details

Details for the file webnetwork-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: webnetwork-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for webnetwork-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89559dccef6a5d66c2f477a5925dc51a1e380e2d706c40f550b4e9ff1d600ead
MD5 9e75488afe8316d16941474e217d98c6
BLAKE2b-256 e229c5504d26bfc6a3479e7a3a9e597974f4a99c210e816ecbd38b650a38fa72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page