misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2018-03-28 19:49:46 +02:00
parent a14db649d3
commit 39ed078204
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
3 changed files with 9 additions and 18 deletions

View file

@ -3,15 +3,9 @@
package modules package modules
import ( import (
"errors"
"github.com/bettercap/bettercap/session" "github.com/bettercap/bettercap/session"
) )
var (
notSupported = errors.New("ble.recon is not supported on this OS")
)
type BLERecon struct { type BLERecon struct {
session.SessionModule session.SessionModule
} }
@ -35,13 +29,13 @@ func NewBLERecon(s *session.Session) *BLERecon {
d.AddHandler(session.NewModuleHandler("ble.recon on", "", d.AddHandler(session.NewModuleHandler("ble.recon on", "",
"Start Bluetooth Low Energy devices discovery.", "Start Bluetooth Low Energy devices discovery.",
func(args []string) error { func(args []string) error {
return notSupported return session.ErrNotSupported
})) }))
d.AddHandler(session.NewModuleHandler("ble.recon off", "", d.AddHandler(session.NewModuleHandler("ble.recon off", "",
"Stop Bluetooth Low Energy devices discovery.", "Stop Bluetooth Low Energy devices discovery.",
func(args []string) error { func(args []string) error {
return notSupported return session.ErrNotSupported
})) }))
return d return d
@ -60,13 +54,13 @@ func (d BLERecon) Author() string {
} }
func (d *BLERecon) Configure() (err error) { func (d *BLERecon) Configure() (err error) {
return notSupported return session.ErrNotSupported
} }
func (d *BLERecon) Start() error { func (d *BLERecon) Start() error {
return notSupported return session.ErrNotSupported
} }
func (d *BLERecon) Stop() error { func (d *BLERecon) Stop() error {
return notSupported return session.ErrNotSupported
} }

View file

@ -8,10 +8,6 @@ import (
"github.com/bettercap/bettercap/session" "github.com/bettercap/bettercap/session"
) )
var (
notSupported = errors.New("packet.proxy is not supported on this OS")
)
type PacketProxy struct { type PacketProxy struct {
session.SessionModule session.SessionModule
} }
@ -35,13 +31,13 @@ func (pp PacketProxy) Author() string {
} }
func (pp *PacketProxy) Configure() (err error) { func (pp *PacketProxy) Configure() (err error) {
return notSupported return session.ErrNotSupported
} }
func (pp *PacketProxy) Start() error { func (pp *PacketProxy) Start() error {
return notSupported return session.ErrNotSupported
} }
func (pp *PacketProxy) Stop() error { func (pp *PacketProxy) Stop() error {
return notSupported return session.ErrNotSupported
} }

View file

@ -34,6 +34,7 @@ var (
ErrAlreadyStarted = errors.New("Module is already running.") ErrAlreadyStarted = errors.New("Module is already running.")
ErrAlreadyStopped = errors.New("Module is not running.") ErrAlreadyStopped = errors.New("Module is not running.")
ErrNotSupported = errors.New("This component is not supported on this OS.")
reCmdSpaceCleaner = regexp.MustCompile(`^([^\s]+)\s+(.+)$`) reCmdSpaceCleaner = regexp.MustCompile(`^([^\s]+)\s+(.+)$`)
) )