generate

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: 37 Imported by: 6

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
	// DefaultPollInterval - In seconds
	DefaultPollInterval = 1

	// DefaultSuffix - Indicates a platform independent src file
	DefaultSuffix = "_default.go"

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

	// SliverCXX64EnvVar - Environment variable that can specify the 64 bit mingw path
	SliverCXX64EnvVar = "SLIVER_CXX_64"
	// SliverCXX32EnvVar - Environment variable that can specify the 32 bit mingw path
	SliverCXX32EnvVar = "SLIVER_CXX_32"

	// SliverPlatformCC64EnvVar - Environment variable that can specify the 64 bit mingw path
	SliverPlatformCC64EnvVar = "SLIVER_%s_CC_64"
	// SliverPlatformCC32EnvVar - Environment variable that can specify the 32 bit mingw path
	SliverPlatformCC32EnvVar = "SLIVER_%s_CC_32"
	// SliverPlatformCXX64EnvVar - Environment variable that can specify the 64 bit mingw path
	SliverPlatformCXX64EnvVar = "SLIVER_%s_CXX_64"
	// SliverPlatformCXX32EnvVar - Environment variable that can specify the 32 bit mingw path
	SliverPlatformCXX32EnvVar = "SLIVER_%s_CXX_32"
)
View Source
const (
	// CanaryBucketName - DNS Canary bucket name
	CanaryBucketName = "canaries"
)

Variables

View Source
var (

	// ErrImplantBuildFileNotFound - More descriptive 'key not found' error
	ErrImplantBuildFileNotFound = errors.New("implant build file not found")
)
View Source
var (

	// SupportedCompilerTargets - Supported compiler targets
	SupportedCompilerTargets = map[string]bool{
		"darwin/amd64":  true,
		"darwin/arm64":  true,
		"linux/386":     true,
		"linux/amd64":   true,
		"windows/386":   true,
		"windows/amd64": true,
	}
)

Functions

func DonutFromAssembly added in v1.4.2

func DonutFromAssembly(assembly []byte, isDLL bool, arch string, params string, method string, className string, appDomain string) ([]byte, error)

DonutFromAssembly - Generate a donut shellcode from a .NET assembly

func DonutShellcodeFromFile added in v1.4.2

func DonutShellcodeFromFile(filePath string, arch string, dotnet bool, params string, className string, method string) (data []byte, err error)

DonutShellcodeFromFile returns a Donut shellcode for the given PE file

func DonutShellcodeFromPE added in v1.4.2

func DonutShellcodeFromPE(pe []byte, arch string, dotnet bool, params string, className string, method string, isDLL bool) (data []byte, err error)

DonutShellcodeFromPE returns a Donut shellcode for the given PE file

func GenerateUniqueIP added in v1.4.9

func GenerateUniqueIP() (net.IP, error)

GenerateUniqueIP generates and returns an available IP which can then be assigned to a Wireguard interface

func GetCodename

func GetCodename() (string, error)

GetCodename - Returns a randomly generated 'codename'

func GetCompilerTargets added in v1.4.18

func GetCompilerTargets() []*clientpb.CompilerTarget

GetCompilerTargets - This function attempts to determine what we can reasonably target

func GetCrossCompilers added in v1.4.18

func GetCrossCompilers() []*clientpb.CrossCompiler

GetCrossCompilers - Get information about the server's cross-compiler configuration

func GetSliversDir

func GetSliversDir() string

GetSliversDir - Get the binary directory

func GetUnsupportedTargets added in v1.4.18

func GetUnsupportedTargets() []*clientpb.CompilerTarget

GetUnsupportedTargets - Get compiler targets that are not "supported" on this platform

func ImplantBuildSave

func ImplantBuildSave(name string, config *models.ImplantConfig, fPath string) error

ImplantBuildSave - Saves a binary file into the database

func ImplantConfigFromProtobuf

func ImplantConfigFromProtobuf(pbConfig *clientpb.ImplantConfig) (string, *models.ImplantConfig)

ImplantConfigFromProtobuf - Create a native config struct from Protobuf

func ImplantConfigSave added in v1.5.0

func ImplantConfigSave(config *models.ImplantConfig) error

ImplantConfigSave - Save only the config to the database

func ImplantFileDelete added in v1.2.0

func ImplantFileDelete(build *models.ImplantBuild) error

ImplantFileDelete - Delete the implant from the file system

func ImplantFileFromBuild

func ImplantFileFromBuild(build *models.ImplantBuild) ([]byte, error)

ImplantFileFromBuild - Saves a binary file into the database

func SaveImplantProfile

func SaveImplantProfile(name string, config *models.ImplantConfig) error

SaveImplantProfile - Save a sliver profile to disk

func ShellcodeRDI

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

ShellcodeRDI generates a reflective shellcode based on a DLL file

func ShellcodeRDIFromBytes

func ShellcodeRDIFromBytes(data []byte, functionName string, arguments string) (shellcode []byte, err error)

ShellcodeRDIFromBytes generate a sRDI from a byte array

func ShellcodeRDIToFile

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

ShellcodeRDIToFile generates a sRDI shellcode and writes it to a file

func SliverExecutable

func SliverExecutable(name string, config *models.ImplantConfig) (string, error)

SliverExecutable - Generates a sliver executable binary

func SliverSharedLibrary

func SliverSharedLibrary(name string, config *models.ImplantConfig) (string, error)

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

func SliverShellcode

func SliverShellcode(name string, config *models.ImplantConfig) (string, error)

SliverShellcode - Generates a sliver shellcode using Donut

func UpdateCanary

func UpdateCanary(canary *models.DNSCanary) error

UpdateCanary - Update an existing canary

Types

type CanaryGenerator

type CanaryGenerator struct {
	ImplantName   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

Jump to

Keyboard shortcuts

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