[net.sniff] Add net.sniff.truncate param (default bool true) in order to toggle shortening / truncating (...) of long URLs in HTTP requests on demand

This commit is contained in:
Sabin Tudor 2018-02-04 23:31:10 +02:00
commit 839d5da9f2
4 changed files with 40 additions and 8 deletions

View file

@ -16,6 +16,7 @@ import (
type SnifferContext struct {
Handle *pcap.Handle
DumpLocal bool
Truncate bool
Verbose bool
Filter string
Expression string
@ -42,6 +43,10 @@ func (s *Sniffer) GetContext() (error, *SnifferContext) {
return err, ctx
}
if err, ctx.Truncate = s.BoolParam("net.sniff.truncate"); err != nil {
return err, ctx
}
if err, ctx.Filter = s.StringParam("net.sniff.filter"); err != nil {
return err, ctx
} else if ctx.Filter != "" {
@ -77,6 +82,7 @@ func NewSnifferContext() *SnifferContext {
return &SnifferContext{
Handle: nil,
DumpLocal: false,
Truncate: true,
Verbose: true,
Filter: "",
Expression: "",
@ -99,6 +105,12 @@ func (c *SnifferContext) Log(sess *session.Session) {
log.Info("Skip local packets : %s", yes)
}
if c.Truncate {
log.Info("Truncate : %s", yes)
} else {
log.Info("Truncate : %s", no)
}
if c.Verbose {
log.Info("Verbose : %s", yes)
} else {