Documentation
¶
Index ¶
- Variables
- func AESEncrypt(key, text []byte) (string, string, error)
- func Base64Encode(data []byte) string
- func ConfigLintCheck(config Config) (bool, []string)
- func GenerateDNSAKey(hostname string) (string, string, error)
- func GenerateDNSTXTKey(hostname string) (string, string, error)
- func GenerateHash(s []byte, hashType string) (string, error)
- func GenerateHttpKey(url string) (string, error)
- func GenerateSHA512(s []byte) string
- func GetCodeFiles(lang, section string) []string
- func GetKeyringDataPath()
- func GetLanguages() []string
- func PrintCodeFile(m string) string
- func ReadFile(path string) ([]byte, error)
- func StrInSlice(s string, l []string) bool
- func UpdateTemplate(code string, data interface{}) (string, error)
- func WriteFile(filename string, contents []byte)
- type Config
- type ConfigKeyer
- type FinalCodeTemplate
- type InputTemplate
- type Keyer
- type Language
Constants ¶
This section is empty.
Variables ¶
var KeyringDataPath string
Functions ¶
func AESEncrypt ¶
AESEncrypt https://golang.org/src/crypto/cipher/example_test.go Returns base64 encoded ciphertext and base64 encoded IV Not returning both (iv:ciphertext) as includes too much js/vbs to detach
func Base64Encode ¶
Base64Encode basic wrapper around base64 encoding
func ConfigLintCheck ¶
ConfigLintCheck validates the config file
func GenerateDNSAKey ¶
GenerateDNSAKey requests DNS A record, hashes the response and returns the DNS response and the sha512 hash Note: Only works with the first response and ignores multiple responses
func GenerateDNSTXTKey ¶
GenerateDNSTXTKey requests DNS A record, hashes the response and returns the DNS response and the sha512 hash Note: Only works with the first response and ignores multiple responses
func GenerateHash ¶
GenerateHash takes a string and hashType. Based on hashType calls the respected function or returns an error that the hashType isn't supported
func GenerateHttpKey ¶
GenerateHttpKey reaches out to url, hashes the body and returns the sha512 hash
func GenerateSHA512 ¶
GenerateSHA512 takes a string, generates a SHA512 hash and sends back as hex string
func GetCodeFiles ¶
GetCodeFiles gets all xml files under the specified code section directory
func GetKeyringDataPath ¶
func GetKeyringDataPath()
GetKeyringDataPath finds out where keyring is running and where the ./data directory is
func GetLanguages ¶
func GetLanguages() []string
GetLanguages returns all the langs based on directories in ./data
func PrintCodeFile ¶
PrintCodeFile shows the module path in a nicer format
func StrInSlice ¶
StrInSlice checks if a string exists in a slice. No convenient "in" with Go https://stackoverflow.com/questions/15323767/does-go-have-if-x-in-construct-similar-to-python
func UpdateTemplate ¶
UpdateTemplate replaces placeholders within code files with structs
Types ¶
type Config ¶
type Config struct { Language string `yaml:"language"` PayloadFile string `yaml:"payloadFile"` OutputFile string `yaml:"outputFile"` Keyers []ConfigKeyer `yaml:"keyers"` Retries string `yaml:"retries"` Sleep string `yaml:"sleep"` BaseCode string `yaml:"baseCode"` // Used for C# payloads AssemblyType string `yaml:"assemblyType"` AssemblyMethod string `yaml:"assemblyMethod"` }
Config holds the settings chosen by the user
func ParseConfigFile ¶
ParseConfigFile reads a provided config file and sets up the Config struct
type ConfigKeyer ¶
type ConfigKeyer struct { Name string `yaml:"name"` Inputs []string `yaml:"inputs"` Output string `yaml:"keydata"` }
Keyer options provided within a config file
type FinalCodeTemplate ¶
type FinalCodeTemplate struct { Functions string Callers string EncryptedBase64 string PayloadHash string AESIVBase64 string MinusBytes string Retries string Sleep string // Used for C# payloads AssemblyType string AssemblyMethod string }
FinalCodeTemplate holds the placeholders within the BaseCode of a language Updating these values results in the final code
type InputTemplate ¶
type InputTemplate struct {
Input []string
}
InputTemplate holds the Inputs so it can be sent to UpdateTemplate()
type Keyer ¶
type Keyer struct { Name string Title string `xml:"title"` Description string `xml:"description"` Type string `xml:"type"` InputNum int `xml:"inputnum"` InputHelp string `xml:"inputhelp"` Function string `xml:"function"` Caller string `xml:"caller"` }
Keyer stores information related to each keyer:
Name: name of the keyer Description: brief description of the keyer Type: the type of keyer: combo or chain InputNum: number of inputs that need to be provided from user Function: primary function that will be called to return something to use as a part of the decryption key Caller: additional code that will call the function and append to the relevant array to eventually build the decryption key
func ParseKeyer ¶
ParseKeyer takes a given language and keyer name, appends '.xml' then calls ParseKeyerFile
func ParseKeyerFile ¶
ParseKeyerFile takes a given language and keyer filename, then returns the Keyer struct
type Language ¶
type Language struct { Name string `xml:"name"` Extension string `xml:"extension"` BaseCode string `xml:"baseCode"` }
Language object stores basic info for each language This data will come from the lang.xml file in the root directory of the language's directory
func ParseLanguage ¶
ParseLanguage takes a given language, finds the filename and returns the Language struct