Skip to content

Commit

Permalink
Merge pull request #8 from tahti/master
Browse files Browse the repository at this point in the history
Fixing c template for 64 bit
  • Loading branch information
reyammer committed Apr 25, 2017
2 parents 91a4399 + ed5f73a commit c923d5e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions shellnoob.py
Expand Up @@ -169,14 +169,17 @@ class ShellNoob():
#include <string.h>
#include <sys/mman.h>
#include <errno.h>
#include <malloc.h>
%s
int len = (sizeof(shellcode) > 2048) ?sizeof(shellcode):2048;
int main() {
// make sure the memory is RWX to support self-modifying shellcode
char *target = (char *) memalign(4096, 2048);
mprotect(target, 2048, PROT_READ | PROT_WRITE | PROT_EXEC);
memcpy(target, shellcode, 2048);
char *target = (char *) memalign(4096, len);
mprotect(target, len, PROT_READ | PROT_WRITE | PROT_EXEC);
memcpy(target, shellcode, len);
(*(void (*)()) target)();
return 0;
}
Expand Down

0 comments on commit c923d5e

Please sign in to comment.