Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cna-rest-core

Tiny Aggressor Script REST/JSON helper library for Cobalt Strike CNA modules.

What It Provides

  • Generic HTTP/HTTPS requests through __makeAPIRequest().
  • JSON serialization with sleep_to_json().
  • JSON parsing with json_to_sleep(), Json2Sleep(), and Sleep2Json().
  • Response helpers such as __response_is_success_status() and __response_set_last_error().
  • File-download detection through the isFileDownload response field.

Response Contract

__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.

Usage

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"]);

Scope

This library is API-agnostic. It does not include Cobalt Strike REST authentication, local config loading or other feature-module logic.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors