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

This commit is contained in:
evilsocket 2018-02-26 19:20:45 +01:00
commit 76a537984d
4 changed files with 70 additions and 50 deletions

View file

@ -166,12 +166,12 @@ mkdir $BUILD_FOLDER
cd $BUILD_FOLDER cd $BUILD_FOLDER
# build_android_arm bettercap_android_arm_$VERSION # build_android_arm bettercap_android_arm_$VERSION
build_linux_amd64 bettercap_linux_amd64_$VERSION # build_linux_amd64 bettercap_linux_amd64_$VERSION
build_linux_arm7 bettercap_linux_arm7_$VERSION # build_linux_arm7 bettercap_linux_arm7_$VERSION
build_linux_mips bettercap_linux_mips_$VERSION # build_linux_mips bettercap_linux_mips_$VERSION
build_linux_mipsle bettercap_linux_mipsle_$VERSION # build_linux_mipsle bettercap_linux_mipsle_$VERSION
build_linux_mips64 bettercap_linux_mips64_$VERSION # build_linux_mips64 bettercap_linux_mips64_$VERSION
build_linux_mips64le bettercap_linux_mips64le_$VERSION # build_linux_mips64le bettercap_linux_mips64le_$VERSION
build_macos_amd64 bettercap_macos_amd64_$VERSION build_macos_amd64 bettercap_macos_amd64_$VERSION
build_windows_amd64 bettercap_windows_amd64_$VERSION.exe build_windows_amd64 bettercap_windows_amd64_$VERSION.exe
sha256sum * > checksums.txt sha256sum * > checksums.txt

View file

@ -139,50 +139,6 @@ func (s EventsStream) viewSnifferEvent(e session.Event) {
misc) misc)
} }
func (s EventsStream) viewBLEEvent(e session.Event) {
if e.Tag == "ble.device.new" {
dev := e.Data.(*network.BLEDevice)
name := dev.Device.Name()
if name != "" {
name = " " + core.Bold(name)
}
vend := dev.Vendor
if vend != "" {
vend = fmt.Sprintf(" (%s)", core.Yellow(vend))
}
fmt.Printf("[%s] [%s] New BLE device%s detected as %s%s %s.\n",
e.Time.Format(eventTimeFormat),
core.Green(e.Tag),
name,
dev.Device.ID(),
vend,
core.Dim(fmt.Sprintf("%d dBm", dev.RSSI)))
} else if e.Tag == "ble.device.lost" {
dev := e.Data.(*network.BLEDevice)
name := dev.Device.Name()
if name != "" {
name = " " + core.Bold(name)
}
vend := dev.Vendor
if vend != "" {
vend = fmt.Sprintf(" (%s)", core.Yellow(vend))
}
fmt.Printf("[%s] [%s] BLE device%s %s%s lost.\n",
e.Time.Format(eventTimeFormat),
core.Green(e.Tag),
name,
dev.Device.ID(),
vend)
} else {
fmt.Printf("[%s] [%s] %v\n",
e.Time.Format(eventTimeFormat),
core.Green(e.Tag),
e.Data)
}
}
func (s EventsStream) viewSynScanEvent(e session.Event) { func (s EventsStream) viewSynScanEvent(e session.Event) {
se := e.Data.(SynScanEvent) se := e.Data.(SynScanEvent)
fmt.Printf("[%s] [%s] Found open port %d for %s\n", fmt.Printf("[%s] [%s] Found open port %d for %s\n",

View file

@ -0,0 +1,55 @@
// +build !windows
package modules
import (
"fmt"
"github.com/bettercap/bettercap/core"
"github.com/bettercap/bettercap/network"
"github.com/bettercap/bettercap/session"
)
func (s EventsStream) viewBLEEvent(e session.Event) {
if e.Tag == "ble.device.new" {
dev := e.Data.(*network.BLEDevice)
name := dev.Device.Name()
if name != "" {
name = " " + core.Bold(name)
}
vend := dev.Vendor
if vend != "" {
vend = fmt.Sprintf(" (%s)", core.Yellow(vend))
}
fmt.Printf("[%s] [%s] New BLE device%s detected as %s%s %s.\n",
e.Time.Format(eventTimeFormat),
core.Green(e.Tag),
name,
dev.Device.ID(),
vend,
core.Dim(fmt.Sprintf("%d dBm", dev.RSSI)))
} else if e.Tag == "ble.device.lost" {
dev := e.Data.(*network.BLEDevice)
name := dev.Device.Name()
if name != "" {
name = " " + core.Bold(name)
}
vend := dev.Vendor
if vend != "" {
vend = fmt.Sprintf(" (%s)", core.Yellow(vend))
}
fmt.Printf("[%s] [%s] BLE device%s %s%s lost.\n",
e.Time.Format(eventTimeFormat),
core.Green(e.Tag),
name,
dev.Device.ID(),
vend)
} else {
fmt.Printf("[%s] [%s] %v\n",
e.Time.Format(eventTimeFormat),
core.Green(e.Tag),
e.Data)
}
}

View file

@ -0,0 +1,9 @@
package modules
import (
"github.com/bettercap/bettercap/session"
)
func (s EventsStream) viewBLEEvent(e session.Event) {
}