summaryrefslogtreecommitdiff
path: root/other/shell/shellcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'other/shell/shellcode.c')
-rw-r--r--other/shell/shellcode.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/other/shell/shellcode.c b/other/shell/shellcode.c
deleted file mode 100644
index 1fc68cf..0000000
--- a/other/shell/shellcode.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/* shellcode extraction utility,
2 * by type / teso, small mods by scut.
3 */
4
5
6#include <stdio.h>
7#include <stdlib.h>
8
9extern void cbegin ();
10extern void cend ();
11
12
13int
14main (int argc, char *argv[])
15{
16 int i;
17 unsigned char * buf = (unsigned char *) cbegin;
18 unsigned char ex_buf[1024];
19
20
21 printf ("/* %d byte shellcode */\n", cend - cbegin);
22 printf ("\"");
23 for (i = 0 ; buf < (unsigned char *) cend; ++buf) {
24
25 printf ("\\x%02x", *buf & 0xff);
26
27 if (++i >= 12) {
28 i = 0;
29 printf ("\"\n\"");
30 }
31 }
32 printf ("\";\n");
33
34 printf("\n");
35
36 if (argc > 1) {
37 printf ("%02x\n", ((unsigned char *) cbegin)[0]);
38 printf ("%02x\n", ex_buf[0]);
39 memcpy (ex_buf, cbegin, cend - cbegin);
40 printf ("%02x\n", ex_buf[0]);
41 ((void (*)()) &ex_buf)();
42 }
43
44 exit (EXIT_SUCCESS);
45}
46