Skip to content

Commit

Permalink
Check for PSK
Browse files Browse the repository at this point in the history
  • Loading branch information
Ne0nd0g committed Sep 5, 2024
1 parent 9014fbc commit 6d0c66c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions clients/mythic/mythic.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,14 @@ func New(config Config) (*Client, error) {
return &client, err
}

// Get the HTTP client
/*
client.Client, err = getClient(client.Protocol, client.Proxy, client.JA3, client.Parrot, client.insecureTLS)
// Set PSK
if config.PSK != "" {
client.psk, err = base64.StdEncoding.DecodeString(config.PSK)
if err != nil {
return &client, err
return &client, fmt.Errorf("there was an error Base64 decoding the PSK:\n%s", err)
}
*/

// Set PSK
client.psk, err = base64.StdEncoding.DecodeString(config.PSK)
if err != nil {
return &client, fmt.Errorf("there was an error Base64 decoding the PSK:\n%s", err)
client.secret = client.psk
}
client.secret = client.psk

// Set up the Authenticator
switch strings.ToLower(config.AuthPackage) {
Expand All @@ -186,6 +180,10 @@ func New(config Config) (*Client, error) {
var t transformer.Transformer
switch strings.ToLower(transform) {
case "aes":
// Ensure there is a key
if config.PSK == "" || len(client.psk) <= 0 {
return nil, fmt.Errorf("AES transformer requires a PSK to be set")
}
t = aes2.NewEncrypter()
case "base64-byte":
t = b64.NewEncoder(b64.BYTE)
Expand Down

0 comments on commit 6d0c66c

Please sign in to comment.