mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -07:00
new: ble, can, hid and wifi modules will now set a custom prompt (closes #1117)
This commit is contained in:
parent
d9a91d393e
commit
6282fe3451
7 changed files with 80 additions and 36 deletions
|
@ -81,7 +81,7 @@ func NewBLERecon(s *session.Session) *BLERecon {
|
|||
"Enumerate services and characteristics for the given BLE device.",
|
||||
func(args []string) error {
|
||||
if mod.isEnumerating() {
|
||||
return fmt.Errorf("An enumeration for %s is already running, please wait.", mod.currDevice.Device.ID())
|
||||
return fmt.Errorf("an enumeration for %s is already running, please wait.", mod.currDevice.Device.ID())
|
||||
}
|
||||
|
||||
mod.writeData = nil
|
||||
|
@ -100,11 +100,11 @@ func NewBLERecon(s *session.Session) *BLERecon {
|
|||
mac := network.NormalizeMac(args[0])
|
||||
uuid, err := gatt.ParseUUID(args[1])
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing %s: %s", args[1], err)
|
||||
return fmt.Errorf("error parsing %s: %s", args[1], err)
|
||||
}
|
||||
data, err := hex.DecodeString(args[2])
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing %s: %s", args[2], err)
|
||||
return fmt.Errorf("error parsing %s: %s", args[2], err)
|
||||
}
|
||||
|
||||
return mod.writeBuffer(mac, uuid, data)
|
||||
|
@ -190,11 +190,15 @@ func (mod *BLERecon) Configure() (err error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
const blePrompt = "{blb}{fw}BLE {fb}{reset} {bold}» {reset}"
|
||||
|
||||
func (mod *BLERecon) Start() error {
|
||||
if err := mod.Configure(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mod.SetPrompt(blePrompt)
|
||||
|
||||
return mod.SetRunning(true, func() {
|
||||
go mod.pruner()
|
||||
|
||||
|
@ -221,6 +225,8 @@ func (mod *BLERecon) Start() error {
|
|||
}
|
||||
|
||||
func (mod *BLERecon) Stop() error {
|
||||
mod.SetPrompt(session.DefaultPrompt)
|
||||
|
||||
return mod.SetRunning(false, func() {
|
||||
mod.quit <- true
|
||||
<-mod.done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue