mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
Replace netstat from net-tools by ip from iproute2 (linux)
This commit is contained in:
parent
c55284429e
commit
881126941b
3 changed files with 45 additions and 33 deletions
20
net/net_darwin.go
Normal file
20
net/net_darwin.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package net
|
||||
|
||||
import "regexp"
|
||||
|
||||
var IPv4RouteParser = regexp.MustCompile("^([a-z]+)+\\s+(\\d+\\.+\\d+.\\d.+\\d)+\\s+([a-zA-z]+)+\\s+(\\d+)+\\s+(\\d+)+\\s+([a-zA-Z]+\\d+)$")
|
||||
var IPv4RouteTokens = 7
|
||||
var IPv4RouteCmd = "netstat"
|
||||
var IPv4RouteCmdOpts = []string{"-n", "-r"}
|
||||
|
||||
func IPv4RouteIsGateway(ifname string, tokens []string, f func(gateway string) (*Endpoint, error)) (*Endpoint, error) {
|
||||
ifname2 := tokens[6]
|
||||
flags := tokens[3]
|
||||
|
||||
if ifname == ifname2 && flags == "UGSc" {
|
||||
gateway := tokens[2]
|
||||
return f(gateway)
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue