mirror of
https://github.com/bettercap/bettercap
synced 2025-07-05 20:42:09 -07:00
new: new -pcap-buf-size option to set a custom pcap buffer size (closes #896)
This commit is contained in:
parent
59dce4ced6
commit
81ae731b9f
3 changed files with 10 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
|||
package core
|
||||
|
||||
import "flag"
|
||||
import (
|
||||
"flag"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
InterfaceName *string
|
||||
|
@ -18,6 +20,7 @@ type Options struct {
|
|||
MemProfile *string
|
||||
CapletsPath *string
|
||||
Script *string
|
||||
PcapBufSize *int
|
||||
}
|
||||
|
||||
func ParseOptions() (Options, error) {
|
||||
|
@ -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()
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue