mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 22:13:18 -07:00
session: SessionModule.BoolParam() swap error return
modules: fix calling functions to reflect swapped return
This commit is contained in:
parent
c9cc78f9b3
commit
271a1f2592
17 changed files with 31 additions and 31 deletions
|
@ -207,7 +207,7 @@ func (mod *RestAPI) Configure() error {
|
|||
return err
|
||||
} else if err, mod.password = mod.StringParam("api.rest.password"); err != nil {
|
||||
return err
|
||||
} else if err, mod.useWebsocket = mod.BoolParam("api.rest.websocket"); err != nil {
|
||||
} else if mod.useWebsocket, err = mod.BoolParam("api.rest.websocket"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -97,9 +97,9 @@ func (mod *ArpSpoofer) Configure() error {
|
|||
var targets string
|
||||
var whitelist string
|
||||
|
||||
if err, mod.fullDuplex = mod.BoolParam("arp.spoof.fullduplex"); err != nil {
|
||||
if mod.fullDuplex, err = mod.BoolParam("arp.spoof.fullduplex"); err != nil {
|
||||
return err
|
||||
} else if err, mod.internal = mod.BoolParam("arp.spoof.internal"); err != nil {
|
||||
} else if mod.internal, err = mod.BoolParam("arp.spoof.internal"); err != nil {
|
||||
return err
|
||||
} else if err, targets = mod.StringParam("arp.spoof.targets"); err != nil {
|
||||
return err
|
||||
|
|
|
@ -94,7 +94,7 @@ func (mod *DNSSpoofer) Configure() error {
|
|||
return err
|
||||
} else if err = mod.Handle.SetBPFFilter("udp"); err != nil {
|
||||
return err
|
||||
} else if err, mod.All = mod.BoolParam("dns.spoof.all"); err != nil {
|
||||
} else if mod.All, err = mod.BoolParam("dns.spoof.all"); err != nil {
|
||||
return err
|
||||
} else if err, address = mod.IPParam("dns.spoof.address"); err != nil {
|
||||
return err
|
||||
|
|
|
@ -248,11 +248,11 @@ func (mod *EventsStream) Configure() (err error) {
|
|||
}
|
||||
}
|
||||
|
||||
if err, mod.rotation.Enabled = mod.BoolParam("events.stream.output.rotate"); err != nil {
|
||||
if mod.rotation.Enabled, err = mod.BoolParam("events.stream.output.rotate"); err != nil {
|
||||
return err
|
||||
} else if err, mod.timeFormat = mod.StringParam("events.stream.time.format"); err != nil {
|
||||
return err
|
||||
} else if err, mod.rotation.Compress = mod.BoolParam("events.stream.output.rotate.compress"); err != nil {
|
||||
} else if mod.rotation.Compress, err = mod.BoolParam("events.stream.output.rotate.compress"); err != nil {
|
||||
return err
|
||||
} else if err, mod.rotation.Format = mod.StringParam("events.stream.output.rotate.format"); err != nil {
|
||||
return err
|
||||
|
@ -262,11 +262,11 @@ func (mod *EventsStream) Configure() (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
if err, mod.dumpHttpReqs = mod.BoolParam("events.stream.http.request.dump"); err != nil {
|
||||
if mod.dumpHttpReqs, err = mod.BoolParam("events.stream.http.request.dump"); err != nil {
|
||||
return err
|
||||
} else if err, mod.dumpHttpResp = mod.BoolParam("events.stream.http.response.dump"); err != nil {
|
||||
} else if mod.dumpHttpResp, err = mod.BoolParam("events.stream.http.response.dump"); err != nil {
|
||||
return err
|
||||
} else if err, mod.dumpFormatHex = mod.BoolParam("events.stream.http.format.hex"); err != nil {
|
||||
} else if mod.dumpFormatHex, err = mod.BoolParam("events.stream.http.format.hex"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ func (mod *HIDRecon) Configure() error {
|
|||
return session.ErrAlreadyStarted(mod.Name())
|
||||
}
|
||||
|
||||
if err, mod.useLNA = mod.BoolParam("hid.lna"); err != nil {
|
||||
if mod.useLNA, err = mod.BoolParam("hid.lna"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ func (mod *HttpProxy) Configure() error {
|
|||
return err
|
||||
} else if err, scriptPath = mod.StringParam("http.proxy.script"); err != nil {
|
||||
return err
|
||||
} else if err, stripSSL = mod.BoolParam("http.proxy.sslstrip"); err != nil {
|
||||
} else if stripSSL, err = mod.BoolParam("http.proxy.sslstrip"); err != nil {
|
||||
return err
|
||||
} else if err, jsToInject = mod.StringParam("http.proxy.injectjs"); err != nil {
|
||||
return err
|
||||
|
|
|
@ -113,7 +113,7 @@ func (mod *HttpsProxy) Configure() error {
|
|||
return err
|
||||
} else if err, httpPort = mod.IntParam("https.port"); err != nil {
|
||||
return err
|
||||
} else if err, stripSSL = mod.BoolParam("https.proxy.sslstrip"); err != nil {
|
||||
} else if stripSSL, err = mod.BoolParam("https.proxy.sslstrip"); err != nil {
|
||||
return err
|
||||
} else if err, certFile = mod.StringParam("https.proxy.certificate"); err != nil {
|
||||
return err
|
||||
|
|
|
@ -83,13 +83,13 @@ func (mod *Prober) Configure() error {
|
|||
var err error
|
||||
if err, mod.throttle = mod.IntParam("net.probe.throttle"); err != nil {
|
||||
return err
|
||||
} else if err, mod.probes.NBNS = mod.BoolParam("net.probe.nbns"); err != nil {
|
||||
} else if mod.probes.NBNS, err = mod.BoolParam("net.probe.nbns"); err != nil {
|
||||
return err
|
||||
} else if err, mod.probes.MDNS = mod.BoolParam("net.probe.mdns"); err != nil {
|
||||
} else if mod.probes.MDNS, err = mod.BoolParam("net.probe.mdns"); err != nil {
|
||||
return err
|
||||
} else if err, mod.probes.UPNP = mod.BoolParam("net.probe.upnp"); err != nil {
|
||||
} else if mod.probes.UPNP, err = mod.BoolParam("net.probe.upnp"); err != nil {
|
||||
return err
|
||||
} else if err, mod.probes.WSD = mod.BoolParam("net.probe.wsd"); err != nil {
|
||||
} else if mod.probes.WSD, err = mod.BoolParam("net.probe.wsd"); err != nil {
|
||||
return err
|
||||
} else {
|
||||
mod.Debug("Throttling packets of %d ms.", mod.throttle)
|
||||
|
|
|
@ -241,7 +241,7 @@ func (mod *Discovery) Show(arg string) (err error) {
|
|||
}
|
||||
|
||||
hasMeta := false
|
||||
if err, showMeta := mod.BoolParam("net.show.meta"); err != nil {
|
||||
if showMeta, err := mod.BoolParam("net.show.meta"); err != nil {
|
||||
return err
|
||||
} else if showMeta {
|
||||
for _, t := range targets {
|
||||
|
|
|
@ -51,11 +51,11 @@ func (mod *Sniffer) GetContext() (error, *SnifferContext) {
|
|||
}
|
||||
}
|
||||
|
||||
if err, ctx.Verbose = mod.BoolParam("net.sniff.verbose"); err != nil {
|
||||
if ctx.Verbose, err = mod.BoolParam("net.sniff.verbose"); err != nil {
|
||||
return err, ctx
|
||||
}
|
||||
|
||||
if err, ctx.DumpLocal = mod.BoolParam("net.sniff.local"); err != nil {
|
||||
if ctx.DumpLocal, err = mod.BoolParam("net.sniff.local"); err != nil {
|
||||
return err, ctx
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ func (mod *Sniffer) configureFuzzing() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
if err, mod.fuzzSilent = mod.BoolParam("net.fuzz.silent"); err != nil {
|
||||
if mod.fuzzSilent, err = mod.BoolParam("net.fuzz.silent"); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -437,7 +437,7 @@ func (mod *WiFiModule) Configure() error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err, mod.shakesAggregate = mod.BoolParam("wifi.handshakes.aggregate"); err != nil {
|
||||
if mod.shakesAggregate, err = mod.BoolParam("wifi.handshakes.aggregate"); err != nil {
|
||||
return err
|
||||
} else if err, mod.shakesFile = mod.StringParam("wifi.handshakes.file"); err != nil {
|
||||
return err
|
||||
|
@ -515,7 +515,7 @@ func (mod *WiFiModule) Configure() error {
|
|||
}
|
||||
}
|
||||
|
||||
if err, mod.skipBroken = mod.BoolParam("wifi.skip-broken"); err != nil {
|
||||
if mod.skipBroken, err = mod.BoolParam("wifi.skip-broken"); err != nil {
|
||||
return err
|
||||
} else if err, hopPeriod = mod.IntParam("wifi.hop.period"); err != nil {
|
||||
return err
|
||||
|
|
|
@ -24,7 +24,7 @@ func (mod *WiFiModule) parseApConfig() (err error) {
|
|||
return
|
||||
} else if err, mod.apConfig.Channel = mod.IntParam("wifi.ap.channel"); err != nil {
|
||||
return
|
||||
} else if err, mod.apConfig.Encryption = mod.BoolParam("wifi.ap.encryption"); err != nil {
|
||||
} else if mod.apConfig.Encryption, err = mod.BoolParam("wifi.ap.encryption"); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
|
|
|
@ -34,7 +34,7 @@ func (mod *WiFiModule) skipAssoc(to net.HardwareAddr) bool {
|
|||
}
|
||||
|
||||
func (mod *WiFiModule) isAssocSilent() bool {
|
||||
if err, is := mod.BoolParam("wifi.assoc.silent"); err != nil {
|
||||
if is, err := mod.BoolParam("wifi.assoc.silent"); err != nil {
|
||||
mod.Warning("%v", err)
|
||||
} else {
|
||||
mod.assocSilent = is
|
||||
|
@ -43,7 +43,7 @@ func (mod *WiFiModule) isAssocSilent() bool {
|
|||
}
|
||||
|
||||
func (mod *WiFiModule) doAssocOpen() bool {
|
||||
if err, is := mod.BoolParam("wifi.assoc.open"); err != nil {
|
||||
if is, err := mod.BoolParam("wifi.assoc.open"); err != nil {
|
||||
mod.Warning("%v", err)
|
||||
} else {
|
||||
mod.assocOpen = is
|
||||
|
|
|
@ -50,7 +50,7 @@ func (mod *WiFiModule) skipDeauth(to net.HardwareAddr) bool {
|
|||
}
|
||||
|
||||
func (mod *WiFiModule) isDeauthSilent() bool {
|
||||
if err, is := mod.BoolParam("wifi.deauth.silent"); err != nil {
|
||||
if is, err := mod.BoolParam("wifi.deauth.silent"); err != nil {
|
||||
mod.Warning("%v", err)
|
||||
} else {
|
||||
mod.deauthSilent = is
|
||||
|
@ -59,7 +59,7 @@ func (mod *WiFiModule) isDeauthSilent() bool {
|
|||
}
|
||||
|
||||
func (mod *WiFiModule) doDeauthOpen() bool {
|
||||
if err, is := mod.BoolParam("wifi.deauth.open"); err != nil {
|
||||
if is, err := mod.BoolParam("wifi.deauth.open"); err != nil {
|
||||
mod.Warning("%v", err)
|
||||
} else {
|
||||
mod.deauthOpen = is
|
||||
|
|
|
@ -325,7 +325,7 @@ func (mod *WiFiModule) Show() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
if err, mod.showManuf = mod.BoolParam("wifi.show.manufacturer"); err != nil {
|
||||
if mod.showManuf, err = mod.BoolParam("wifi.show.manufacturer"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -215,11 +215,11 @@ func (m SessionModule) DecParam(name string) (error, float64) {
|
|||
}
|
||||
}
|
||||
|
||||
func (m SessionModule) BoolParam(name string) (error, bool) {
|
||||
func (m SessionModule) BoolParam(name string) (bool, error) {
|
||||
if v, err := m.params[name].Get(m.Session); err != nil {
|
||||
return err, false
|
||||
return false, err
|
||||
} else {
|
||||
return nil, v.(bool)
|
||||
return v.(bool), nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue