Skip to content

Instantly share code, notes, and snippets.

@Cracked5pider
Cracked5pider / ReflectedDll.c
Last active January 20, 2022 14:01
Get output from injected reflected dll
//===============================================================================================//
// This is a stub for the actuall functionality of the DLL.
//===============================================================================================//
#include "ReflectiveLoader.h"
#include <stdio.h>
// Note: REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR and REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN are
// defined in the project properties (Properties->C++->Preprocessor) so as we can specify our own
// DllMain and use the LoadRemoteLibraryR() API to inject this DLL.
MapImg = MemAllocateStomped( &fTable, ImgLen );
if ( !MapImg ) {
sParam.ImgMod = TRUE;
MapImg = MemAllocateVirtual( &fTable, ImgLen );
};
InlineZeroMemory( MapImg, ImgLen );
SecHdr = IMAGE_FIRST_SECTION( NtsHdr );
for ( INT i = 0 ; i < NtsHdr->FileHeader.NumberOfSections ; ++i ) {
#include <Buffer.h>
/*!
* Allocates an empty buffer
* @return pointer to empty buffer
*/
PVOID BufferNew( )
{
// Allocate a buffer that contains * nothing *
return ( PVOID ) LocalAlloc( LPTR, 0 );
/*!
*
* ROGUE
*
* GuidePoint Security LLC
*
* Threat and Attack Simulation
*
!*/
@Cracked5pider
Cracked5pider / transport_https.c
Created July 11, 2022 14:41
perform HTTPs requests using WinHTTP
BOOL TransportSend( LPVOID Data, SIZE_T Size, PVOID* RecvData, PSIZE_T RecvSize )
{
#ifdef TRANSPORT_HTTP
HANDLE hConnect = NULL;
HANDLE hSession = NULL;
HANDLE hRequest = NULL;
DWORD HttpFlags = 0;
LPVOID RespBuffer = NULL;
/*!
* @brief
* Loads a module from KnownDlls using
* NtOpenSection & NtMapViewSection
*
* @param ModuleName
* Wide String name of module to
* load from KnownDlls
*
* @return