2023-08-15 14:02:17 +02:00
|
|
|
#include <iostream>
|
|
|
|
#include <Windows.h>
|
|
|
|
#include <string>
|
2023-09-15 22:25:02 +02:00
|
|
|
#include <WDBGEXTS.H>
|
2023-08-15 14:02:17 +02:00
|
|
|
|
|
|
|
#include "common.h"
|
2023-08-16 11:28:46 +02:00
|
|
|
|
2023-08-17 10:45:50 +02:00
|
|
|
#include "threadpool.h"
|
2023-08-22 19:32:25 +02:00
|
|
|
#include "client.h"
|
2023-08-15 14:02:17 +02:00
|
|
|
|
2023-08-17 10:45:50 +02:00
|
|
|
#include "../user/um/umanager.h"
|
|
|
|
#include "../user/km/kmanager.h"
|
|
|
|
|
|
|
|
DWORD WINAPI Init(HINSTANCE hinstDLL)
|
2023-08-16 11:28:46 +02:00
|
|
|
{
|
2023-10-06 07:47:01 +02:00
|
|
|
AllocConsole();
|
|
|
|
FILE* file;
|
|
|
|
freopen_s(&file, "CONOUT$", "w", stdout);
|
|
|
|
freopen_s(&file, "CONIN$", "r", stdin);
|
2023-08-17 10:45:50 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
2023-08-17 10:45:50 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
LPTSTR pipe_name = (LPTSTR)L"\\\\.\\pipe\\DonnaACPipe";
|
|
|
|
LPCWSTR driver_name = L"\\\\.\\DonnaAC";
|
2023-08-18 07:33:13 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
std::shared_ptr<global::ThreadPool> thread_pool = std::make_shared<global::ThreadPool>(4);
|
|
|
|
std::shared_ptr<global::Client> client_interface = std::make_shared<global::Client>(thread_pool, pipe_name);
|
2023-08-17 10:45:50 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
usermode::UManager umanager(thread_pool, client_interface);
|
|
|
|
kernelmode::KManager kmanager(driver_name, thread_pool, client_interface);
|
2023-09-07 19:49:36 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
global::headers::SYSTEM_INFORMATION system_information;
|
|
|
|
kmanager.SendClientHardwareInformation();
|
2023-08-19 04:52:57 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
global::report_structures::SYSTEM_INFORMATION_REQUEST_RESPONSE response;
|
2023-09-10 12:20:35 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
//client_interface->ServerReceive( &response, sizeof( response ) );
|
2023-09-10 12:20:35 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
//std::cout << "RequestID: " << response.RequestId << " CanUserProceed: " <<
|
|
|
|
// response.CanUserProceed << " Reason: " << response.reason << std::endl;
|
2023-09-10 12:20:35 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
srand(time(NULL));
|
2023-09-24 05:10:13 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
while (!GetAsyncKeyState(VK_DELETE))
|
2023-09-28 15:56:07 +02:00
|
|
|
{
|
2023-10-06 10:30:14 +02:00
|
|
|
int seed = (rand() % 10);
|
2023-10-06 07:47:01 +02:00
|
|
|
|
|
|
|
std::cout << "Seed: " << seed << std::endl;
|
|
|
|
|
2023-10-09 09:34:30 +02:00
|
|
|
//switch (seed)
|
|
|
|
//{
|
|
|
|
//case 0:
|
|
|
|
// kmanager.EnumerateHandleTables();
|
|
|
|
// break;
|
|
|
|
//case 1:
|
|
|
|
// kmanager.PerformIntegrityCheck();
|
|
|
|
// break;
|
|
|
|
//case 2:
|
|
|
|
// kmanager.ScanPoolsForUnlinkedProcesses();
|
|
|
|
// break;
|
|
|
|
//case 3:
|
|
|
|
// kmanager.VerifySystemModules();
|
|
|
|
// break;
|
|
|
|
//case 4:
|
|
|
|
// kmanager.ValidateProcessModules();
|
|
|
|
// break;
|
|
|
|
//case 5:
|
|
|
|
// kmanager.RunNmiCallbacks();
|
|
|
|
// break;
|
|
|
|
//case 6:
|
|
|
|
// kmanager.CheckForAttachedThreads();
|
|
|
|
// break;
|
|
|
|
//case 7:
|
|
|
|
// kmanager.InitiateApcStackwalkOperation();
|
|
|
|
// break;
|
|
|
|
//case 8:
|
|
|
|
// kmanager.CheckForHiddenThreads();
|
|
|
|
// break;
|
|
|
|
//case 9:
|
|
|
|
// kmanager.CheckForEptHooks();
|
|
|
|
// break;
|
|
|
|
//}
|
2023-10-06 07:47:01 +02:00
|
|
|
|
2023-10-08 16:07:49 +02:00
|
|
|
kmanager.InitiateApcStackwalkOperation();
|
2023-10-06 07:47:01 +02:00
|
|
|
kmanager.MonitorCallbackReports();
|
|
|
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::seconds(10));
|
2023-09-28 15:56:07 +02:00
|
|
|
}
|
2023-08-17 10:45:50 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
fclose(stdout);
|
|
|
|
fclose(stdin);
|
|
|
|
FreeConsole();
|
2023-08-16 11:28:46 +02:00
|
|
|
|
2023-10-06 07:47:01 +02:00
|
|
|
FreeLibraryAndExitThread(hinstDLL, 0);
|
|
|
|
return 0;
|
2023-08-16 11:28:46 +02:00
|
|
|
}
|
|
|
|
|
2023-08-17 10:45:50 +02:00
|
|
|
BOOL WINAPI DllMain(
|
2023-10-06 07:47:01 +02:00
|
|
|
HINSTANCE hinstDLL, // handle to DLL module
|
|
|
|
DWORD fdwReason, // reason for calling function
|
|
|
|
LPVOID lpvReserved) // reserved
|
2023-08-15 14:02:17 +02:00
|
|
|
{
|
2023-10-06 07:47:01 +02:00
|
|
|
// Perform actions based on the reason for calling.
|
|
|
|
switch (fdwReason)
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
|
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
|
|
|
|
|
|
|
const auto thread = CreateThread(
|
|
|
|
nullptr,
|
|
|
|
0,
|
|
|
|
reinterpret_cast<LPTHREAD_START_ROUTINE>(Init),
|
|
|
|
hinstDLL,
|
|
|
|
0,
|
|
|
|
nullptr
|
|
|
|
);
|
|
|
|
|
|
|
|
if (thread)
|
|
|
|
CloseHandle(thread);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE; // Successful DLL_PROCESS_ATTACH.
|
2023-08-15 14:02:17 +02:00
|
|
|
}
|