Go version of a raw socket packet sniffer. Uses the gopacket library with inspiration from the PacketBeat project.
- Install build tools:
apt-get install build-essential
- Install libpcap:
apt-get install libpcap-dev
- Download dependencies:
go get
- Optional: Modify the config.ini values
- Build the executable:
go build
$ ./sniffer -h
Usage of ./sniffer:
-config="": Path to ini config for using in go flags. May be relative to the current executable path.
-enableAf=false: Enable afpacket mode
-iface="eth0": Interface to capture packets
-pcapOut="": File path to log all packets
- Without PCAP logging:
./rawsocket
- With PCAP logging: `./rawsocket -pcapOut="output.pcap"
- Use config file: `./rawsocket -config="config.ini"
go clean