This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <string> | |
#include <vector> | |
#include <algorithm> | |
// White Knight Labs - Offensive Development Course | |
// DLL Guardrails Example | |
// This function extracts the file name from a given path | |
// It is used later to determine the executable name loading the DLL. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <iostream> | |
#include <chrono> | |
#include <ctime> | |
#include <sstream> | |
// White Knight Labs - Offensive Development Course | |
// DLL Kill Date Example | |
bool parseDate(const std::string& dateStr, std::tm& date) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# White Knight Labs - Offensive Development Course | |
# Guardrails - Folder Check | |
#include <windows.h> // Include Windows-specific headers for system calls | |
#include <iostream> // Include for input and output stream operations | |
#include <string> // Include for using string class | |
#include <algorithm> // Include for standard algorithms, e.g., std::transform | |
#include <cctype> // Include for character handling functions, e.g., std::tolower | |
// Function to check if the path of the current executable is under a specified path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# White Knight Labs - Offensive Development | |
# Debugger Check - PEB | |
#include <windows.h> | |
#include <iostream> | |
void TriggerBreakpoint() { | |
__asm { | |
int 3 // Software Breakpoint | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# White Knight Labs - Offensive Development | |
# Guardrails - Parent Process Check | |
#include <windows.h> | |
#include <tlhelp32.h> | |
#include <psapi.h> | |
#include <tchar.h> | |
#include <iostream> | |
// Function to get the ID of the parent process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// White Knight Labs - Offensive Development Course | |
// Guardrails - Control Flow & Anti-Debugging | |
#include <windows.h> | |
#include <iostream> | |
// Test function to be called when an access violation occurs | |
void TestFunction() { | |
std::cout << "Test function executed after catching access violation." << std::endl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// White Knight Labs - Offensive Development Course | |
// Anti-Debug Patch Check - KERNELBASE!IsDebuggerPresent function | |
#include <iostream> | |
#include <Windows.h> | |
// Define the expected bytes of the KERNELBASE!IsDebuggerPresent function. | |
// This array represents the specific sequence of bytes we expect to find at the | |
// beginning of the IsDebuggerPresent function in a non-modified state. | |
const unsigned char expectedBytes[] = {0x65, 0x48, 0x8B, 0x04, 0x25, 0x60, 0x00, 0x00, 0x00, 0x0F, 0xB6, 0x40, 0x02, 0xC3}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <sddl.h> | |
#include <tchar.h> | |
#include <iostream> | |
#include <algorithm> | |
#include <cctype> | |
// Link with the Advapi32.lib to use Windows Security functions | |
#pragma comment(lib, "advapi32.lib") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// White Knight Labs - Offensive Development Course | |
// String Enbcryption- Double XOR | |
#include <iostream> | |
#include <string> | |
// Function to apply XOR operation between the message and a key | |
std::string xorEncryptDecrypt(const std::string& text, const std::string& key) { | |
std::string result = text; // Start with the original text | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include "winternl.h" | |
#pragma comment(lib, "ntdll") | |
UINT_PTR sysAddrNtAllocateVirtualMemory; | |
UINT_PTR sysAddrNtWriteVirtualMemory; | |
UINT_PTR sysAddrNtCreateThreadEx; | |
UINT_PTR sysAddrNtWaitForSingleObject; | |
OlderNewer