This commit is contained in:
evilsocket 2018-02-07 19:22:15 +01:00
parent d514721a2e
commit 7efd0c1103

View file

@ -13,12 +13,14 @@ import (
const MonitorModeAddress = "0.0.0.0" const MonitorModeAddress = "0.0.0.0"
func FindInterface(name string) (*Endpoint, error) { func FindInterface(name string) (*Endpoint, error) {
fmt.Printf("FindInterface(%s)\n", name)
ifaces, err := net.Interfaces() ifaces, err := net.Interfaces()
if err != nil { if err != nil {
return nil, err return nil, err
} }
for _, iface := range ifaces { for _, iface := range ifaces {
fmt.Printf(" %v\n", iface)
mac := iface.HardwareAddr.String() mac := iface.HardwareAddr.String()
addrs, err := iface.Addrs() addrs, err := iface.Addrs()
if err != nil { if err != nil {
@ -26,6 +28,7 @@ func FindInterface(name string) (*Endpoint, error) {
continue continue
} }
nAddrs := len(addrs) nAddrs := len(addrs)
fmt.Printf(" %s\n", addrs)
/* /*
* If no interface has been specified, return the first active * If no interface has been specified, return the first active
@ -40,6 +43,8 @@ func FindInterface(name string) (*Endpoint, error) {
doCheck = true doCheck = true
} }
fmt.Printf(" doCheck = %v\n", doCheck)
if doCheck { if doCheck {
var e *Endpoint = nil var e *Endpoint = nil
// interface is in monitor mode (or it's just down and the user is dumb) // interface is in monitor mode (or it's just down and the user is dumb)