db

package
v1.5.34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

README

DB

GORM-based database interactions.

Contents:
  • gosqlite/ - A fork of the GORM sqlite driver that uses a pure go sqlite3 implementation. This can be compiled using the Go build tag gosqlite
  • models/ - The database/GORM models
  • db.go - Primary abstraction for client and db sessions
  • helpers.go - Helper functions for querying the GORM models
  • logger.go - Database logger
  • sql_cgo.go - The CGO sqlite client
  • sql_go.go - The pure Go sqlite client
  • sql.go - Database setup and configuration

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client = newDBClient()

Client - Database Client

View Source
var (
	// ErrRecordNotFound - Record not found error
	ErrRecordNotFound = gorm.ErrRecordNotFound
)

Functions

func BeaconByID

func BeaconByID(id string) (*models.Beacon, error)

BeaconByID - Select a Beacon by ID

func BeaconTaskByEnvelopeID

func BeaconTaskByEnvelopeID(beaconID string, envelopeID int64) (*models.BeaconTask, error)

BeaconTasksByEnvelopeID - Select a (sent) BeaconTask by its envelope ID

func BeaconTaskByID

func BeaconTaskByID(id string) (*models.BeaconTask, error)

BeaconTaskByID - Select a specific BeaconTask by ID, this will fetch the full request/response

func BeaconTasksByBeaconID

func BeaconTasksByBeaconID(beaconID string) ([]*models.BeaconTask, error)

BeaconTasksByBeaconID - Get all tasks for a specific beacon by default will not fetch the request/response columns since these could be arbitrarily large.

func CanaryByDomain

func CanaryByDomain(domain string) (*models.DNSCanary, error)

CanaryByDomain - Check if a canary exists

func CountTasksByBeaconID

func CountTasksByBeaconID(beaconID uuid.UUID) (int64, int64, error)

CountTasksByBeaconID - Select a (sent) BeaconTask by its envelope ID

func DeleteKeyValue

func DeleteKeyValue(key string, value string) error

DeleteKeyValue - Delete a key/value pair

func GetKeyValue

func GetKeyValue(key string) (string, error)

GetKeyValue - Get a value from a key

func HostByHostID

func HostByHostID(id uuid.UUID) (*models.Host, error)

HostByHostID - Get host by the session's reported HostUUID

func HostByHostUUID

func HostByHostUUID(id string) (*models.Host, error)

HostByHostUUID - Get host by the session's reported HostUUID

func IOCByID

func IOCByID(id string) (*models.IOC, error)

IOCByID - Select an IOC by ID

func ImplantBuildByName

func ImplantBuildByName(name string) (*models.ImplantBuild, error)

ImplantBuildByName - Fetch implant build by name

func ImplantBuildNames

func ImplantBuildNames() ([]string, error)

ImplantBuildNames - Fetch a list of all build names

func ImplantBuilds

func ImplantBuilds() ([]*models.ImplantBuild, error)

ImplantBuilds - Return all implant builds

func ImplantConfigByECCPublicKeyDigest

func ImplantConfigByECCPublicKeyDigest(publicKeyDigest [32]byte) (*models.ImplantConfig, error)

ImplantConfigByECCPublicKey - Fetch implant build by it's ecc public key

func ImplantConfigByID

func ImplantConfigByID(id string) (*models.ImplantConfig, error)

ImplantConfigByID - Fetch implant build by name

func ImplantConfigWithC2sByID

func ImplantConfigWithC2sByID(id string) (*models.ImplantConfig, error)

ImplantConfigWithC2sByID - Fetch implant build by name

func ImplantProfileByName

func ImplantProfileByName(name string) (*models.ImplantProfile, error)

ImplantProfileByName - Fetch implant build by name

func ImplantProfileNames

func ImplantProfileNames() ([]string, error)

ImplantProfileNames - Fetch a list of all build names

func ImplantProfiles

func ImplantProfiles() ([]*models.ImplantProfile, error)

ImplantProfiles - Fetch a map of name<->profiles current in the database

func ListBeacons

func ListBeacons() ([]*models.Beacon, error)

ListBeacons - Select a Beacon by ID

func ListCanaries

func ListCanaries() ([]*models.DNSCanary, error)

ListCanaries - List of all embedded canaries

func ListHosts

func ListHosts() ([]*models.Host, error)

ListHosts - List of all hosts in the database

func OperatorAll

func OperatorAll() ([]*models.Operator, error)

OperatorAll - Select all operators from the database

func OperatorByToken

func OperatorByToken(value string) (*models.Operator, error)

OperatorByToken - Select an operator by token value

func PendingBeaconTasksByBeaconID

func PendingBeaconTasksByBeaconID(id string) ([]*models.BeaconTask, error)

PendingBeaconTasksByBeaconID - Select a Beacon by ID, ordered by creation time

func ProfileByName

func ProfileByName(name string) (*models.ImplantProfile, error)

ProfileByName - Fetch a single profile from the database

func RenameBeacon

func RenameBeacon(id string, name string) error

RenameBeacon - Rename a beacon

func Session

func Session() *gorm.DB

Session - Database session

func SetKeyValue

func SetKeyValue(key string, value string) error

SetKeyValue - Set the value for a key/value pair

func UpdateBeaconCheckinByID

func UpdateBeaconCheckinByID(id string, next int64) error

UpdateBeaconCheckinByID - Update the beacon's last / next checkin

func WGPeerIPs

func WGPeerIPs() ([]string, error)

WGPeerIPs - Fetch a list of ips for all wireguard peers

func WebsiteByName

func WebsiteByName(name string) (*models.Website, error)

WebsiteByName - Get website by name

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL