A lightweight network traffic analyzer built with Go and eBPF. go-net-trace monitors network activity and attributes bandwidth usage to specific Process IDs (PIDs) in real-time.
- Kernel-level Monitoring: Uses eBPF kprobes for high-efficiency data collection.
- Process Attribution: Maps network packets to the originating process.
This script uses:
tcp_sendmsgandudp_sendmsgfor outgoing traffic.tcp_recvmsgandudp_recvmsgfor incoming traffic.
bpftool btf dump file /sys/kernel/btf/vmlinux format c > bpf/vmlinux.hgo get go-net-tracego generatego build -o go-net-trace
chmod +x go-net-trace
sudo ./go-net-trace......or if you are lazy like myself, just run:
make alland then execute it with:
sudo ./go-net-trace