generate

package
v0.0.6-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: GPL-3.0 Imports: 29 Imported by: 0

README

Generate

The generate package is responsible for generating Sliver binaries such as executables and shared libraries.

Documentation

Index

Constants

View Source
const (
	// WINDOWS OS
	WINDOWS = "windows"

	// DARWIN / MacOS
	DARWIN = "darwin"

	// LINUX OS
	LINUX = "linux"

	// DefaultReconnectInterval - In seconds
	DefaultReconnectInterval = 60
	// DefaultMTLSLPort - Default listen port
	DefaultMTLSLPort = 8888
	// DefaultHTTPLPort - Default HTTP listen port
	DefaultHTTPLPort = 443 // Assume SSL, it'll fallback

	// SliverCC64EnvVar - Environment variable that can specify the 64 bit mingw path
	SliverCC64EnvVar = "SLIVER_CC_64"
	// SliverCC32EnvVar - Environment variable that can specify the 32 bit mingw path
	SliverCC32EnvVar = "SLIVER_CC_32"
)
View Source
const (
	// CanaryBucketName - DNS Canary bucket name
	CanaryBucketName = "canaries"
)

Variables

View Source
var (

	// ErrSliverNotFound - More descriptive 'key not found' error
	ErrSliverNotFound = errors.New("Sliver not found")
)

Functions

func GetCodename

func GetCodename() string

GetCodename - Returns a randomly generated 'codename'

func GetSliversDir

func GetSliversDir() string

GetSliversDir - Get the binary directory

func ProfileSave

func ProfileSave(name string, config *SliverConfig) error

ProfileSave - Save a sliver profile to disk

func Profiles

func Profiles() map[string]*SliverConfig

Profiles - Fetch a map of name<->profiles current in the database

func ShellcodeRDI

func ShellcodeRDI(dllPath string, functionName string) (shellcode []byte, err error)

ShellcodeRDI generates a reflective shellcode based on a DLL file

func ShellcodeRDIToFile

func ShellcodeRDIToFile(dllPath string, functionName string) (shellcodePath string, err error)

ShellcodeRDIToFile generates a sRDI shellcode and writes it to a file

func SliverConfigMap

func SliverConfigMap() (map[string]*SliverConfig, error)

SliverConfigMap - Get a sliver's config by it's codename

func SliverConfigSave

func SliverConfigSave(config *SliverConfig) error

SliverConfigSave - Save a configuration to the database

func SliverEgg

func SliverEgg(config SliverConfig) (string, error)

SliverEgg - Generates a sliver egg (stager) binary

func SliverExecutable

func SliverExecutable(config *SliverConfig) (string, error)

SliverExecutable - Generates a sliver executable binary

func SliverFileByName

func SliverFileByName(name string) ([]byte, error)

SliverFileByName - Saves a binary file into the database

func SliverFileSave

func SliverFileSave(name, fpath string) error

SliverFileSave - Saves a binary file into the database

func SliverFiles

func SliverFiles() ([]string, error)

SliverFiles - List all sliver files

func SliverSharedLibrary

func SliverSharedLibrary(config *SliverConfig) (string, error)

SliverSharedLibrary - Generates a sliver shared library (DLL/dylib/so) binary

func UpdateCanary

func UpdateCanary(canary *DNSCanary) error

UpdateCanary - Update an existing canary

Types

type CanaryGenerator

type CanaryGenerator struct {
	SliverName    string
	ParentDomains []string
}

CanaryGenerator - Holds data related to canary generation

func (*CanaryGenerator) GenerateCanary

func (g *CanaryGenerator) GenerateCanary() string

GenerateCanary - Generate a canary domain and save it to the db

currently this gets called by template engine

type DNSCanary

type DNSCanary struct {
	SliverName    string `json:"sliver_name"`
	Domain        string `json:"domain"`
	Triggered     bool   `json:"triggered"`
	FirstTrigger  string `json:"first_trigger"`
	LatestTrigger string `json:"latest_trigger"`
	Count         int    `json:"count"`
}

DNSCanary - DNS canary

func CheckCanary

func CheckCanary(domain string) (*DNSCanary, error)

CheckCanary - Check if a canary exists

func ListCanaries

func ListCanaries() ([]*DNSCanary, error)

ListCanaries - List of all embedded canaries

func (*DNSCanary) ToProtobuf

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

ToProtobuf - Return a protobuf version of the struct

type SliverC2

type SliverC2 struct {
	Priority uint32 `json:"priority"`
	URL      string `json:"url"`
	Options  string `json:"options"`
}

SliverC2 - C2 struct

func (SliverC2) String

func (s SliverC2) String() string

func (SliverC2) ToProtobuf

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

ToProtobuf - Convert to protobuf version

type SliverConfig

type SliverConfig struct {
	// Go
	GOOS   string `json:"go_os"`
	GOARCH string `json:"go_arch"`

	// Standard
	Name                string `json:"name"`
	CACert              string `json:"ca_cert"`
	Cert                string `json:"cert"`
	Key                 string `json:"key"`
	Debug               bool   `json:"debug"`
	ObfuscateSymbols    bool   `json:"obfuscate_symbols"`
	ReconnectInterval   int    `json:"reconnect_interval"`
	MaxConnectionErrors int    `json:"max_connection_errors"`

	C2            []SliverC2 `json:"c2s"`
	MTLSc2Enabled bool       `json:"c2_mtls_enabled"`
	HTTPc2Enabled bool       `json:"c2_http_enabled"`
	DNSc2Enabled  bool       `json:"c2_dns_enabled"`
	CanaryDomains []string   `json:"canary_domains"`

	// Limits
	LimitDomainJoined bool   `json:"limit_domainjoined"`
	LimitHostname     string `json:"limit_hostname"`
	LimitUsername     string `json:"limit_username"`
	LimitDatetime     string `json:"limit_datetime"`

	// Output Format
	Format clientpb.SliverConfig_OutputFormat `json:"format"`

	// For 	IsSharedLib bool `json:"is_shared_lib"`
	IsSharedLib bool `json:"is_shared_lib"`

	FileName string
}

SliverConfig - Parameters when generating a implant

func ProfileByName

func ProfileByName(name string) (*SliverConfig, error)

ProfileByName - Fetch a single profile from the database

func SliverConfigByName

func SliverConfigByName(name string) (*SliverConfig, error)

SliverConfigByName - Get a sliver's config by it's codename

func SliverConfigFromProtobuf

func SliverConfigFromProtobuf(pbConfig *clientpb.SliverConfig) *SliverConfig

SliverConfigFromProtobuf - Create a native config struct from Protobuf

func (*SliverConfig) ToProtobuf

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

ToProtobuf - Convert SliverConfig to protobuf equiv

Jump to

Keyboard shortcuts

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