mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
new: new net.fuzz network fuzzer module
This commit is contained in:
parent
26ebef7d3f
commit
5504e423fe
2 changed files with 160 additions and 0 deletions
|
@ -15,6 +15,12 @@ type Sniffer struct {
|
|||
Stats *SnifferStats
|
||||
Ctx *SnifferContext
|
||||
pktSourceChan chan gopacket.Packet
|
||||
|
||||
fuzzActive bool
|
||||
fuzzSilent bool
|
||||
fuzzLayers []string
|
||||
fuzzRate float64
|
||||
fuzzRatio float64
|
||||
}
|
||||
|
||||
func NewSniffer(s *session.Session) *Sniffer {
|
||||
|
@ -75,6 +81,35 @@ func NewSniffer(s *session.Session) *Sniffer {
|
|||
return sniff.Stop()
|
||||
}))
|
||||
|
||||
sniff.AddHandler(session.NewModuleHandler("net.fuzz on", "",
|
||||
"Enable fuzzing for every sniffed packet containing the sapecified layers.",
|
||||
func(args []string) error {
|
||||
return sniff.StartFuzzing()
|
||||
}))
|
||||
|
||||
sniff.AddHandler(session.NewModuleHandler("net.fuzz off", "",
|
||||
"Disable fuzzing",
|
||||
func(args []string) error {
|
||||
return sniff.StopFuzzing()
|
||||
}))
|
||||
|
||||
sniff.AddParam(session.NewStringParameter("net.fuzz.layers",
|
||||
"Payload",
|
||||
"",
|
||||
"Types of layer to fuzz."))
|
||||
|
||||
sniff.AddParam(session.NewDecimalParameter("net.fuzz.rate",
|
||||
"1.0",
|
||||
"Rate in the [0.0,1.0] interval of packets to fuzz."))
|
||||
|
||||
sniff.AddParam(session.NewDecimalParameter("net.fuzz.ratio",
|
||||
"0.4",
|
||||
"Rate in the [0.0,1.0] interval of bytes to fuzz for each packet."))
|
||||
|
||||
sniff.AddParam(session.NewBoolParameter("net.fuzz.silent",
|
||||
"false",
|
||||
"If true it will not report fuzzed packets."))
|
||||
|
||||
return sniff
|
||||
}
|
||||
|
||||
|
@ -149,6 +184,10 @@ func (s *Sniffer) Start() error {
|
|||
s.Stats.NumLocal++
|
||||
}
|
||||
|
||||
if s.fuzzActive {
|
||||
s.doFuzzing(packet)
|
||||
}
|
||||
|
||||
if s.Ctx.DumpLocal || !isLocal {
|
||||
data := packet.Data()
|
||||
if s.Ctx.Compiled == nil || s.Ctx.Compiled.Match(data) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue