Original post

Hello.

First off, this is a great community, and I’m sure that’s not by chance. Great job golangbridge group. This is the first time that I have needed to post anything because so many answers are already here.

I’m having trouble running one of the gopacket examples on a Windows 10 PC. (gopacket/examples/arpscan/arpscan.)

When I try to run the code, unmodified, it appears to get a valid list of interfaces with net.Interfaces() but when it attempts to open them it throws an error for each interface.
“interface Ethernet: Device{13044533-0543-4AF5-9E3C-85EBBC7C04BB}: Error opening adapter: The system cannot find the device specified. (20)”

I have the latest version of npcap installed, and WireShark uses this npcap install fine.
I’m running in Powershell and cmd as Administrator.

I’ve tried a few different ways to declare iface/ifaces in main.

func main() {
	// Get a list of all interfaces.
	//ifaces, err := net.Interfaces() // Appears to get all interfaces, but errors opening each of them. "cannot find device (20)"
	iface, err := net.InterfaceByIndex(5) // Appears to get an interface, but errors opening. "cannot find device (20)"
	//iface, err := net.InterfaceByName("Ethernet") // Appears to get an interface, but errors opening. "cannot find device (20)"
	//iface, err := net.InterfaceByName("13044533-0543-4AF5-9E3C-85EBBC7C04BB") // No such network interface
	//iface, err := net.InterfaceByName("Device{13044533-0543-4AF5-9E3C-85EBBC7C04BB}") // No such network interface
	//iface, err := net.InterfaceByName("ethernet_32772") // No such network interface (this was the ifName, according to powershell object)
	if err != nil {
		panic(err)
	}

	var wg sync.WaitGroup
	wg.Add(1)
	// Start up a scan on each interface.
	go func(iface net.Interface) {
		defer wg.Done()
		if err := scan(&iface); err != nil {
			log.Printf("interface %v: %v", iface.Name, err)
		}
	}(*iface)
	wg.Wait()
}

It looks like I get a different error “No such network device” when I use an invalid device name, so I suspect that the problem exists at the OS or npcap level.

My problem is that I’m pretty new to the language and the toolchain, and I don’t know how to get a deeper look at what is going on. Considering that the problem likely exists in non-native code (npcap dll I believe), I’m not sure how to troubleshoot beyond what I have just trying different approaches.

Any advice would be appreciated.

Thank you