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

models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 16 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 Artifact added in v0.1.1

type Artifact 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
	Source    string    // resource file
	//CA            string // ca file , ca file content
	Path        string
	Profile     Profile `gorm:"foreignKey:ProfileName;references:Name;"`
	Os          string
	Arch        string
	Log         string
	Status      string
	ParamsData  string
	Params      *types.ProfileParams `gorm:"-"`
	ProfileByte []byte
}

func (*Artifact) AfterFind added in v0.1.1

func (a *Artifact) AfterFind(tx *gorm.DB) (err error)

func (*Artifact) BeforeCreate added in v0.1.1

func (a *Artifact) BeforeCreate(tx *gorm.DB) (err error)

func (*Artifact) BeforeSave added in v0.1.1

func (a *Artifact) BeforeSave(tx *gorm.DB) error

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

func (*Artifact) ToProtobuf added in v0.1.1

func (a *Artifact) ToProtobuf(bin []byte) *clientpb.Artifact

type Certificate

type Certificate struct {
	ID        uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt time.Time `gorm:"->;<-:create;"`
	Name      string    `gorm:"unique"`
	Type      string    // 证书类型: selfsigned, letsencrypt, imported
	Domain    string    // 证书绑定域名
	CertPEM   string    // 证书内容 PEM
	KeyPEM    string    // 私钥内容 PEM
	CACertPEM string    // CA 证书内容 PEM
	CAKeyPEM  string    // CA 私钥内容 PEM
}

func (*Certificate) BeforeCreate

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

BeforeCreate - GORM hook 自动设置ID和创建时间

func (*Certificate) ToProtobuf added in v0.1.1

func (c *Certificate) ToProtobuf() *clientpb.TLS

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;"`
	CAType           int
	KeyType          string
	CaCertificatePEM string
	CertificatePEM   string
	PrivateKeyPEM    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"`
	CertName              string    `gorm:"type:string;"`
	*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

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

	// BasicPipeline 和 PulsePipeline
	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) 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