configs

package
v1.15.16 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: GPL-3.0 Imports: 15 Imported by: 9

README

Configs

Small wrapper around the configs directory

Documentation

Index

Constants

View Source
const (
	// Sqlite - SQLite protocol
	Sqlite = "sqlite3"
	// Postgres - Postgresql protocol
	Postgres = "postgresql"
	// MySQL - MySQL protocol
	MySQL = "mysql"
)

Variables

View Source
var (
	ErrMissingCookies             = errors.New("server config must specify at least one cookie")
	ErrMissingStagerFileExt       = errors.New("implant config must specify a stager_file_ext")
	ErrMissingPollFileExt         = errors.New("implant config must specify a poll_file_ext")
	ErrTooFewPollFiles            = errors.New("implant config must specify at least one poll_files value")
	ErrMissingKeyExchangeFileExt  = errors.New("implant config must specify a key_exchange_file_ext")
	ErrTooFewKeyExchangeFiles     = errors.New("implant config must specify at least one key_exchange_files value")
	ErrMissingCloseFileExt        = errors.New("implant config must specify a close_file_ext")
	ErrTooFewCloseFiles           = errors.New("implant config must specify at least one close_files value")
	ErrMissingStartSessionFileExt = errors.New("implant config must specify a start_session_file_ext")
	ErrMissingSessionFileExt      = errors.New("implant config must specify a session_file_ext")
	ErrTooFewSessionFiles         = errors.New("implant config must specify at least one session_files value")
	ErrNonuniqueFileExt           = errors.New("implant config must specify unique file extensions")
	ErrQueryParamNameLen          = errors.New("implant config url query parameter names must be 3 or more characters")
)
View Source
var (
	// ErrInvalidDialect - An invalid dialect was specified
	ErrInvalidDialect = errors.New("invalid SQL Dialect")
)

Functions

func CheckHTTPC2ConfigErrors added in v1.5.4

func CheckHTTPC2ConfigErrors() error

CheckHTTPC2ConfigErrors - Get the current HTTP C2 config

func GetDatabaseConfigPath

func GetDatabaseConfigPath() string

GetDatabaseConfigPath - File path to config.json

func GetHTTPC2ConfigPath added in v1.5.0

func GetHTTPC2ConfigPath() string

GetHTTPC2ConfigPath - File path to http-c2.json

func GetServerConfigPath

func GetServerConfigPath() string

GetServerConfigPath - File path to config.json

Types

type DNSJobConfig

type DNSJobConfig struct {
	Domains    []string `json:"domains"`
	Canaries   bool     `json:"canaries"`
	Host       string   `json:"host"`
	Port       uint16   `json:"port"`
	JobID      string   `json:"job_id"`
	EnforceOTP bool     `json:"enforce_otp"`
}

DNSJobConfig - Persistent DNS job config

type DaemonConfig

type DaemonConfig struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

DaemonConfig - Configure daemon mode

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

func (c *DatabaseConfig) Save() error

Save - Save config file to disk

type HTTPC2Config added in v1.5.0

type HTTPC2Config struct {
	ImplantConfig *HTTPC2ImplantConfig `json:"implant_config"`
	ServerConfig  *HTTPC2ServerConfig  `json:"server_config"`
}

HTTPC2Config - Parent config file struct for implant/server

func GetHTTPC2Config added in v1.5.0

func GetHTTPC2Config() *HTTPC2Config

GetHTTPC2Config - Get the current HTTP C2 config

func (*HTTPC2Config) ChromeVer added in v1.5.0

func (h *HTTPC2Config) ChromeVer() string

ChromeVer - Generate a random Chrome user-agent

func (*HTTPC2Config) GenerateUserAgent added in v1.5.0

func (h *HTTPC2Config) GenerateUserAgent(goos string, goarch string) string

GenerateUserAgent - Generate a user-agent depending on OS/Arch

func (*HTTPC2Config) RandomImplantConfig added in v1.5.0

func (h *HTTPC2Config) RandomImplantConfig() *HTTPC2ImplantConfig

RandomImplantConfig - Randomly generate a config

type HTTPC2ImplantConfig added in v1.5.0

type HTTPC2ImplantConfig struct {
	UserAgent string `json:"user_agent"`

	URLParameters []NameValueProbability `json:"url_parameters"`
	Headers       []NameValueProbability `json:"headers"`

	MaxFiles int `json:"max_files"`
	MinFiles int `json:"min_files"`
	MaxPaths int `json:"max_paths"`
	MinPaths int `json:"min_paths"`

	// Stager File Extension
	StagerFileExt string `json:"stager_file_ext"`

	// Poll files and paths
	PollFileExt string   `json:"poll_file_ext"`
	PollFiles   []string `json:"poll_files"`
	PollPaths   []string `json:"poll_paths"`

	// Session files and paths
	StartSessionFileExt string   `json:"start_session_file_ext"`
	SessionFileExt      string   `json:"session_file_ext"`
	SessionFiles        []string `json:"session_files"`
	SessionPaths        []string `json:"session_paths"`

	// Close session files and paths
	CloseFileExt string   `json:"close_file_ext"`
	CloseFiles   []string `json:"close_files"`
	ClosePaths   []string `json:"close_paths"`
}

HTTPC2ImplantConfig - Implant configuration options Procedural C2 =============== .txt = rsakey .css = start .php = session

.js = poll

.png = stop .woff = sliver shellcode

func (*HTTPC2ImplantConfig) RandomCloseFiles added in v1.5.0

func (h *HTTPC2ImplantConfig) RandomCloseFiles() []string

func (*HTTPC2ImplantConfig) RandomClosePaths added in v1.5.0

func (h *HTTPC2ImplantConfig) RandomClosePaths() []string

func (*HTTPC2ImplantConfig) RandomPollFiles added in v1.5.0

func (h *HTTPC2ImplantConfig) RandomPollFiles() []string

func (*HTTPC2ImplantConfig) RandomPollPaths added in v1.5.0

func (h *HTTPC2ImplantConfig) RandomPollPaths() []string

func (*HTTPC2ImplantConfig) RandomSessionFiles added in v1.5.0

func (h *HTTPC2ImplantConfig) RandomSessionFiles() []string

func (*HTTPC2ImplantConfig) RandomSessionPaths added in v1.5.0

func (h *HTTPC2ImplantConfig) RandomSessionPaths() []string

type HTTPC2ServerConfig added in v1.5.0

type HTTPC2ServerConfig struct {
	RandomVersionHeaders bool                   `json:"random_version_headers"`
	Headers              []NameValueProbability `json:"headers"`
	Cookies              []string               `json:"cookies"`
}

HTTPC2ServerConfig - Server configuration options

type HTTPJobConfig

type HTTPJobConfig struct {
	Domain          string `json:"domain"`
	Host            string `json:"host"`
	Port            uint16 `json:"port"`
	Secure          bool   `json:"secure"`
	Website         string `json:"website"`
	Cert            []byte `json:"cert"`
	Key             []byte `json:"key"`
	ACME            bool   `json:"acme"`
	JobID           string `json:"job_id"`
	EnforceOTP      bool   `json:"enforce_otp"`
	LongPollTimeout int64  `json:"long_poll_timeout"`
	LongPollJitter  int64  `json:"long_poll_jitter"`
}

HTTPJobConfig - Persistent HTTP job config

type JobConfig

type JobConfig struct {
	Multiplayer []*MultiplayerJobConfig `json:"multiplayer"`
	MTLS        []*MTLSJobConfig        `json:"mtls,omitempty"`
	WG          []*WGJobConfig          `json:"wg,omitempty"`
	DNS         []*DNSJobConfig         `json:"dns,omitempty"`
	HTTP        []*HTTPJobConfig        `json:"http,omitempty"`
}

JobConfig - Restart Jobs on Load

type LogConfig

type LogConfig struct {
	Level              int  `json:"level"`
	GRPCUnaryPayloads  bool `json:"grpc_unary_payloads"`
	GRPCStreamPayloads bool `json:"grpc_stream_payloads"`
}

LogConfig - Server logging config

type MTLSJobConfig

type MTLSJobConfig struct {
	Host  string `json:"host"`
	Port  uint16 `json:"port"`
	JobID string `json:"job_id"`
}

MTLSJobConfig - Per-type job configs

type MultiplayerJobConfig added in v1.5.0

type MultiplayerJobConfig struct {
	Host  string `json:"host"`
	Port  uint16 `json:"port"`
	JobID string `json:"job_id"`
}

type NameValueProbability added in v1.5.4

type NameValueProbability struct {
	Name        string `json:"name"`
	Value       string `json:"value"`
	Probability int    `json:"probability"`
}

type ServerConfig

type ServerConfig struct {
	DaemonMode   bool              `json:"daemon_mode"`
	DaemonConfig *DaemonConfig     `json:"daemon"`
	Logs         *LogConfig        `json:"logs"`
	Jobs         *JobConfig        `json:"jobs,omitempty"`
	Watchtower   *WatchTowerConfig `json:"watch_tower"`
	GoProxy      string            `json:"go_proxy"`
}

ServerConfig - Server config

func GetServerConfig

func GetServerConfig() *ServerConfig

GetServerConfig - Get config value

func (*ServerConfig) AddDNSJob

func (c *ServerConfig) AddDNSJob(config *DNSJobConfig) error

AddDNSJob - Add a persistent DNS job

func (*ServerConfig) AddHTTPJob

func (c *ServerConfig) AddHTTPJob(config *HTTPJobConfig) error

AddHTTPJob - Add a persistent job

func (*ServerConfig) AddMTLSJob

func (c *ServerConfig) AddMTLSJob(config *MTLSJobConfig) error

AddMTLSJob - Add Job Configs

func (*ServerConfig) AddMultiplayerJob added in v1.5.0

func (c *ServerConfig) AddMultiplayerJob(config *MultiplayerJobConfig) error

AddMultiplayerJob - Add Job Configs

func (*ServerConfig) AddWGJob added in v1.4.9

func (c *ServerConfig) AddWGJob(config *WGJobConfig) error

AddWGJob - Add Job Configs

func (*ServerConfig) RemoveJob

func (c *ServerConfig) RemoveJob(jobID string)

RemoveJob - Remove Job by ID

func (*ServerConfig) Save

func (c *ServerConfig) Save() error

Save - Save config file to disk

type WGJobConfig added in v1.4.9

type WGJobConfig struct {
	Port    uint16 `json:"port"`
	NPort   uint16 `json:"nport"`
	KeyPort uint16 `json:"key_port"`
	JobID   string `json:"job_id"`
}

WGJobConfig - Per-type job configs

type WatchTowerConfig added in v1.4.17

type WatchTowerConfig struct {
	VTApiKey          string `json:"vt_api_key"`
	XForceApiKey      string `json:"xforce_api_key"`
	XForceApiPassword string `json:"xforce_api_password"`
}

WatchTowerConfig - Watch Tower job config

Jump to

Keyboard shortcuts

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