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"
)
// ScanMgr will keep track of concurrently running scans
var ScanMgr *scanStuff.Meta
func listen() {
@ -31,6 +32,10 @@ func listen() {
if *projVars.TFlag {
projVars.TrackingMode = true
}
if *projVars.MFlag != "0" {
projVars.ManuFile = *projVars.MFlag
}
}
func obey() {
@ -53,7 +58,6 @@ func init() {
dust.PrintBanner()
ScanMgr = &scanStuff.Meta{
Count: 0,
Scans: make(map[int]*scanStuff.Scan),
@ -91,8 +95,12 @@ func init() {
// see ./src/eros
log.Debug().Msg("Initializing database engine")
eros.Awaken()
eros.ManufLoad()
if *projVars.MFlag != "0" {
eros.ManufLoad()
}
}
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 *bitcask.Bitcask
err error
err error
Manufacturers ManufData
// DataDir - should be defined by config or cmd flag
DataDir string = "./.eros-data/"
)
@ -114,11 +113,10 @@ type Payload struct {
// placeholder
}
// Ingest UUID will add the UUID to the manufacturer if it doesn't already exist
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 {
if a == v {
return true

@ -44,6 +44,7 @@ var AttackAdapter = bluetooth.DefaultAdapter
var DFlag = flag.Bool("d", false, "global debug logging and pretty printing")
var AFlag = flag.Bool("a", false, "attack 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()