mirror of
https://github.com/bettercap/bettercap
synced 2025-07-14 00:53:46 -07:00
new: parsing BLE flags and company identifiers from advertisements
This commit is contained in:
parent
7f68d0d82c
commit
f72dac0c95
253 changed files with 37143 additions and 487 deletions
66
vendor/github.com/chzyer/readline/std.go
generated
vendored
Normal file
66
vendor/github.com/chzyer/readline/std.go
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
package readline
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
Stdin io.ReadCloser = os.Stdin
|
||||
Stdout io.WriteCloser = os.Stdout
|
||||
Stderr io.WriteCloser = os.Stderr
|
||||
)
|
||||
|
||||
var (
|
||||
std *Instance
|
||||
stdOnce sync.Once
|
||||
)
|
||||
|
||||
// global instance will not submit history automatic
|
||||
func getInstance() *Instance {
|
||||
stdOnce.Do(func() {
|
||||
std, _ = NewEx(&Config{
|
||||
DisableAutoSaveHistory: true,
|
||||
})
|
||||
})
|
||||
return std
|
||||
}
|
||||
|
||||
// let readline load history from filepath
|
||||
// and try to persist history into disk
|
||||
// set fp to "" to prevent readline persisting history to disk
|
||||
// so the `AddHistory` will return nil error forever.
|
||||
func SetHistoryPath(fp string) {
|
||||
ins := getInstance()
|
||||
cfg := ins.Config.Clone()
|
||||
cfg.HistoryFile = fp
|
||||
ins.SetConfig(cfg)
|
||||
}
|
||||
|
||||
// set auto completer to global instance
|
||||
func SetAutoComplete(completer AutoCompleter) {
|
||||
ins := getInstance()
|
||||
cfg := ins.Config.Clone()
|
||||
cfg.AutoComplete = completer
|
||||
ins.SetConfig(cfg)
|
||||
}
|
||||
|
||||
// add history to global instance manually
|
||||
// raise error only if `SetHistoryPath` is set with a non-empty path
|
||||
func AddHistory(content string) error {
|
||||
ins := getInstance()
|
||||
return ins.SaveHistory(content)
|
||||
}
|
||||
|
||||
func Password(prompt string) ([]byte, error) {
|
||||
ins := getInstance()
|
||||
return ins.ReadPassword(prompt)
|
||||
}
|
||||
|
||||
// readline with global configs
|
||||
func Line(prompt string) (string, error) {
|
||||
ins := getInstance()
|
||||
ins.SetPrompt(prompt)
|
||||
return ins.Readline()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue