db

package
v1.5.38 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: GPL-3.0 Imports: 12 Imported by: 21

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 added in v1.5.0

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

BeaconByID - Select a Beacon by ID

func BeaconTaskByEnvelopeID added in v1.5.0

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

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

func BeaconTaskByID added in v1.5.0

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

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

func BeaconTasksByBeaconID added in v1.5.0

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 added in v1.5.0

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

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

func DeleteKeyValue added in v1.5.0

func DeleteKeyValue(key string, value string) error

DeleteKeyValue - Delete a key/value pair

func GetKeyValue added in v1.5.0

func GetKeyValue(key string) (string, error)

GetKeyValue - Get a value from a key

func HostByHostID added in v1.5.0

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

HostByHostID - Get host by the session's reported HostUUID

func HostByHostUUID added in v1.5.0

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

HostByHostUUID - Get host by the session's reported HostUUID

func IOCByID added in v1.5.0

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 added in v1.5.0

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

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

func ImplantConfigByID added in v1.5.0

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

ImplantConfigByID - Fetch implant build by name

func ImplantConfigWithC2sByID added in v1.5.30

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 added in v1.5.0

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 added in v1.5.0

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

ListHosts - List of all hosts in the database

func OperatorAll added in v1.5.0

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

OperatorAll - Select all operators from the database

func OperatorByToken added in v1.5.0

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

OperatorByToken - Select an operator by token value

func PendingBeaconTasksByBeaconID added in v1.5.0

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 added in v1.5.5

func RenameBeacon(id string, name string) error

RenameBeacon - Rename a beacon

func Session

func Session() *gorm.DB

Session - Database session

func SetKeyValue added in v1.5.0

func SetKeyValue(key string, value string) error

SetKeyValue - Set the value for a key/value pair

func UpdateBeaconCheckinByID added in v1.5.0

func UpdateBeaconCheckinByID(id string, next int64) error

UpdateBeaconCheckinByID - Update the beacon's last / next checkin

func WGPeerIPs added in v1.4.9

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