scrap shellcode

master
JoYo 2016-01-08 23:31:31 +00:00
parent 5aafac4365
commit 1faad74d59
2 changed files with 12 additions and 6 deletions

View File

@ -7,6 +7,9 @@
#include <sysexits.h> #include <sysexits.h>
#include <openssl/sha.h> #include <openssl/sha.h>
#pragma comment(lib, "openssl/sha.lib")
char *picProto(void *picAddr, size_t picSize, void *clonePtr) { char *picProto(void *picAddr, size_t picSize, void *clonePtr) {
char *(*cloneFunc)(void *, size_t) = clonePtr; char *(*cloneFunc)(void *, size_t) = clonePtr;
return cloneFunc(picAddr, picSize); return cloneFunc(picAddr, picSize);
@ -75,7 +78,7 @@ int main(int argc, const char **argv) {
goto MAIN_CLEANUP; goto MAIN_CLEANUP;
} }
memset_s(&picBuffer, picBuffer_len, 0, picBuffer_len); memset(&picBuffer, 0, picBuffer_len);
retVal = mprotect(picBuffer, picBuffer_len, PROT_EXEC); retVal = mprotect(picBuffer, picBuffer_len, PROT_EXEC);
if (0 == retVal) { if (0 == retVal) {
retVal = EX_SOFTWARE; retVal = EX_SOFTWARE;

13
wscript
View File

@ -2,11 +2,11 @@ import sys
def options(opt): def options(opt):
opt.load('asm compiler_c') opt.load('nasm compiler_c')
def configure(conf): def configure(conf):
conf.load('asm compiler_c') conf.load('nasm compiler_c')
conf.check_cc(header_name='openssl/sha.h') conf.check_cc(header_name='openssl/sha.h')
@ -14,8 +14,11 @@ def build(bld):
bld.program( bld.program(
source='pic-linux.c', source='pic-linux.c',
target='pic-linux', target='pic-linux',
cflags='-g',
lib=['ssl', 'crypto']) lib=['ssl', 'crypto'])
# bld(features='nasm', bld(features='asm',
# source='scrap.asm', source='scrap.asm',
# target='scrap') target='scrap')
# gdb --args ./pic-linux scrap.asm.2.o