mocking up exploit database stuff in eros
This commit is contained in:
parent
e93da869c3
commit
8c7ef6a4d7
1
go.mod
1
go.mod
@ -10,6 +10,7 @@ require (
|
||||
github.com/prologic/bitcask v0.3.10
|
||||
github.com/rs/zerolog v1.21.0
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08 // indirect
|
||||
golang.org/x/sys v0.0.0-20210414055047-fe65e336abe0 // indirect
|
||||
tinygo.org/x/bluetooth v0.3.0
|
||||
)
|
||||
|
8
go.sum
8
go.sum
@ -241,6 +241,7 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
|
||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||
golang.org/x/exp v0.0.0-20200228211341-fcea875c7e85 h1:jqhIzSw5SQNkbu5hOGpgMHhkfXxrbsLJdkIRcX19gCY=
|
||||
@ -256,10 +257,14 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08 h1:h+GZ3ubjuWaQjGe8owMGcmMVCqs0xYJtRG5y2bpHaqU=
|
||||
golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@ -340,12 +345,15 @@ golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtn
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200925191224-5d1fdd8fa346/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
|
||||
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
|
@ -14,29 +14,70 @@ import (
|
||||
//projVars "protomolecule/src/vars"
|
||||
)
|
||||
|
||||
var db *bitcask.Bitcask
|
||||
// deviceDb will hold details about devices discovered
|
||||
var deviceDb *bitcask.Bitcask
|
||||
|
||||
// attackDb will hold details about exploits to be used against BLE devices
|
||||
var attackDb *bitcask.Bitcask
|
||||
|
||||
var err error
|
||||
|
||||
// DataDir - should be defined by config
|
||||
var DataDir string = "./.eros-data"
|
||||
|
||||
// Details - to be marshalled into json before stored in bitcask
|
||||
type Details struct {
|
||||
LocalName string
|
||||
Advertisement []byte
|
||||
Services []string
|
||||
}
|
||||
// DataDir - should be defined by config or cmd flag
|
||||
var DataDir string = "./.eros-data/"
|
||||
|
||||
// Device - we use this to nest the populated Details struct associated with the MAC
|
||||
type Device struct {
|
||||
MAC string
|
||||
Info Details
|
||||
|
||||
// Category potentially used for browsing devices or finding exploits
|
||||
//// Category string
|
||||
|
||||
}
|
||||
|
||||
// Details - BLE device details to be marshalled into json before stored in bitcask
|
||||
type Details struct {
|
||||
LocalName string
|
||||
Advertisement []byte
|
||||
Services []Service
|
||||
}
|
||||
|
||||
// Service - BLE service details to be marshalled into json before stored in bitcask
|
||||
type Service struct {
|
||||
Name string
|
||||
UUID string
|
||||
Category string
|
||||
}
|
||||
|
||||
// Exploit - BLE service exploit details to be marshalled into json before stored in bitcask
|
||||
type Exploit struct {
|
||||
Name string
|
||||
Target string
|
||||
Category string
|
||||
Vector Vector
|
||||
Payload Payload
|
||||
}
|
||||
|
||||
// Vector - TBD details of how an exploit initially attacks a BLE service
|
||||
type Vector struct {
|
||||
// placeholder
|
||||
}
|
||||
|
||||
// Payload - TBD details of what an exploit will do to the device after the initial attack
|
||||
type Payload struct {
|
||||
// placeholder
|
||||
}
|
||||
|
||||
// Awaken - create the data directory if it does not exist; initialize bitcask in this directory
|
||||
func Awaken() {
|
||||
//log.Debug().Str("DataDir",DataDir).Msg("Initializing eros...")
|
||||
db, err = bitcask.Open(DataDir)
|
||||
|
||||
deviceDb, err = bitcask.Open(DataDir + "devices")
|
||||
if err != nil {
|
||||
panic(err.Error)
|
||||
}
|
||||
|
||||
attackDb, err = bitcask.Open(DataDir + "exploits")
|
||||
if err != nil {
|
||||
panic(err.Error)
|
||||
}
|
||||
@ -63,7 +104,7 @@ func Remember(mac string, name string, adv []byte /*, services []string*/) error
|
||||
return err
|
||||
}
|
||||
|
||||
err = db.Put([]byte(mac), jsonData)
|
||||
err = deviceDb.Put([]byte(mac), jsonData)
|
||||
|
||||
return err
|
||||
}
|
||||
@ -74,7 +115,7 @@ func Recall(mac string) (Device, error) {
|
||||
var bytes []byte
|
||||
var member Device
|
||||
|
||||
bytes, err = db.Get([]byte(mac))
|
||||
bytes, err = deviceDb.Get([]byte(mac))
|
||||
if err != nil {
|
||||
return member, err
|
||||
}
|
||||
@ -82,3 +123,18 @@ func Recall(mac string) (Device, error) {
|
||||
json.Unmarshal(bytes, &member)
|
||||
return member, err
|
||||
}
|
||||
|
||||
// Hypnosis - retrieve new exploits/attacks from a remote http repository
|
||||
func Hypnosis(repo string) {
|
||||
// placeholder
|
||||
}
|
||||
|
||||
// Trauma - store details of an exploit/attack against BLE devices
|
||||
func Trauma(name string, targ string, cat string, vec Vector, pay Payload) {
|
||||
// placeholder
|
||||
}
|
||||
|
||||
// Flashback - retrieve details for the named exploit/attack
|
||||
func Flashback(name string) {
|
||||
//placeholder
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user