Skip to content

Commit

Permalink
new: new -pcap-buf-size option to set a custom pcap buffer size (closes
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Aug 21, 2021
1 parent 59dce4c commit 81ae731
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core/options.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package core

import "flag"
import (
"flag"
)

type Options struct {
InterfaceName *string
Expand All @@ -18,6 +20,7 @@ type Options struct {
MemProfile *string
CapletsPath *string
Script *string
PcapBufSize *int
}

func ParseOptions() (Options, error) {
Expand All @@ -37,6 +40,7 @@ func ParseOptions() (Options, error) {
MemProfile: flag.String("mem-profile", "", "Write memory profile to `file`."),
CapletsPath: flag.String("caplets-path", "", "Specify an alternative base path for caplets."),
Script: flag.String("script", "", "Load a session script."),
PcapBufSize: flag.Int("pcap-buf-size", -1, "PCAP buffer size, leave to 0 for the default value."),
}

flag.Parse()
Expand Down
2 changes: 1 addition & 1 deletion modules/wifi/wifi.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ func (mod *WiFiModule) Configure() error {
if mod.handle, err = network.CaptureWithOptions(ifName, opts); err == nil {
// we're done
break
} else if retry == 0 /* && err.Error() == ErrIfaceNotUp */ {
} else if retry == 0 && err.Error() == ErrIfaceNotUp {
// try to bring interface up and try again
mod.Info("interface %s is down, bringing it up ...", ifName)
if err := network.ActivateInterface(ifName); err != nil {
Expand Down
4 changes: 4 additions & 0 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ func New() (*Session, error) {
}
}

if bufSize := *s.Options.PcapBufSize; bufSize != -1 {
network.CAPTURE_DEFAULTS.Bufsize = bufSize
}

if s.Env, err = NewEnvironment(*s.Options.EnvFile); err != nil {
return nil, err
}
Expand Down

0 comments on commit 81ae731

Please sign in to comment.