mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -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
|
@ -144,11 +144,15 @@ func (mod *CANModule) onFrame(frame can.Frame) {
|
|||
mod.Session.Events.Add("can.message", msg)
|
||||
}
|
||||
|
||||
const canPrompt = "{br}{fw}{env.can.device} {fb}{reset} {bold}» {reset}"
|
||||
|
||||
func (mod *CANModule) Start() error {
|
||||
if err := mod.Configure(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mod.SetPrompt(canPrompt)
|
||||
|
||||
return mod.SetRunning(true, func() {
|
||||
mod.Info("started on %s ...", mod.deviceName)
|
||||
|
||||
|
@ -160,6 +164,8 @@ func (mod *CANModule) Start() error {
|
|||
}
|
||||
|
||||
func (mod *CANModule) Stop() error {
|
||||
mod.SetPrompt(session.DefaultPrompt)
|
||||
|
||||
return mod.SetRunning(false, func() {
|
||||
if mod.conn != nil {
|
||||
mod.recv.Close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue