Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShellcodeFramework

This Visual Studio solution is comprised of several tools to easily generate position independent shellcode and test the shellcode.

Usage

Place your shellcode in the _code function located inside the shellcode_gen project under code.cpp. Some sample code has been placed there already for you to test the shellcode. Compile shellcode_gen project and it will output a DLL. containing only a .text section. You can double check that this is valid by using a tool such as PE-Bear of CFF Explorer. After the DLL is created run the following commands:

# dump_text_section.exe <input_dll> <output_map_file>
dump_text_section.exe shellcode_gen.dll shellcode_gen.text
# print_shellcode_c_format.exe <map_file> <function_name> <dumped_section_file>
print_shellcode_c_format.exe shellcode_gen.map _code shellcode_gen.text

The output will look something like so:

#define FUNCTION_OFFSET 0x50c
unsigned char _code_raw[1536] = {
0x00, 0x00, 0x00, 0x00, 0xdd, 0xc3, 0x5e, 0x68, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
0xa0, 0x00, 0x00, 0x00, 0x44, 0x10, 0x00, 0x00, 0x44, 0x04, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x03, 0x80, 0x03, 0x80, 0x34, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3c, 0x10, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0xf8, 0x10, 0x00, <<...TRIMMED...>> 0x00, 0x00, 0x00
};

Testing

You can test this shellcode in shellcode_tester project like so:

#pragma once
#include <windows.h>
#include <iostream>

#ifdef _WIN64
#define FUNCTION_OFFSET 0x50c
unsigned char _code_raw[1536] = {
0x00, 0x00, 0x00, 0x00, 0xdd, 0xc3, 0x5e, 0x68, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
0xa0, 0x00, 0x00, 0x00, 0x44, 0x10, 0x00, 0x00, 0x44, 0x04, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x03, 0x80, 0x03, 0x80, 0x34, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3c, 0x10, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0xf8, 0x10, 0x00, <<...TRIMMED...>> 0x00, 0x00, 0x00
};
#endif

Reference

About

This is a simple framework to create quick and easy position independent shellcode directly in Visual Studio

Resources

Stars

6 stars

Watchers

1 watching

Forks

Contributors

Languages