Skip to content

Instantly share code, notes, and snippets.

@vestjoe
Last active December 13, 2021 13:50
Show Gist options
  • Save vestjoe/0c94cf95894059984ebc41546718f535 to your computer and use it in GitHub Desktop.
Save vestjoe/0c94cf95894059984ebc41546718f535 to your computer and use it in GitHub Desktop.

Aggressor Scripting Notes

Read data from the C2 profile

# Read the intial sleep time set in the c2 profile
$profile = data_query("metadata")["c2profile"];
$initialsleep = [$profile getString: ".sleeptime"];
$initialjitter = [$profile getString: ".jitter"];

generate random printable text of length $length


{
#generate random printable text of length $length
local('$length $out $charstr $i $index');
    $length = $1;
    $charstr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890!@#$%^&*(),.<>;:';
    $out = '';
    for($i = 0; $i < $length; $i++)
    {
        $index = rand(strlen($charstr));
        $out = $out . substr($charstr, $index, $index + 1);
    }
    return $out;
}
sub rand_alnum
{

generate random printable text of length $length

#generate random printable text of length $length
local('$length $out $charstr $i $index');
    $length = $1;
    $charstr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890';
    $out = '';
    for($i = 0; $i < $length; $i++)
    {
        $index = rand(strlen($charstr));
        $out = $out . substr($charstr, $index, $index + 1);
    }
    return $out;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment