diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3113716 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ + +CC = /usr/bin/gcc +CFLAGS = -Wall -Wextra + +hello_world: drinkme.c + $(CC) $(CFLAGS) -o drinkme drinkme.c + +clean: + rm drinkme diff --git a/drinkme.c b/drinkme.c new file mode 100644 index 0000000..a7f0cb9 --- /dev/null +++ b/drinkme.c @@ -0,0 +1,280 @@ + +/********************************************************************************************************************** + * + * drinkme + * + * + * emptymonkey's shellcode testing tool + * 2014-10-31 + * + * + * The drinkme tool takes shellcode as input on stdin, and executes it. This is only intended as a simple framework + * for testing shellcode. + * + * + * The formats supported are: + * * "\x##" + * * "x##" + * * "0x##" + * * "##" + * + * The following characters will be ignored: + * * All whitespace, including newlines. (If entering directly through a tty, remember to hit ctrl+d to send EOF.) + * * '\' + * * '"' + * * ',' + * * ';' + * * C and C++ style comments will be appropriately handled. + * + * + * Now you too can cut and paste shellcode straight from the internet with wild abandon! + * + **********************************************************************************************************************/ + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#define NO_COMMENT 0 +#define COMMENT_OPEN 1 // '/' found. +#define COMMENT_C 2 // '/*' found. +#define COMMENT_C_CLOSE 3 // '/* ... *' found. +#define COMMENT_CPP 4 // '//' found. + + + +char *program_invocation_short_name; +char *CALLING_CARD = "@emptymonkey - https://github.com/emptymonkey"; + + + +void usage(){ + fprintf(stderr, "usage: %s [-p] [-h]\n", program_invocation_short_name); + fprintf(stderr, "\t-p\tJust print the formatted shellcode. Don't execute.\n"); + fprintf(stderr, "\t-h\tPrint this help message.\n"); + fprintf(stderr, "\n\tExample:\t%s