added CLI flag for loading JSON manufacturer data

This commit is contained in:
kayos 2021-05-30 20:16:03 -07:00
parent e294599c16
commit 711804afeb
4 changed files with 13 additions and 8 deletions

12
main.go

@ -15,6 +15,7 @@ import (
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )
// ScanMgr will keep track of concurrently running scans
var ScanMgr *scanStuff.Meta var ScanMgr *scanStuff.Meta
func listen() { func listen() {
@ -31,6 +32,10 @@ func listen() {
if *projVars.TFlag { if *projVars.TFlag {
projVars.TrackingMode = true projVars.TrackingMode = true
} }
if *projVars.MFlag != "0" {
projVars.ManuFile = *projVars.MFlag
}
} }
func obey() { func obey() {
@ -53,7 +58,6 @@ func init() {
dust.PrintBanner() dust.PrintBanner()
ScanMgr = &scanStuff.Meta{ ScanMgr = &scanStuff.Meta{
Count: 0, Count: 0,
Scans: make(map[int]*scanStuff.Scan), Scans: make(map[int]*scanStuff.Scan),
@ -91,8 +95,12 @@ func init() {
// see ./src/eros // see ./src/eros
log.Debug().Msg("Initializing database engine") log.Debug().Msg("Initializing database engine")
eros.Awaken() eros.Awaken()
eros.ManufLoad()
if *projVars.MFlag != "0" {
eros.ManufLoad()
}
} }
func main() { func main() {

File diff suppressed because one or more lines are too long

@ -34,10 +34,9 @@ var (
// serviceDb will hold definitions of various bluetook services and will ultimately be updated via an HTTP repository // serviceDb will hold definitions of various bluetook services and will ultimately be updated via an HTTP repository
serviceDb *bitcask.Bitcask serviceDb *bitcask.Bitcask
err error err error
Manufacturers ManufData Manufacturers ManufData
// DataDir - should be defined by config or cmd flag // DataDir - should be defined by config or cmd flag
DataDir string = "./.eros-data/" DataDir string = "./.eros-data/"
) )
@ -114,11 +113,10 @@ type Payload struct {
// placeholder // placeholder
} }
// Ingest UUID will add the UUID to the manufacturer if it doesn't already exist // Ingest UUID will add the UUID to the manufacturer if it doesn't already exist
func (manuf *Manufacturer) IngestUUID(uuid bluetooth.UUID) bool { func (manuf *Manufacturer) IngestUUID(uuid bluetooth.UUID) bool {
contains := func (s []bluetooth.UUID, v bluetooth.UUID) bool { contains := func(s []bluetooth.UUID, v bluetooth.UUID) bool {
for _, a := range s { for _, a := range s {
if a == v { if a == v {
return true return true

@ -44,6 +44,7 @@ var AttackAdapter = bluetooth.DefaultAdapter
var DFlag = flag.Bool("d", false, "global debug logging and pretty printing") var DFlag = flag.Bool("d", false, "global debug logging and pretty printing")
var AFlag = flag.Bool("a", false, "attack mode") var AFlag = flag.Bool("a", false, "attack mode")
var TFlag = flag.Bool("t", false, "device tracking mode") var TFlag = flag.Bool("t", false, "device tracking mode")
var MFlag = flag.String("m", "0", "json file with manufacturer identifying data to preload into eros")
//flag.Parse() //flag.Parse()