mirror of
https://github.com/bettercap/bettercap
synced 2025-07-05 20:42:09 -07:00
fix: if interface name has not been provided, avoid default to a tun interface
This commit is contained in:
parent
7beb27cfca
commit
9abf7c809a
2 changed files with 6 additions and 0 deletions
|
@ -25,6 +25,7 @@ func TestNewLAN(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("no iface found", err)
|
t.Error("no iface found", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
gateway, err := FindGateway(iface)
|
gateway, err := FindGateway(iface)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("no gateway found", err)
|
t.Error("no gateway found", err)
|
||||||
|
|
|
@ -256,6 +256,11 @@ func FindInterface(name string) (*Endpoint, error) {
|
||||||
// return the first one with a valid ipv4
|
// return the first one with a valid ipv4
|
||||||
// address that does not loop back
|
// address that does not loop back
|
||||||
for _, iface := range ifaces {
|
for _, iface := range ifaces {
|
||||||
|
// if name has not been provided, avoid default to a tun interface
|
||||||
|
if strings.Contains(iface.Name, "tun") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
addrs, err := iface.Addrs()
|
addrs, err := iface.Addrs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("wtf of the day: %s", err)
|
fmt.Printf("wtf of the day: %s", err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue