Skip to main content

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 or packets 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

asncounter-0.2.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file asncounter-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: asncounter-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for asncounter-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37c295ff1b3086276bfee96bbd7547e5ae16f2b03789b5250f3e54816864c39e
MD5 2a4279a1bc50ba6b27ef19adf51796ce
BLAKE2b-256 975e34c12a5b108b42496e63fbefd0113e09cbcbb69587d679169950f99d22d9

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