mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 05:53:20 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
bf3671465b
commit
4eead7eafa
58 changed files with 2052 additions and 2052 deletions
24
modules/net_probe/net_probe_nbns.go
Normal file
24
modules/net_probe/net_probe_nbns.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package net_probe
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"github.com/bettercap/bettercap/packets"
|
||||
)
|
||||
|
||||
func (mod *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 {
|
||||
mod.Debug("could not resolve %s.", name)
|
||||
} else if con, err := net.DialUDP("udp", nil, addr); err != nil {
|
||||
mod.Debug("could not dial %s.", name)
|
||||
} else {
|
||||
defer con.Close()
|
||||
if wrote, _ := con.Write(packets.NBNSRequest); wrote > 0 {
|
||||
mod.Session.Queue.TrackSent(uint64(wrote))
|
||||
} else {
|
||||
mod.Session.Queue.TrackError()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue