From 5d3573ef7a109ee70416fe94db098fe6a769a798 Mon Sep 17 00:00:00 2001 From: SkyperTHC Date: Tue, 3 Mar 2026 06:28:55 +0000 Subject: packetstorm sync --- other/shell/shellcode.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 other/shell/shellcode.c (limited to 'other/shell/shellcode.c') diff --git a/other/shell/shellcode.c b/other/shell/shellcode.c new file mode 100644 index 0000000..1fc68cf --- /dev/null +++ b/other/shell/shellcode.c @@ -0,0 +1,46 @@ +/* shellcode extraction utility, + * by type / teso, small mods by scut. + */ + + +#include +#include + +extern void cbegin (); +extern void cend (); + + +int +main (int argc, char *argv[]) +{ + int i; + unsigned char * buf = (unsigned char *) cbegin; + unsigned char ex_buf[1024]; + + + printf ("/* %d byte shellcode */\n", cend - cbegin); + printf ("\""); + for (i = 0 ; buf < (unsigned char *) cend; ++buf) { + + printf ("\\x%02x", *buf & 0xff); + + if (++i >= 12) { + i = 0; + printf ("\"\n\""); + } + } + printf ("\";\n"); + + printf("\n"); + + if (argc > 1) { + printf ("%02x\n", ((unsigned char *) cbegin)[0]); + printf ("%02x\n", ex_buf[0]); + memcpy (ex_buf, cbegin, cend - cbegin); + printf ("%02x\n", ex_buf[0]); + ((void (*)()) &ex_buf)(); + } + + exit (EXIT_SUCCESS); +} + -- cgit v1.3