new: wifi.deauth and wifi.assoc now support autocompletion

This commit is contained in:
evilsocket 2019-02-18 13:25:33 +01:00
commit a4aa5acbcd
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
3 changed files with 59 additions and 17 deletions

View file

@ -8,7 +8,6 @@ import (
"fmt"
"io/ioutil"
golog "log"
"strings"
"time"
"github.com/bettercap/bettercap/modules/utils"
@ -77,7 +76,7 @@ func NewBLERecon(s *session.Session) *BLERecon {
return mod.enumAllTheThings(network.NormalizeMac(args[0]))
})
enum.Complete("ble.enum", mod.macCompleter)
enum.Complete("ble.enum", s.BLECompleter)
mod.AddHandler(enum)
@ -97,7 +96,7 @@ func NewBLERecon(s *session.Session) *BLERecon {
return mod.writeBuffer(mac, uuid, data)
})
write.Complete("ble.write", mod.macCompleter)
write.Complete("ble.write", s.BLECompleter)
mod.AddHandler(write)
@ -116,16 +115,6 @@ func (mod BLERecon) Author() string {
return "Simone Margaritelli <evilsocket@gmail.com>"
}
func (mod *BLERecon) macCompleter(prefix string) []string {
macs := []string{""}
mod.Session.BLE.EachDevice(func(mac string, dev *network.BLEDevice) {
if prefix == "" || strings.HasPrefix(mac, prefix) {
macs = append(macs, mac)
}
})
return macs
}
func (mod *BLERecon) isEnumerating() bool {
return mod.currDevice != nil
}

View file

@ -115,7 +115,7 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
"-200",
"Minimum WiFi signal strength in dBm."))
mod.AddHandler(session.NewModuleHandler("wifi.deauth BSSID", `wifi\.deauth ((?:[a-fA-F0-9:]{11,})|all|\*)`,
deauth := session.NewModuleHandler("wifi.deauth BSSID", `wifi\.deauth ((?:[a-fA-F0-9:]{11,})|all|\*)`,
"Start a 802.11 deauth attack, if an access point BSSID is provided, every client will be deauthenticated, otherwise only the selected client. Use 'all', '*' or a broadcast BSSID (ff:ff:ff:ff:ff:ff) to iterate every access point with at least one client and start a deauth attack for each one.",
func(args []string) error {
if args[0] == "all" || args[0] == "*" {
@ -126,7 +126,11 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
return err
}
return mod.startDeauth(bssid)
}))
})
deauth.Complete("wifi.deauth", s.WiFiCompleterFull)
mod.AddHandler(deauth)
mod.AddParam(session.NewStringParameter("wifi.deauth.skip",
"",
@ -141,7 +145,7 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
"true",
"Send wifi deauth packets to open networks."))
mod.AddHandler(session.NewModuleHandler("wifi.assoc BSSID", `wifi\.assoc ((?:[a-fA-F0-9:]{11,})|all|\*)`,
assoc := session.NewModuleHandler("wifi.assoc BSSID", `wifi\.assoc ((?:[a-fA-F0-9:]{11,})|all|\*)`,
"Send an association request to the selected BSSID in order to receive a RSN PMKID key. Use 'all', '*' or a broadcast BSSID (ff:ff:ff:ff:ff:ff) to iterate for every access point.",
func(args []string) error {
if args[0] == "all" || args[0] == "*" {
@ -152,7 +156,11 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
return err
}
return mod.startAssoc(bssid)
}))
})
assoc.Complete("wifi.assoc", s.WiFiCompleter)
mod.AddHandler(assoc)
mod.AddParam(session.NewStringParameter("wifi.assoc.skip",
"",