diff --git a/.gitignore b/.gitignore index 67f6272c..41ed8701 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ stage/ /snap .idea -bettercap.exe \ No newline at end of file +*.exe +.vscode/ \ No newline at end of file diff --git a/network/net.go b/network/net.go index afa14822..c257010a 100644 --- a/network/net.go +++ b/network/net.go @@ -261,11 +261,12 @@ func FindInterface(name string) (*Endpoint, error) { fmt.Printf("wtf of the day: %s", err) continue } - - for _, address := range addrs { - ip := address.String() - if !strings.HasPrefix(ip, "127.0.0.1") && IPv4BlockValidator.MatchString(ip) { - return buildEndpointFromInterface(iface) + if iface.Flags&net.FlagUp != 0 { + for _, address := range addrs { + ip := address.String() + if !strings.HasPrefix(ip, "127.0.0.1") && IPv4BlockValidator.MatchString(ip) { + return buildEndpointFromInterface(iface) + } } } }