diff --git a/modules/api_rest/api_rest.go b/modules/api_rest/api_rest.go index 4fe32bb7..2fe63010 100644 --- a/modules/api_rest/api_rest.go +++ b/modules/api_rest/api_rest.go @@ -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 } diff --git a/modules/arp_spoof/arp_spoof.go b/modules/arp_spoof/arp_spoof.go index 9d3a9cf5..3aeb9820 100644 --- a/modules/arp_spoof/arp_spoof.go +++ b/modules/arp_spoof/arp_spoof.go @@ -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 diff --git a/modules/dns_spoof/dns_spoof.go b/modules/dns_spoof/dns_spoof.go index 0db15410..90551ef9 100644 --- a/modules/dns_spoof/dns_spoof.go +++ b/modules/dns_spoof/dns_spoof.go @@ -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 diff --git a/modules/events_stream/events_stream.go b/modules/events_stream/events_stream.go index 76529cf9..d5d444d7 100644 --- a/modules/events_stream/events_stream.go +++ b/modules/events_stream/events_stream.go @@ -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 } diff --git a/modules/hid/hid.go b/modules/hid/hid.go index 21997859..cb16b146 100644 --- a/modules/hid/hid.go +++ b/modules/hid/hid.go @@ -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 } diff --git a/modules/http_proxy/http_proxy.go b/modules/http_proxy/http_proxy.go index 9cec358d..cc4ee952 100644 --- a/modules/http_proxy/http_proxy.go +++ b/modules/http_proxy/http_proxy.go @@ -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 diff --git a/modules/https_proxy/https_proxy.go b/modules/https_proxy/https_proxy.go index 2ad85489..ff70473d 100644 --- a/modules/https_proxy/https_proxy.go +++ b/modules/https_proxy/https_proxy.go @@ -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 diff --git a/modules/net_probe/net_probe.go b/modules/net_probe/net_probe.go index 3b3ddb93..60b1ddab 100644 --- a/modules/net_probe/net_probe.go +++ b/modules/net_probe/net_probe.go @@ -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) diff --git a/modules/net_recon/net_show.go b/modules/net_recon/net_show.go index da4bcd34..55ac9cc6 100644 --- a/modules/net_recon/net_show.go +++ b/modules/net_recon/net_show.go @@ -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 { diff --git a/modules/net_sniff/net_sniff_context.go b/modules/net_sniff/net_sniff_context.go index 3ebcd9f1..e5e8410f 100644 --- a/modules/net_sniff/net_sniff_context.go +++ b/modules/net_sniff/net_sniff_context.go @@ -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 } diff --git a/modules/net_sniff/net_sniff_fuzz.go b/modules/net_sniff/net_sniff_fuzz.go index 050c1957..6b3f26b4 100644 --- a/modules/net_sniff/net_sniff_fuzz.go +++ b/modules/net_sniff/net_sniff_fuzz.go @@ -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 } diff --git a/modules/wifi/wifi.go b/modules/wifi/wifi.go index a1e5f220..37111346 100644 --- a/modules/wifi/wifi.go +++ b/modules/wifi/wifi.go @@ -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 diff --git a/modules/wifi/wifi_ap.go b/modules/wifi/wifi_ap.go index 7a5ed0b7..c19406c0 100644 --- a/modules/wifi/wifi_ap.go +++ b/modules/wifi/wifi_ap.go @@ -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 diff --git a/modules/wifi/wifi_assoc.go b/modules/wifi/wifi_assoc.go index a2fb66c9..adb9b4e8 100644 --- a/modules/wifi/wifi_assoc.go +++ b/modules/wifi/wifi_assoc.go @@ -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 diff --git a/modules/wifi/wifi_deauth.go b/modules/wifi/wifi_deauth.go index d4f77427..bf64d2fd 100644 --- a/modules/wifi/wifi_deauth.go +++ b/modules/wifi/wifi_deauth.go @@ -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 diff --git a/modules/wifi/wifi_show.go b/modules/wifi/wifi_show.go index 2206361d..84e15663 100644 --- a/modules/wifi/wifi_show.go +++ b/modules/wifi/wifi_show.go @@ -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 } diff --git a/session/module.go b/session/module.go index 1b5cd62a..41778c4b 100644 --- a/session/module.go +++ b/session/module.go @@ -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 } }