Help us shape the future of Go! Take the 2026 Go Developer Survey

models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 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 ToRegister added in v0.0.3

func ToRegister(context string) *implantpb.Register

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"`

	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"
	Source        string    // resource file
	ParamsJson    string
	CA            string // ca file , ca file content
	Path          string
	IsSRDI        bool
	ShellcodePath string
	Profile       Profile `gorm:"foreignKey:ProfileName;references:Name;"`
	Os            string
	Arch          string
	Log           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) ToArtifact added in v0.1.0

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

func (*Builder) ToProtobuf added in v0.0.3

func (b *Builder) ToProtobuf() *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 Context added in v0.1.0

type Context struct {
	ID         uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid"`
	CreatedAt  time.Time `gorm:"->;<-:create"`
	SessionID  string    `gorm:"type:string;index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	PipelineID string    `gorm:"type:string;index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	TaskID     string    `gorm:"type:string;index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	Type       string
	Nonce      string
	Value      []byte
	Context    output.Context `gorm:"-"`

	Session  *Session  `gorm:"foreignKey:SessionID;references:SessionID;"`
	Pipeline *Pipeline `gorm:"foreignKey:PipelineID;references:Name;"`
	Task     *Task     `gorm:"foreignKey:TaskID;references:ID;"`
}

func FromContextProtobuf added in v0.1.0

func FromContextProtobuf(ctx *clientpb.Context) (*Context, error)

func (*Context) AfterFind added in v0.1.0

func (c *Context) AfterFind(tx *gorm.DB) (err error)

func (*Context) BeforeCreate added in v0.1.0

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

func (*Context) ToProtobuf added in v0.1.0

func (c *Context) ToProtobuf() *clientpb.Context

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

func (*Operator) ToListener added in v0.1.0

func (o *Operator) ToListener() *clientpb.Listener

func (*Operator) ToProtobuf added in v0.1.0

func (o *Operator) ToProtobuf() *clientpb.Client

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"`
	IP                    string    `gorm:"type:string;default:''"`
	Host                  string    `config:"host"`
	Port                  uint32    `config:"port"`
	Type                  string    `gorm:"type:string;"`
	Enable                bool      `gorm:"type:boolean;"`
	ParamsData            string    `gorm:"column:params"`
	*types.PipelineParams `gorm:"-"`
}

Pipeline

func FromPipelinePb added in v0.0.3

func FromPipelinePb(pipeline *clientpb.Pipeline) *Pipeline

func (*Pipeline) Address added in v0.0.3

func (pipeline *Pipeline) Address() string

func (*Pipeline) AfterFind added in v0.1.0

func (pipeline *Pipeline) AfterFind(tx *gorm.DB) error

AfterFind GORM 钩子 - 查询后反序列化

func (*Pipeline) BeforeCreate added in v0.0.2

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

BeforeCreate - GORM hook

func (*Pipeline) BeforeSave added in v0.1.0

func (pipeline *Pipeline) BeforeSave(tx *gorm.DB) error

BeforeSave GORM 钩子 - 保存前将 Params 序列化

func (*Pipeline) ToProtobuf added in v0.1.0

func (pipeline *Pipeline) ToProtobuf() *clientpb.Pipeline

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

	// build type
	Type string

	// shellcode prelude beacon bind
	Stager string

	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:"-"`             // 使用 interface{} 使其更灵活
	ParamsData string               `gorm:"column:params"` // 改用更简洁的数据库字段名

	// BasicPipeline 和 PulsePipeline
	PipelineID      string `gorm:"type:string;index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	PulsePipelineID string `gorm:"type:string;index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`

	// BasicPipeline 和 PulsePipeline
	Pipeline      *Pipeline `gorm:"foreignKey:PipelineID;references:Name;"`
	PulsePipeline *Pipeline `gorm:"foreignKey:PulsePipelineID;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) BeforeSave added in v0.1.0

func (p *Profile) BeforeSave(tx *gorm.DB) error

BeforeSave GORM 钩子 - 保存前将 Params 序列化

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
	PipelineID  string
	ListenerID  string
	IsAlive     bool
	LastCheckin int64
	IsRemoved   bool                  `gorm:"default:false"`
	Data        *types.SessionContext `gorm:"-"`
	DataString  string                `gorm:"column:data"`
	ProfileName string                `gorm:"index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;foreignKey:ProfileName;references:Name"`
	Profile     Profile               `gorm:"foreignKey:ProfileName;references:Name;"`
}

func (*Session) AfterFind added in v0.1.0

func (s *Session) AfterFind(tx *gorm.DB) error

func (*Session) BeforeCreate

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

func (*Session) BeforeSave added in v0.1.0

func (s *Session) BeforeSave(tx *gorm.DB) 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;"`
	Created     time.Time `gorm:"->;<-:create;"`
	Deadline    time.Time
	CallBy      string
	Seq         uint32
	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 WebsiteContent added in v0.0.3

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

	File        string `gorm:""`
	Path        string `gorm:""`
	Size        uint64 `gorm:""`
	Type        string `gorm:""`
	ContentType string `gorm:""`

	Pipeline   *Pipeline `gorm:"foreignKey:PipelineID;references:Name;"`
	PipelineID string    `gorm:"type:string;index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

WebsiteContent - Single table that combines Website and WebContent

func FromWebContentPb added in v0.1.0

func FromWebContentPb(content *clientpb.WebContent) *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(read bool) *clientpb.WebContent

ToProtobuf - Converts to protobuf object

func (*WebsiteContent) URL added in v0.1.0

func (wc *WebsiteContent) URL() string

Jump to

Keyboard shortcuts

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