Network Sniffer

I am looking for a way to listen on an interface for all incoming traffic using the go programming language.

I would want it to be something similar to this python:

import socket, sys
from struct import *
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)

while True:
packet = s.recvfrom(65565)

This was the first Google hit for me, and looks relevant:

1 Like

Thanks Jakob.

I’ll look into this.

I think gopacket is also worth mentioning:

Thanks Bruno. That seems to be another great example as it allows you to define your interface, and has modules already built in to decode your packet. Thanks again for the suggestion.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.