Count the number of hits (HTTP, packets, etc) per autonomous system number (ASN) and related network blocks
Project description
ASN counter
Count the number of hits (HTTP, packets, etc) per autonomous system number (ASN) and related network blocks.
This is useful when you get a lot of traffic on a server to figure out which network is responsible for the traffic, to direct abuse complaints or block whole networks, or on core routers to figure out who your peers are and who you might want to seek particular peering agreements with.
Features
- reads packets from a text file (or stdin) one per line
- counts number of hits, packets, sizes, latency, etc per ASN and netblock
- can parse some tcpdump output or read packets directly from interfaces with scapy
- fast ASN lookups pyasn
- automatic download of relevant databases from routeviews.org
- Prometheus exporter
- written in Python
- optional Python REPL interpreter shell to drill into reports
See the manual page for full documentation and examples.
Installation
Simply:
pip install asncounter
Can also run from the source directory directly.
Note that the pip install does not build or deploy the manual page,
as that depends on pandoc or some markdown-to-man converter, which
feels too complicated to setup in the Python tool chain.
The Debian package properly builds and ships the manual page, however,
see debian/rules for an example of how to package this on your own
distribution.
Dependencies
Optional dependencies
- manhole: to get a debugging socket
- scapy: to scrape packets directly without tcpdump (slower)
- prometheus_client: to export Prometheus metrics
- [netaddr][]: to aggregate network blocks in the REPL or manhole
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 asncounter-0.4.0-py3-none-any.whl.
File metadata
- Download URL: asncounter-0.4.0-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc08cedd6099a325a490064950c5e8ada19413794bc3a47d2686f36dd8d2f20f
|
|
| MD5 |
f338929d51ad5392d4ce524cc14a7f76
|
|
| BLAKE2b-256 |
23ce1ce7982191cee90d480e1c87d1040521912c69d469216bf6b1725332d639
|