mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
balls
This commit is contained in:
parent
13e609f613
commit
4581272c94
2 changed files with 1 additions and 7 deletions
|
@ -13,14 +13,12 @@ import (
|
||||||
const MonitorModeAddress = "0.0.0.0"
|
const MonitorModeAddress = "0.0.0.0"
|
||||||
|
|
||||||
func FindInterface(name string) (*Endpoint, error) {
|
func FindInterface(name string) (*Endpoint, error) {
|
||||||
fmt.Printf("FindInterface(%s)\n", name)
|
|
||||||
ifaces, err := net.Interfaces()
|
ifaces, err := net.Interfaces()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, iface := range ifaces {
|
for _, iface := range ifaces {
|
||||||
fmt.Printf(" %v\n", iface)
|
|
||||||
mac := iface.HardwareAddr.String()
|
mac := iface.HardwareAddr.String()
|
||||||
addrs, err := iface.Addrs()
|
addrs, err := iface.Addrs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -28,7 +26,6 @@ func FindInterface(name string) (*Endpoint, error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
nAddrs := len(addrs)
|
nAddrs := len(addrs)
|
||||||
fmt.Printf(" %s\n", addrs)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If no interface has been specified, return the first active
|
* If no interface has been specified, return the first active
|
||||||
|
@ -43,8 +40,6 @@ func FindInterface(name string) (*Endpoint, error) {
|
||||||
doCheck = true
|
doCheck = true
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf(" doCheck = %v\n", doCheck)
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -79,7 +74,6 @@ func FindInterface(name string) (*Endpoint, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if e != nil {
|
if e != nil {
|
||||||
fmt.Printf("e = %+v\n", e)
|
|
||||||
if len(e.HW) == 0 {
|
if len(e.HW) == 0 {
|
||||||
return nil, fmt.Errorf("Could not detect interface hardware address.")
|
return nil, fmt.Errorf("Could not detect interface hardware address.")
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ func (s *Session) Start() error {
|
||||||
s.Env.Set("iface.mac", s.Interface.HwAddress)
|
s.Env.Set("iface.mac", s.Interface.HwAddress)
|
||||||
|
|
||||||
if s.Queue, err = packets.NewQueue(s.Interface); err != nil {
|
if s.Queue, err = packets.NewQueue(s.Interface); err != nil {
|
||||||
return err
|
return fmt.Errorf("Error while creating packet queue: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.Gateway, err = net.FindGateway(s.Interface); err != nil {
|
if s.Gateway, err = net.FindGateway(s.Interface); err != nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue