{"id":18719459,"url":"https://github.com/dkorunic/pktstat","last_synced_at":"2025-04-09T18:18:39.933Z","repository":{"id":229063439,"uuid":"775659634","full_name":"dkorunic/pktstat","owner":"dkorunic","description":"Simple ethernet interface traffic monitor and reporting tool","archived":false,"fork":false,"pushed_at":"2025-03-31T07:36:20.000Z","size":173,"stargazers_count":81,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-09T18:18:35.125Z","etag":null,"topics":["linux","networking","packet","packet-capture","terminal","unix"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dkorunic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-21T19:56:27.000Z","updated_at":"2025-04-03T11:54:19.000Z","dependencies_parsed_at":"2025-01-08T17:18:46.022Z","dependency_job_id":"87ea29fc-771d-49d6-9c9a-defc0e3180f9","html_url":"https://github.com/dkorunic/pktstat","commit_stats":null,"previous_names":["dkorunic/pktstat"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkorunic%2Fpktstat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkorunic%2Fpktstat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkorunic%2Fpktstat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkorunic%2Fpktstat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkorunic","download_url":"https://codeload.github.com/dkorunic/pktstat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085326,"owners_count":21045139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux","networking","packet","packet-capture","terminal","unix"],"created_at":"2024-11-07T13:26:10.198Z","updated_at":"2025-04-09T18:18:39.912Z","avatar_url":"https://github.com/dkorunic.png","language":"Go","readme":"# pktstat\n\n[![GitHub license](https://img.shields.io/github/license/dkorunic/pktstat)](https://github.com/dkorunic/pktstat/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/dkorunic/pktstat)](https://github.com/dkorunic/pktstat/releases/latest)\n\n![](gopher.png)\n\n## About\n\npktstat is a simple replacement for ncurses-based [pktstat](https://github.com/dleonard0/pktstat). On Linux platform it uses [AF_PACKET](https://doc.dpdk.org/guides/nics/af_packet.html), and on other platforms it uses generic PCAP live wire capture. It does not rely on any special/recent Linux kernel features (`AF_PACKET` is a feature from Linux kernel **v2.2**, from 1999) and is even cross-compatible with other Unix platforms such as Darwin, since it fallbacks to generic PCAP for non-Linux architectures.\n\nAt the end of the execution program will display per-IP and per-protocol (IPv4, IPv6, TCP, UDP, ICMPv4 and ICMPv6) statistics sorted by per-connection bps, packets and (source-IP:port, destination-IP:port) tuples.\n\nNote that typically pktstat with `AF_PACKET` is reasonably fast and works without packet loss up to several thousand packets per second but for higher traffic volume it is better to use [pktstat-bpf solution](https://github.com/dkorunic/pktstat-bpf) that is implemented as Linux eBPF program and operates nearly at wire-speed with no impact to the production system and/or no packet loss.\n\n![Demo](demo.gif)\n\n## Requirements\n\nSniffing traffic typically requires root privileges, but it is also possible to run rootless and set specific `CAP_NET_ADMIN` and `CAP_NET_RAW` [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html):\n\n```shell\n$ setcap cap_net_raw,cap_net_admin=eip pktstat\n```\n\n## Usage\n\n```shell\nNAME\n  pktstat\n\nFLAGS\n  -?, --help               display help\n  -v, --add_vlan           if true, add VLAN header\n  -j, --json               if true, output in JSON format\n      --version            display program version\n  -s, --snaplen INT        snaplen (if \u003c= 0 uses 65535) (default: 0)\n  -b, --bufsize INT        interface buffersize in MB (default: 8)\n  -f, --filter STRING      BPF filter\n  -i, --iface STRING       interface to read from (default: any)\n  -t, --timeout DURATION   timeout for packet capture (default: 0s)\n```\n\nBy default pktstat listens to all interfaces without any BPF filter. It is possible to specify interface with `--iface` and specify a BPF filter either including or excluding needed traffic, for instance `--filter \"not port 22\"`.\n\nTimeout `--timeout` will stop execution after a specified time, but it is also possible to interrupt program with Ctrl C, SIGTERM or SIGINT.\n\nWith `--json` it is possible to get traffic statistics in JSON format.\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=dkorunic/pktstat,dkorunic/pktstat-bpf\u0026type=Date)](https://star-history.com/#dkorunic/pktstat\u0026dkorunic/pktstat-bpf\u0026Date)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkorunic%2Fpktstat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkorunic%2Fpktstat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkorunic%2Fpktstat/lists"}