mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
Cleaner handling of modules start/stop
This commit is contained in:
parent
1ee605d01d
commit
b1678b5902
6 changed files with 66 additions and 42 deletions
|
@ -20,14 +20,16 @@ func NewProber(s *session.Session) *Prober {
|
|||
|
||||
p.AddParam(session.NewIntParameter("net.probe.throttle", "10", "", "If greater than 0, probe packets will be throttled by this value in milliseconds."))
|
||||
|
||||
p.AddHandler(session.NewModuleHandler("net.probe (on|off)", "^net\\.probe\\s+(on|off)$",
|
||||
"Start/stop network hosts probing in background.",
|
||||
p.AddHandler(session.NewModuleHandler("net.probe on", "",
|
||||
"Start network hosts probing in background.",
|
||||
func(args []string) error {
|
||||
if args[0] == "on" {
|
||||
return p.Start()
|
||||
} else {
|
||||
return p.Stop()
|
||||
}
|
||||
return p.Start()
|
||||
}))
|
||||
|
||||
p.AddHandler(session.NewModuleHandler("net.probe off", "",
|
||||
"Stop network hosts probing in background.",
|
||||
func(args []string) error {
|
||||
return p.Stop()
|
||||
}))
|
||||
|
||||
return p
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue