gopcapgopacket

I cant find the device name for pcap.Openlive


I'm trying to capture packets in using gopackets and pcap but i cant find the device name for the function pcap.OpenLive.

I tried putting wlan0 as the device name and I got the error

Error opening adapter: The filename, directory name, or volume label syntax is incorrect. (123)


Solution

  • I tried putting wlan0 as the device name and I got the error

    That's a Linux-style device name. Other operating systems have different naming conventions.

    The naming conventions on Windows, with WinPcap or Npcap, are... difficult. The names include a hex representation of a 128-bit GUID.

    You should try using FindAllDevs to get a list of devices and show devices with both their names and descriptions, although the description may not be all that helpful.