Skip to content

Instantly share code, notes, and snippets.

"""
Transform a binary file into a C header file.
The binary file is splitted into 16 char strings and rebuild at execution time.
The function buildsc() must be called in your main to rebuild the binary file into the sc C variable.
The length is set in the sc_length variable.
Be carefull, try to avoid compiler code optimization as it will remove all these modifications in the final binary.
"""
/*
* Rust basic Process injection using OpenProcess, VirtualAllocEx, WriteProcessMemory and CreateRemoteThread
*/
#[allow(non_camel_case_types)]
type HANDLE = *mut u64;
#[allow(non_camel_case_types)]
type LPVOID = *mut u64;
#[allow(non_camel_case_types)]
type DWORD = u32;
#[allow(non_camel_case_types)]
/*
* Rust basic Process injection using OpenProcess, VirtualAllocEx, WriteProcessMemory and CreateRemoteThread
* API dynamic resolution and shellcode XOR encoded
*/
#[allow(non_camel_case_types)]
type HANDLE = *mut u64;
#[allow(non_camel_case_types)]
type LPVOID = *mut u64;
#[allow(non_camel_case_types)]
type DWORD = u32;
@OtterHacker
OtterHacker / get_proc_address.c
Created November 27, 2023 22:51
Custom GetProcAddress and GetModuleHandle parsing forwarded export
unsigned long hash_string(void* buffer, unsigned long size, char* extension){
unsigned char current = 0;
unsigned long hash = 0;
unsigned char* currentChar = NULL;
hash = 1337;
currentChar = (void*)buffer;
hash++;
while(1){
current = *currentChar;