83 lines
1.7 KiB
Go
83 lines
1.7 KiB
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"protomolecule/src/dust"
|
|
"protomolecule/src/scanStuff"
|
|
|
|
"github.com/fatih/color"
|
|
"tinygo.org/x/bluetooth"
|
|
)
|
|
|
|
var adapter = bluetooth.DefaultAdapter
|
|
var target = flag.String("t", "00:00:00:00:00:00", "Target device to attack")
|
|
var attacker bluetooth.Addresser
|
|
var connected bool
|
|
var disconnected bool = true
|
|
|
|
/*
|
|
func ohai() {
|
|
|
|
target = bluetooth.Address{00:00:00:00:00}
|
|
attacker = bluetooth.Addresser{"00:00:00"}
|
|
adapter.Connect()
|
|
}
|
|
*/
|
|
|
|
func main() {
|
|
values := flag.Args()
|
|
|
|
scanStuff.Scanners()
|
|
|
|
color.Red("Searching for: ")
|
|
for _, word := range values {
|
|
fmt.Print(word)
|
|
}
|
|
|
|
/*
|
|
err := adapter.Enable()
|
|
if err != nil {
|
|
println("BLE stack unstable, could not enable", err.Error())
|
|
return
|
|
}
|
|
|
|
*/
|
|
//var foundDevice bluetooth.ScanResult
|
|
|
|
//turn the stuff on
|
|
dust.Must("BLE stack", adapter.Enable())
|
|
|
|
println("Scanning")
|
|
err := adapter.Scan(func(adapter *bluetooth.Adapter, result bluetooth.ScanResult) {
|
|
|
|
if result.Address.String() == *target {
|
|
|
|
color.Cyan("found device:", result.Address.String(), result.RSSI, result.LocalName())
|
|
}
|
|
/*
|
|
if err != nil {
|
|
println("could not enable the stack", err.Error())
|
|
return
|
|
}
|
|
*/
|
|
})
|
|
dust.Must("scanns n stuff", err)
|
|
|
|
/*
|
|
connectToStuff := func(addr bluetooth.Addresser, device *bluetooth.Device) {
|
|
d, _ := adapter.Connect(addr, bluetooth.ConnectionParams{}, err ==
|
|
*device == d)
|
|
color.Red("Trying a connection", addr)
|
|
}
|
|
*/
|
|
|
|
/*
|
|
println("scanss")
|
|
err := adapter.Scan(func(adapter *bluetooth.Adapter, device bluetooth.ScanResult) {
|
|
color.Cyan("found device:", device.Address.String(), device.RSSI, device.LocalName())
|
|
})
|
|
must("start scan", err)
|
|
*/
|
|
}
|