db

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPlayerNotFound = errors.New("player not found")
)

Functions

func Create

func Create(v interface{}) error

func Delete

func Delete(v interface{}) error

func DeleteOne

func DeleteOne(v interface{}) error

func Find

func Find(v interface{}) error

func FindConditional

func FindConditional(query, target, v interface{}) error

FindConditional retrieves rows based on one specific condition

func FindOneConditional

func FindOneConditional(query, target, v interface{}) error

FindOneConditional works like FindConditional but returns the first instance

func GetIDByUsername

func GetIDByUsername(user string) (string, error)

func Initialize

func Initialize() string

Initialize database

func Where

func Where(query interface{}, target ...interface{}) *gorm.DB

Types

type Agent

type Agent struct {
	AgentID   string `gorm:"primaryKey"`
	Name      string
	Version   string
	OS        string
	Arch      string
	Host      string
	Port      string
	Builder   string // The builder used to build the agent
	File      string // binary file associated with agent
	CreatedBy string // TODO:use this field for notifications and whatnot
	CreatedAt time.Time
	AgentInfo string
}

type Builder

type Builder struct {
	// A UUID that identifies an agent
	BuilderID   string `gorm:"primaryKey"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Name        string `gorm:"unique"` // This is technically the agent name and is used as so
	Version     string
	Author      string
	Url         string
	SupportedOS string // Array of comma-separated operating systems
	// The path that the agent files are installed at
	InstalledAt string
	// ImageID and ContainerID identify the image / container used to build implants
	ImageID     string
	ContainerID string
}

type Player

type Player struct {
	UUID      string `gorm:"primaryKey"`
	Username  string `gorm:"unique"`
	ClientCA  string // base64 representation of client certificate for mTLS
	Challenge string
	Secret    string
	Role      roles.Role
	CreatedAt time.Time
}

type Profile

type Profile struct {
	ID        uint `gorm:"primaryKey"`
	UpdatedAt time.Time
	CreatedAt time.Time
	Name      string `gorm:"unique"`
	BuilderID string
	CreatedBy string
}

Profile is used to save build configurations

type ProfileRecord

type ProfileRecord struct {
	ID        uint `gorm:"primaryKey"`
	UpdatedAt time.Time
	CreatedAt time.Time
	Profile   string
	Name      string
	Value     string
}

ProfileRecord is one build configuration, and is bound to a profile in the profiles table

Jump to

Keyboard shortcuts

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