Tiny Aggressor Script REST/JSON helper library for Cobalt Strike CNA modules.
- Generic HTTP/HTTPS requests through
__makeAPIRequest(). - JSON serialization with
sleep_to_json(). - JSON parsing with
json_to_sleep(),Json2Sleep(), andSleep2Json(). - Response helpers such as
__response_is_success_status()and__response_set_last_error(). - File-download detection through the
isFileDownloadresponse field.
__makeAPIRequest() returns a Sleep hash with:
%(
status => 200,
headers => %(),
content => "",
isFileDownload => 0,
error => ""
)status => 0 means the request failed before a usable HTTP response was received.
include(script_resource("lib/cna-rest-core/cna_rest_core.cna"));
$response = json_to_sleep(__makeAPIRequest(
"https://api.example.local/v1/status",
%(
method => "GET",
headers => %(Accept => "application/json"),
body => $null,
skipVerify => 0
)
));
println("Status: " . $response["status"]);
println("Content: " . $response["content"]);This library is API-agnostic. It does not include Cobalt Strike REST authentication, local config loading or other feature-module logic.