models

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromRegister added in v0.0.3

func FromRegister(register *implantpb.Register) string

FromRegister - convert session to context json string

func ToEncryptionProtobuf added in v0.0.3

func ToEncryptionProtobuf(encryption *EncryptionConfig) *clientpb.Encryption

func ToPipelinePB added in v0.0.3

func ToPipelinePB(pipeline Pipeline) *clientpb.Pipeline

func ToRegister added in v0.0.3

func ToRegister(context string) *implantpb.Register

func ToTlsProtobuf added in v0.0.2

func ToTlsProtobuf(tls *TlsConfig) *clientpb.TLS

Types

type Builder added in v0.0.3

type Builder struct {
	ID          uint32 `gorm:"primaryKey;autoIncrement"`
	Name        string `gorm:"unique"`
	ProfileName string `gorm:"index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;foreignKey:ProfileName;references:Name"` // 将 ProfileName 设置为外键

	CreatedAt  time.Time `gorm:"->;<-:create;"`
	Target     string    // build target, like win64, win32, linux64
	Type       string    // build type, pe, dll, shellcode
	Stager     string    // shellcode prelude beacon bind
	Modules    string    // default modules, comma split, e.g. "execute_exe,execute_dll"
	ParamsJson string
	CA         string // ca file , ca file content
	Path       string
	Profile    Profile `gorm:"foreignKey:ProfileName;references:Name;"`
	Os         string
	Arch       string
}

func (*Builder) BeforeCreate added in v0.0.3

func (b *Builder) BeforeCreate(tx *gorm.DB) (err error)

func (*Builder) FromProtobuf added in v0.0.3

func (b *Builder) FromProtobuf(pb *clientpb.Generate)

func (*Builder) ToProtobuf added in v0.0.3

func (b *Builder) ToProtobuf(bin []byte) *clientpb.Builder

type Certificate

type Certificate struct {
	ID             uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt      time.Time `gorm:"->;<-:create;"`
	CommonName     string
	CAType         int
	KeyType        string
	CertificatePEM string
	PrivateKeyPEM  string
}

Certificate - Certificate database model

func (*Certificate) BeforeCreate

func (c *Certificate) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook to automatically set values

type EncryptionConfig added in v0.0.2

type EncryptionConfig struct {
	Enable bool   `gorm:"column:enable"`
	Type   string `gorm:"column:type"`
	Key    string `gorm:"column:key"`
}

func ToEncryptionDB added in v0.0.3

func ToEncryptionDB(encryption *clientpb.Encryption) EncryptionConfig

type File added in v0.0.3

type File struct {
	ID          string    `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt   time.Time `gorm:"->;<-:create;"`
	Type        string
	SessionID   string
	Session     Session `gorm:"foreignKey:SessionID"`
	Cur         int
	Total       int
	Description string
}

func (*File) BeforeCreate added in v0.0.3

func (f *File) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook

func (*File) ToFileProtobuf added in v0.0.3

func (f *File) ToFileProtobuf() *clientpb.File

func (*File) ToProtobuf added in v0.0.3

func (f *File) ToProtobuf() *clientpb.Task

func (*File) UpdateCur added in v0.0.3

func (f *File) UpdateCur(db *gorm.DB, newCur int) error

type FileDescription

type FileDescription struct {
	Name     string `json:"name"`
	NickName string `json:"nick_name"`
	Path     string `json:"path"`
	Size     int64  `json:"size"`
	Command  string `json:"command"`
}

func (*FileDescription) ToJsonString added in v0.0.2

func (td *FileDescription) ToJsonString() (string, error)

type Operator

type Operator struct {
	ID        uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt time.Time `gorm:"->;<-:create;"`
	Name      string    `gorm:"uniqueIndex"`
	Remote    string    `gorm:"type:string;"`
	Type      string    `gorm:"type:string;"`
}

Operator - Colletions of content to serve from HTTP(S)

func (*Operator) BeforeCreate

func (o *Operator) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook

type Os

type Os struct {
	Name     string `gorm:"type:varchar(255)" json:"name"`
	Version  string `gorm:"type:varchar(255)" json:"version"`
	Arch     string `gorm:"type:varchar(255)" json:"arch"`
	Username string `gorm:"type:varchar(255)" json:"username"`
	Hostname string `gorm:"type:varchar(255)" json:"hostname"`
	Locale   string `gorm:"type:varchar(255)" json:"locale"`
}

func FromOsPb added in v0.0.3

func FromOsPb(os *implantpb.Os) *Os

type Pipeline added in v0.0.2

type Pipeline struct {
	ID         uuid.UUID        `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt  time.Time        `gorm:"->;<-:create;"`
	ListenerID string           `gorm:"type:string;"`
	Name       string           `gorm:"unique,type:string"`
	WebPath    string           `gorm:"type:string;default:''"`
	IP         string           `gorm:"type:string;default:''"`
	Host       string           `config:"host"`
	Port       uint16           `config:"port"`
	Type       string           `gorm:"type:string;"`
	Parser     string           `gorm:"type:string;"`
	Enable     bool             `gorm:"type:boolean;"`
	Tls        TlsConfig        `gorm:"embedded;embeddedPrefix:tls_"`
	Encryption EncryptionConfig `gorm:"embedded;embeddedPrefix:encryption_"`
}

Pipeline

func FromPipelinePb added in v0.0.3

func FromPipelinePb(pipeline *clientpb.Pipeline, ip string) *Pipeline

func (*Pipeline) Address added in v0.0.3

func (p *Pipeline) Address() string

func (*Pipeline) BeforeCreate added in v0.0.2

func (l *Pipeline) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook

type Process

type Process struct {
	Name  string `gorm:"type:varchar(255)" json:"name"`
	Pid   int32  `json:"pid"`
	Ppid  int32  `json:"ppid"`
	Owner string `gorm:"type:varchar(255)" json:"owner"`
	Arch  string `gorm:"type:varchar(255)" json:"arch"`
	Path  string `gorm:"type:varchar(255)" json:"path"`
	Args  string `gorm:"type:varchar(255)" json:"args"`
}

func FromProcessPb added in v0.0.3

func FromProcessPb(process *implantpb.Process) *Process

type Profile added in v0.0.3

type Profile struct {
	ID uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid;"`

	// build
	Name   string `gorm:"unique"` // Ensuring Name is unique
	Target string // build target win64,win32,linux64

	// build type
	Type string

	// shellcode prelude beacon bind
	Stager string

	Proxy     string // not impl
	Obfuscate string // not impl, obf llvm plug ,

	Modules string // default modules, comma split, e.g. "execute_exe,execute_dll"
	CA      string // ca file , ca file content
	Raw     []byte
	// params
	Params     *types.ProfileParams `gorm:"-"`         // Ignored by GORM
	ParamsJson string               `gorm:"type:text"` // Used for storing serialized params

	PipelineID string `gorm:"type:string;index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`

	Pipeline *Pipeline `gorm:"foreignKey:PipelineID;references:Name;"`

	CreatedAt time.Time `gorm:"->;<-:create;"`
	// contains filtered or unexported fields
}

func (*Profile) AfterFind added in v0.0.3

func (p *Profile) AfterFind(tx *gorm.DB) (err error)

func (*Profile) BeforeCreate added in v0.0.3

func (p *Profile) BeforeCreate(tx *gorm.DB) (err error)

func (*Profile) DeserializeImplantConfig added in v0.0.3

func (p *Profile) DeserializeImplantConfig() error

Deserialize implantConfig (JSON string) to a struct or map

func (*Profile) ToProtobuf added in v0.0.3

func (p *Profile) ToProtobuf() *clientpb.Profile

type Session

type Session struct {
	SessionID   string `gorm:"primaryKey;->;<-:create;type:uuid;"`
	RawID       uint32
	CreatedAt   time.Time `gorm:"->;<-:create;"`
	Note        string
	GroupName   string
	Target      string
	Initialized bool
	Type        string
	IsPrivilege bool
	PipelineID  string
	IsAlive     bool
	Context     string
	LastCheckin int64
	Interval    uint64
	Jitter      float64
	IsRemoved   bool     `gorm:"default:false"`
	Os          *Os      `gorm:"embedded"`
	Process     *Process `gorm:"embedded"`
}

func (*Session) BeforeCreate

func (s *Session) BeforeCreate(tx *gorm.DB) (err error)

func (*Session) ToProtobuf added in v0.0.3

func (s *Session) ToProtobuf() *clientpb.Session

type Task

type Task struct {
	ID          string    `gorm:"primaryKey;->;<-:create;type:uuid;"`
	Created     time.Time `gorm:"->;<-:create;"`
	Deadline    time.Time
	CallBy      string
	Seq         int
	Type        string
	SessionID   string
	Session     Session `gorm:"foreignKey:SessionID"`
	Cur         int
	Total       int
	Description string
	ClientName  string
}

func (*Task) BeforeCreate

func (t *Task) BeforeCreate(tx *gorm.DB) (err error)

func (*Task) ToProtobuf

func (t *Task) ToProtobuf() *clientpb.Task

func (*Task) UpdateCur

func (t *Task) UpdateCur(db *gorm.DB, newCur int) error

func (*Task) UpdateTotal added in v0.0.3

func (t *Task) UpdateTotal(db *gorm.DB, newTotal int) error

type Timer

type Timer struct {
	Interval uint64  `json:"interval"`
	Jitter   float64 `json:"jitter"`
}

func FromTimePb added in v0.0.3

func FromTimePb(timer *implantpb.Timer) *Timer

type TlsConfig added in v0.0.2

type TlsConfig struct {
	Enable bool   `gorm:"column:enable"`
	Cert   string `gorm:"column:cert"`
	Key    string `gorm:"column:key"`
}

func ToTlsDB added in v0.0.2

func ToTlsDB(tls *clientpb.TLS) TlsConfig

type WebsiteContent added in v0.0.3

type WebsiteContent struct {
	ID        uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt time.Time `gorm:"->;<-:create;"`

	Name        string `gorm:""`
	Path        string `gorm:""`
	Size        uint64 `gorm:""`
	ContentType string `gorm:""`
	Type        string `gorm:""`
	Parser      string `gorm:""`
}

WebsiteContent - Single table that combines Website and WebContent

func WebsiteContentFromProtobuf added in v0.0.3

func WebsiteContentFromProtobuf(pbWebContent *clientpb.WebContent) WebsiteContent

FromProtobuf - Converts from protobuf object to WebsiteContent

func (*WebsiteContent) BeforeCreate added in v0.0.3

func (wc *WebsiteContent) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook to automatically set values

func (*WebsiteContent) ToProtobuf added in v0.0.3

func (wc *WebsiteContent) ToProtobuf(webContentDir string) *clientpb.Website

ToProtobuf - Converts to protobuf object

Jump to

Keyboard shortcuts

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