mirror of
https://github.com/bettercap/bettercap
synced 2025-07-30 19:50:06 -07:00
new: net.probe on uses both NBNS and MDNS queries to fetch endpoints metadata and hostnames
This commit is contained in:
parent
36999813c4
commit
e2cc4574c4
8 changed files with 127 additions and 106 deletions
25
modules/net_probe_nbns.go
Normal file
25
modules/net_probe_nbns.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package modules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"github.com/bettercap/bettercap/log"
|
||||
"github.com/bettercap/bettercap/packets"
|
||||
)
|
||||
|
||||
func (p *Prober) sendProbeNBNS(from net.IP, from_hw net.HardwareAddr, ip net.IP) {
|
||||
name := fmt.Sprintf("%s:%d", ip, packets.NBNSPort)
|
||||
if addr, err := net.ResolveUDPAddr("udp", name); err != nil {
|
||||
log.Debug("could not resolve %s.", name)
|
||||
} else if con, err := net.DialUDP("udp", nil, addr); err != nil {
|
||||
log.Debug("could not dial %s.", name)
|
||||
} else {
|
||||
defer con.Close()
|
||||
if wrote, _ := con.Write(packets.NBNSRequest); wrote > 0 {
|
||||
p.Session.Queue.TrackSent(uint64(wrote))
|
||||
} else {
|
||||
p.Session.Queue.TrackError()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue