mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
new: new net.probe.nbns and net.probe.mdns boolean parameters to selectively enable or disable specific probe agents
This commit is contained in:
parent
eba546bef6
commit
03161b1a95
1 changed files with 24 additions and 2 deletions
|
@ -12,9 +12,15 @@ import (
|
|||
"github.com/malfunkt/iprange"
|
||||
)
|
||||
|
||||
type Probes struct {
|
||||
NBNS bool
|
||||
MDNS bool
|
||||
}
|
||||
|
||||
type Prober struct {
|
||||
session.SessionModule
|
||||
throttle int
|
||||
probes Probes
|
||||
waitGroup *sync.WaitGroup
|
||||
}
|
||||
|
||||
|
@ -24,6 +30,14 @@ func NewProber(s *session.Session) *Prober {
|
|||
waitGroup: &sync.WaitGroup{},
|
||||
}
|
||||
|
||||
p.AddParam(session.NewBoolParameter("net.probe.nbns",
|
||||
"true",
|
||||
"Enable NetBIOS name service discovery probes."))
|
||||
|
||||
p.AddParam(session.NewBoolParameter("net.probe.mdns",
|
||||
"true",
|
||||
"Enable mDNS discovery probes."))
|
||||
|
||||
p.AddParam(session.NewIntParameter("net.probe.throttle",
|
||||
"10",
|
||||
"If greater than 0, probe packets will be throttled by this value in milliseconds."))
|
||||
|
@ -71,6 +85,10 @@ func (p *Prober) Configure() error {
|
|||
var err error
|
||||
if err, p.throttle = p.IntParam("net.probe.throttle"); err != nil {
|
||||
return err
|
||||
} else if err, p.probes.NBNS = p.BoolParam("net.probe.nbns"); err != nil {
|
||||
return err
|
||||
} else if err, p.probes.MDNS = p.BoolParam("net.probe.mdns"); err != nil {
|
||||
return err
|
||||
} else {
|
||||
log.Debug("Throttling packets of %d ms.", p.throttle)
|
||||
}
|
||||
|
@ -102,7 +120,9 @@ func (p *Prober) Start() error {
|
|||
throttle := time.Duration(p.throttle) * time.Millisecond
|
||||
|
||||
for p.Running() {
|
||||
p.sendProbeMDNS(from, from_hw)
|
||||
if p.probes.MDNS {
|
||||
p.sendProbeMDNS(from, from_hw)
|
||||
}
|
||||
|
||||
for _, ip := range addresses {
|
||||
if !p.Running() {
|
||||
|
@ -112,7 +132,9 @@ func (p *Prober) Start() error {
|
|||
continue
|
||||
}
|
||||
|
||||
p.sendProbe(from, from_hw, ip)
|
||||
if p.probes.NBNS {
|
||||
p.sendProbe(from, from_hw, ip)
|
||||
}
|
||||
|
||||
time.Sleep(throttle)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue