BlackMagic

C++ Functor to C Function Pointer Conversion

Pop quiz hotshot: You're on a bus with no Internet connection. You absolutely need to interface some new C++ code with a shoddy old C interface based on function pointers. The new C++ code makes heavy use of functors to carry state between call invocations. The C code must call these C++ functors by way of a function pointer, and only a function pointer. Your function pointer prototype cannot take any additional arguments for the class type. What do you do? What do you do...

Autocode

The point of this project was to write platform independent stack overflow shellcode using only a C compiler and no asm. I succeeded, almost. The compiled autocode.c file disassembles itself, and outputs working shellcode. However, the major drawback is that on x86 it doesn't seem possible to eliminate the 0's from the resulting instructions. I attempted to fix this by adding an XOR encoder, but the problem is even that contained 0's when it attempted to obtain EIP through the usual call mechanism. The offset to the relative call instruction contained 0s.. Oh well. It was a fun exercise.

Syndicate content