text stringlengths 0 1.47k |
|---|
} |
} |
BeaconPrintf(CALLBACK_OUTPUT, "[i]\n"); |
} |
static void print_bof_session_context(void) { |
int i; |
int j; |
int printed = 0; |
int group_count = 0; |
typedef struct { |
const char *tool; |
int count; |
long long largest; |
int printed; |
} session_group_t; |
session_group_t groups[32]; |
inline_memset(groups, 0, sizeof(groups)); |
BeaconPrintf(CALLBACK_OUTPUT, "[i] Session activity (collect selectively)\n"); |
for (i = 0; i < g_bof_triage_target_count; i++) { |
const bof_triage_target_t *target = &g_bof_triage_targets[i]; |
int index = -1; |
if (!target_is_session_context(target)) { |
continue; |
} |
for (j = 0; j < group_count; j++) { |
if (target_tool_is(target, groups[j].tool)) { |
index = j; |
break; |
} |
} |
if (index < 0) { |
if (group_count >= 32) { |
continue; |
} |
index = group_count++; |
groups[index].tool = target->tool; |
} |
groups[index].count++; |
if (target->size_bytes > groups[index].largest) { |
groups[index].largest = target->size_bytes; |
} |
} |
while (printed < group_count) { |
int best = -1; |
for (i = 0; i < group_count; i++) { |
if (groups[i].printed) { |
continue; |
} |
if (best < 0 || groups[i].count > groups[best].count || |
(groups[i].count == groups[best].count && groups[i].largest > groups[best].largest)) { |
best = i; |
} |
} |
if (best < 0) { |
break; |
} |
{ |
int tool_slot = session_tool_slot(groups[best].tool); |
int session_artifacts = tool_slot >= 0 ? g_session_artifact_counts[tool_slot] : 0; |
BeaconPrintf(CALLBACK_OUTPUT, "[i] [3] %s history/session locations x%d | %d session artifact%s%s\n", groups[best].tool, groups[best].count, |
session_artifacts, session_artifacts == 1 ? "" : "s", g_session_scan_partial ? " (partial scan)" : ""); |
} |
for (i = 0; i < g_bof_triage_target_count; i++) { |
const bof_triage_target_t *target = &g_bof_triage_targets[i]; |
if (!target_is_session_context(target) || !target_tool_is(target, groups[best].tool)) { |
continue; |
} |
BeaconPrintf(CALLBACK_OUTPUT, "[i] %S\n", target->path); |
} |
groups[best].printed = 1; |
printed++; |
} |
if (!printed) { |
BeaconPrintf(CALLBACK_OUTPUT, "[i] none\n"); |
} |
BeaconPrintf(CALLBACK_OUTPUT, "[i]\n"); |
} |
static void print_bof_top_session_files(void) { |
int i; |
int rank = 0; |
BeaconPrintf(CALLBACK_OUTPUT, "[i] PRIORITIZED SESSION ARTIFACTS (newest first)%s\n", g_session_scan_partial ? " (partial scan)" : ""); |
if (g_top_session_count == 0) BeaconPrintf(CALLBACK_OUTPUT, "[i] none\n"); |
for (i = 0; i < BOF_TOP_SESSION_COUNT; i++) { |
const bof_session_candidate_t *target = &g_top_sessions[i]; |
SYSTEMTIME utc; |
char size[32]; |
if (!target->tool) continue; |
rank = (i % BOF_TOP_SESSIONS_PER_TOOL) + 1; |
if (target->size_bytes < 1024) BeaconPrintf(CALLBACK_OUTPUT, "[+] [%d] %s | %lld B", rank, target->tool, target->size_bytes); |
else if (target->size_bytes < 1024 * 1024) BeaconPrintf(CALLBACK_OUTPUT, "[+] [%d] %s | %lld.%lld KB", rank, target->tool, target->size_bytes / 1024, ((target->size_bytes % 1024) * 10) / 1024); |
else BeaconPrintf(CALLBACK_OUTPUT, "[+] [%d] %s | %lld.%lld MB", rank, target->tool, target->size_bytes / (1024 * 1024), ((target->size_bytes % (1024 * 1024)) * 10) / (1024 * 1024)); |
inline_memset(&utc, 0, sizeof(utc)); |
if (KERNEL32$FileTimeToSystemTime(&target->last_write_time, &utc)) BeaconPrintf(CALLBACK_OUTPUT, " | modified %04d-%02d-%02d", utc.wYear, utc.wMonth, utc.wDay); |
BeaconPrintf(CALLBACK_OUTPUT, "\n %S\n", target->path); |
} |
BeaconPrintf(CALLBACK_OUTPUT, "[i]\n"); |
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.