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
|
@ -666,11 +666,15 @@ func (mod *WiFiModule) updateStats(dot11 *layers.Dot11, packet gopacket.Packet)
|
|||
}
|
||||
}
|
||||
|
||||
const wifiPrompt = "{by}{fb}{env.iface.name} {reset} {bold}» {reset}"
|
||||
|
||||
func (mod *WiFiModule) Start() error {
|
||||
if err := mod.Configure(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mod.SetPrompt(wifiPrompt)
|
||||
|
||||
mod.SetRunning(true, func() {
|
||||
// start channel hopper if needed
|
||||
if mod.channel == 0 && mod.source == "" {
|
||||
|
@ -721,6 +725,8 @@ func (mod *WiFiModule) Start() error {
|
|||
}
|
||||
|
||||
func (mod *WiFiModule) forcedStop() error {
|
||||
mod.SetPrompt(session.DefaultPromptMonitor)
|
||||
|
||||
return mod.SetRunning(false, func() {
|
||||
// signal the main for loop we want to exit
|
||||
if !mod.pktSourceChanClosed {
|
||||
|
@ -732,6 +738,8 @@ func (mod *WiFiModule) forcedStop() error {
|
|||
}
|
||||
|
||||
func (mod *WiFiModule) Stop() error {
|
||||
mod.SetPrompt(session.DefaultPromptMonitor)
|
||||
|
||||
return mod.SetRunning(false, func() {
|
||||
// wait any pending write operation
|
||||
mod.writes.Wait()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue