mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
new: new net.probe.upnp agent
This commit is contained in:
parent
03161b1a95
commit
42c71845ed
3 changed files with 83 additions and 0 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
type Probes struct {
|
||||
NBNS bool
|
||||
MDNS bool
|
||||
UPNP bool
|
||||
}
|
||||
|
||||
type Prober struct {
|
||||
|
@ -38,6 +39,10 @@ func NewProber(s *session.Session) *Prober {
|
|||
"true",
|
||||
"Enable mDNS discovery probes."))
|
||||
|
||||
p.AddParam(session.NewBoolParameter("net.probe.upnp",
|
||||
"true",
|
||||
"Enable UPNP discovery probes."))
|
||||
|
||||
p.AddParam(session.NewIntParameter("net.probe.throttle",
|
||||
"10",
|
||||
"If greater than 0, probe packets will be throttled by this value in milliseconds."))
|
||||
|
@ -89,6 +94,8 @@ func (p *Prober) Configure() error {
|
|||
return err
|
||||
} else if err, p.probes.MDNS = p.BoolParam("net.probe.mdns"); err != nil {
|
||||
return err
|
||||
} else if err, p.probes.UPNP = p.BoolParam("net.probe.upnp"); err != nil {
|
||||
return err
|
||||
} else {
|
||||
log.Debug("Throttling packets of %d ms.", p.throttle)
|
||||
}
|
||||
|
@ -124,6 +131,10 @@ func (p *Prober) Start() error {
|
|||
p.sendProbeMDNS(from, from_hw)
|
||||
}
|
||||
|
||||
if p.probes.UPNP {
|
||||
p.sendProbeUPNP(from, from_hw)
|
||||
}
|
||||
|
||||
for _, ip := range addresses {
|
||||
if !p.Running() {
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue