mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -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
25
modules/net_probe/net_probe_upnp.go
Normal file
25
modules/net_probe/net_probe_upnp.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package net_probe
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"github.com/bettercap/bettercap/packets"
|
||||
)
|
||||
|
||||
func (mod *Prober) sendProbeUPNP(from net.IP, from_hw net.HardwareAddr) {
|
||||
name := fmt.Sprintf("%s:%d", packets.UPNPDestIP, packets.UPNPPort)
|
||||
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.UPNPDiscoveryPayload); wrote > 0 {
|
||||
mod.Session.Queue.TrackSent(uint64(wrote))
|
||||
} else {
|
||||
mod.Session.Queue.TrackError()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue