Documentation
¶
Index ¶
- Constants
- Variables
- func GetCertDir() string
- func GetRandomID() string
- func GetWorkDir() string
- func InitConfig() error
- func JoinStringSlice(slice []string) string
- func LoadMiscConfig() ([]byte, []byte, error)
- func NewDebugLog(filename string) *logs.Logger
- func NewFileLog(filename string) *logs.Logger
- type BindPipelineConfig
- type CertConfig
- type DatabaseConfig
- type EncryptionConfig
- type HttpPipelineConfig
- type ListenerConfig
- type LogConfig
- type MiscConfig
- type NotifyConfig
- type ServerConfig
- type TcpPipelineConfig
- type TlsConfig
- type WebContent
- type WebsiteConfig
Constants ¶
View Source
const ( // Sqlite - SQLite protocol Sqlite = "sqlite3" // Postgres - Postgresql protocol Postgres = "postgresql" // MySQL - MySQL protocol MySQL = "mysql" )
Variables ¶
View Source
var ( ServerConfigFileName = "config.yaml" ServerRootPath = path.Join(GetWorkDir(), ".malice") CurrentServerConfigFilename = "config.yaml" LogPath = path.Join(ServerRootPath, "logs") CertsPath = path.Join(ServerRootPath, "certs") ListenerPath = path.Join(ServerRootPath, "listener") TempPath = path.Join(ServerRootPath, "temp") PluginPath = path.Join(ServerRootPath, "plugins") AuditPath = path.Join(ServerRootPath, "audit") CachePath = path.Join(TempPath, "cache") ErrNoConfig = errors.New("no config found") WebsitePath = path.Join(ServerRootPath, "web") // variables for implant build BuildPath = path.Join(GetWorkDir(), "..", "malefic", "build") BinPath = path.Join(BuildPath, "bin") SourceCodePath = path.Join(BuildPath, "src") TargetPath = path.Join(SourceCodePath, "target") CargoCachePath = path.Join(BuildPath, "cache") BuildOutputPath = path.Join(SourceCodePath, "output") )
View Source
var ( // ErrInvalidDialect - An invalid dialect was specified ErrInvalidDialect = errors.New("invalid SQL Dialect") )
View Source
var ListenerConfigFileName = "listener.yaml"
Functions ¶
func GetCertDir ¶ added in v0.0.3
func GetCertDir() string
func GetRandomID ¶ added in v0.0.3
func GetRandomID() string
func GetWorkDir ¶ added in v0.0.3
func GetWorkDir() string
func InitConfig ¶
func InitConfig() error
func JoinStringSlice ¶ added in v0.0.3
JoinStringSlice Helper function to join string slices
func LoadMiscConfig ¶
func NewDebugLog ¶
func NewFileLog ¶
Types ¶
type BindPipelineConfig ¶ added in v0.0.3
type BindPipelineConfig struct {
Enable bool `config:"enable" default:"true"`
Name string `config:"name" default:"bind"`
TlsConfig *TlsConfig `config:"tls"`
EncryptionConfig *EncryptionConfig `config:"encryption"`
}
func (*BindPipelineConfig) ToProtobuf ¶ added in v0.0.3
func (pipeline *BindPipelineConfig) ToProtobuf(lisId string) (*clientpb.Pipeline, error)
type CertConfig ¶ added in v0.0.3
type CertConfig struct {
Cert string `yaml:"cert"`
CA string `yaml:"ca"`
Key string `yaml:"key"`
Enable bool `yaml:"enable"`
}
func (*CertConfig) ToProtobuf ¶ added in v0.0.3
func (t *CertConfig) ToProtobuf() *clientpb.TLS
type DatabaseConfig ¶
type DatabaseConfig struct {
Dialect string `json:"dialect"`
Database string `json:"database"`
Username string `json:"username"`
Password string `json:"password"`
Host string `json:"host"`
Port uint16 `json:"port"`
Params map[string]string `json:"params"`
MaxIdleConns int `json:"max_idle_conns"`
MaxOpenConns int `json:"max_open_conns"`
LogLevel string `json:"log_level"`
}
DatabaseConfig - Server config
func GetDatabaseConfig ¶
func GetDatabaseConfig() *DatabaseConfig
GetDatabaseConfig - Get config value
func (*DatabaseConfig) DSN ¶
func (c *DatabaseConfig) DSN() (string, error)
DSN - Get the db connections string https://github.com/go-sql-driver/mysql#examples
func (*DatabaseConfig) Save ¶ added in v0.0.2
func (c *DatabaseConfig) Save() error
Save - Save config file to disk
type EncryptionConfig ¶
type EncryptionConfig struct {
Enable bool `config:"enable"`
Type string `config:"type"`
Key string `config:"key"`
}
func (*EncryptionConfig) NewCrypto ¶ added in v0.0.3
func (e *EncryptionConfig) NewCrypto() (cryptostream.Cryptor, error)
func (*EncryptionConfig) ToProtobuf ¶ added in v0.0.3
func (e *EncryptionConfig) ToProtobuf() *clientpb.Encryption
type HttpPipelineConfig ¶
type ListenerConfig ¶
type ListenerConfig struct {
Enable bool `config:"enable" default:"true"`
Name string `config:"name" default:"listener"`
Auth string `config:"auth" default:"listener.auth"`
TcpPipelines []*TcpPipelineConfig `config:"tcp" `
BindPipelineConfig []*BindPipelineConfig `config:"bind"`
//HttpPipelines []*HttpPipelineConfig `config:"http" default:""`
Websites []*WebsiteConfig `config:"websites"`
}
func GetListenerConfig ¶
func GetListenerConfig() *ListenerConfig
type LogConfig ¶
type LogConfig struct {
Level int `json:"level" default:"20" config:"level"`
}
LogConfig - Server logging config
type MiscConfig ¶
type NotifyConfig ¶ added in v0.0.2
type NotifyConfig struct {
Enable bool `config:"enable" default:"true"`
Telegram struct {
Enable bool `config:"enable" default:"false"`
APIKey string `config:"api_key"`
ChatID int64 `config:"chat_id"`
} `config:"telegram"`
DingTalk struct {
Enable bool `config:"enable" default:"false"`
Secret string `config:"secret"`
Token string `config:"token"`
} `config:"dingtalk"`
Lark struct {
Enable bool `config:"enable" default:"false"`
WebHookUrl string `config:"webhook_url"`
} `config:"lark"`
ServerChan struct {
Enable bool `config:"enable" default:"false"`
URL string `config:"url"`
} `config:"serverchan"`
}
type ServerConfig ¶
type ServerConfig struct {
Enable bool `config:"enable" default:"true"`
GRPCPort uint16 `config:"grpc_port" default:"5004"`
GRPCHost string `config:"grpc_host" default:"0.0.0.0"`
IP string `config:"ip" default:""`
DaemonConfig bool `config:"daemon" default:"false"`
LogConfig *LogConfig `config:"log"`
MiscConfig *MiscConfig `config:"config"`
NotifyConfig *NotifyConfig `config:"notify"`
}
func GetServerConfig ¶
func GetServerConfig() *ServerConfig
func (*ServerConfig) Address ¶
func (c *ServerConfig) Address() string
func (*ServerConfig) Save ¶
func (c *ServerConfig) Save() error
type TcpPipelineConfig ¶
type TcpPipelineConfig struct {
Enable bool `config:"enable" default:"true"`
Name string `config:"name" default:"tcp"`
Host string `config:"host" default:"0.0.0.0"`
Port uint16 `config:"port" default:"5001"`
Parser string `config:"parser" default:"malefic"`
TlsConfig *TlsConfig `config:"tls"`
EncryptionConfig *EncryptionConfig `config:"encryption"`
}
func (*TcpPipelineConfig) ToProtobuf ¶ added in v0.0.3
func (tcp *TcpPipelineConfig) ToProtobuf(lisId string) (*clientpb.Pipeline, error)
type TlsConfig ¶
type TlsConfig struct {
Enable bool `config:"enable"`
Name string `config:"name"`
CN string `config:"CN"`
O string `config:"O"`
C string `config:"C"`
L string `config:"L"`
OU string `config:"OU"`
ST string `config:"ST"`
Validity string `config:"validity"`
CertFile string `config:"cert_file"`
KeyFile string `config:"key_file"`
CAFile string `config:"ca_file"`
}
func GenerateTlsConfig ¶ added in v0.0.2
func (*TlsConfig) ReadCert ¶ added in v0.0.3
func (t *TlsConfig) ReadCert() (*CertConfig, error)
type WebContent ¶ added in v0.0.3
type WebsiteConfig ¶
type WebsiteConfig struct {
Enable bool `config:"enable" default:"false"`
RootPath string `config:"root" default:"."`
WebsiteName string `config:"name" default:"web"`
Port uint16 `config:"port" default:"443"`
WebContents []*WebContent `config:"content" default:""`
TlsConfig *TlsConfig `config:"tls" `
}
Click to show internal directories.
Click to hide internal directories.