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.
|
||||
if name != "" {
|
||||
hasIPv4 := false
|
||||
for _, a := range addrs {
|
||||
if a.String() == name || strings.HasPrefix(a.String(), name) {
|
||||
hasIPv4 = IPv4Validator.MatchString(a.String())
|
||||
if name != "" && (a.String() == name || strings.HasPrefix(a.String(), name)) {
|
||||
doCheck = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if doCheck {
|
||||
var e *Endpoint = nil
|
||||
// interface is in monitor mode (or it's just down and the user is dumb)
|
||||
if nAddrs == 0 {
|
||||
// interface is in monitor mode (or it's just down and the user is dumb, or
|
||||
// it only has an IPv6 address).
|
||||
if nAddrs == 0 || hasIPv4 == false {
|
||||
e = NewEndpointNoResolve(MonitorModeAddress, mac, ifName, 0)
|
||||
} else {
|
||||
// For every address of the interface.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue