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. See also the test suite and performance metrics.
See CONTRIBUTING.md for how to contribute, file issues, or get help.
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
Metadata
Release files for asncounter 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asncounter-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / asncounter-0.7.0-py3-none-any.whl
| Download URL | asncounter-0.7.0-py3-none-any.whl |
|---|---|
| Size | 23.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60b7f6c98e73d68fd58167570500211b959052ce8540622a9e1879ace7f2e2c0
|
|
BLAKE2b-256 checksum How to use checksums |
e1a1fb5f3c2921041893550ed9d0c039b595a880f72f6ac67c91931e94f0f846
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for asncounter 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.