new: new net.fuzz network fuzzer module

This commit is contained in:
evilsocket 2019-01-28 17:06:27 +01:00
commit 5504e423fe
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
2 changed files with 160 additions and 0 deletions

View file

@ -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) {