mirror of
https://github.com/bettercap/bettercap
synced 2025-07-13 08:33:48 -07:00
new: working on windows routes parser ( ref #45 )
This commit is contained in:
parent
69e042ba32
commit
59aadf79c7
1 changed files with 21 additions and 0 deletions
21
net/net_windows.go
Normal file
21
net/net_windows.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package net
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// only matches gateway lines
|
||||
var IPv4RouteParser = regexp.MustCompile("^.+\\s+.+\\s+\\d+\\s+([0-9\\.]+/\\d+)\\s+\\d+\\s+([0-9\\.]+).*$")
|
||||
var IPv4RouteTokens = 3
|
||||
var IPv4RouteCmd = "netsh"
|
||||
var IPv4RouteCmdOpts = []string{"interface", "ipv4", "show", "route"}
|
||||
|
||||
func IPv4RouteIsGateway(ifname string, tokens []string, f func(gateway string) (*Endpoint, error)) (*Endpoint, error) {
|
||||
subnet := tokens[1]
|
||||
gateway = tokens[2]
|
||||
|
||||
fmt.Printf("subnet='%s' ip='%s'\n", subnet, gateway)
|
||||
|
||||
return f(gateway)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue