mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
fix: fixed bug which prevented some interfaces wiht IPv6 only addresses from being detected.
This commit is contained in:
parent
35cdc59e55
commit
8d0e4ed0b1
1 changed files with 8 additions and 8 deletions
|
@ -71,19 +71,19 @@ func FindInterface(name string) (*Endpoint, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also search by ip if needed.
|
// Also search by ip if needed.
|
||||||
if name != "" {
|
hasIPv4 := false
|
||||||
for _, a := range addrs {
|
for _, a := range addrs {
|
||||||
if a.String() == name || strings.HasPrefix(a.String(), name) {
|
hasIPv4 = IPv4Validator.MatchString(a.String())
|
||||||
doCheck = true
|
if name != "" && (a.String() == name || strings.HasPrefix(a.String(), name)) {
|
||||||
break
|
doCheck = true
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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, or
|
||||||
if nAddrs == 0 {
|
// it only has an IPv6 address).
|
||||||
|
if nAddrs == 0 || hasIPv4 == false {
|
||||||
e = NewEndpointNoResolve(MonitorModeAddress, mac, ifName, 0)
|
e = NewEndpointNoResolve(MonitorModeAddress, mac, ifName, 0)
|
||||||
} else {
|
} else {
|
||||||
// For every address of the interface.
|
// For every address of the interface.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue