diff options
| author | Root THC | 2026-02-24 12:42:47 +0000 |
|---|---|---|
| committer | Root THC | 2026-02-24 12:42:47 +0000 |
| commit | c9cbeced5b3f2bdd7407e29c0811e65954132540 (patch) | |
| tree | aefc355416b561111819de159ccbd86c3004cf88 /other/shellkit/shellkit.c | |
| parent | 073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff) | |
initial
Diffstat (limited to 'other/shellkit/shellkit.c')
| -rw-r--r-- | other/shellkit/shellkit.c | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/other/shellkit/shellkit.c b/other/shellkit/shellkit.c new file mode 100644 index 0000000..79d830d --- /dev/null +++ b/other/shellkit/shellkit.c | |||
| @@ -0,0 +1,123 @@ | |||
| 1 | /* shellkit.c - experimentation program for included shellcodes | ||
| 2 | * | ||
| 3 | * team teso | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <stdio.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | #include <unistd.h> | ||
| 9 | #include "shellkit.h" | ||
| 10 | |||
| 11 | |||
| 12 | void usage (void); | ||
| 13 | void sc_list (void); | ||
| 14 | |||
| 15 | int dump = 0; | ||
| 16 | int execute = 0; | ||
| 17 | |||
| 18 | |||
| 19 | void | ||
| 20 | usage (void) | ||
| 21 | { | ||
| 22 | printf ("usage: shellkit [-hdlx] [-e env1 [-e env2] ...] [code-identifier1 [ci2 [...]]]\n\n"); | ||
| 23 | printf ("options:\n"); | ||
| 24 | printf ("\t-h\thelp, you're just viewing it\n" | ||
| 25 | "\t-d\tdump shellcode in hex\n" | ||
| 26 | "\t-l\tonly list available shellcodes\n" | ||
| 27 | "\t-x\texecute choosen shellcode\n" | ||
| 28 | "\t-e env\tbuild an environment for the shellcode, use -e list\n" | ||
| 29 | "\t\tto get a list\n\n"); | ||
| 30 | printf ("the shellkit utility will build a chained block of codes described by the\n" | ||
| 31 | "given code identifiers, copy it to a writeable place of memory and will\n" | ||
| 32 | "do anything necessary to execute this block of code on your architecture.\n" | ||
| 33 | "before executing the code the environments specified are installed.\n" | ||
| 34 | "you can - of course - only execute code for your architecture.\n\n"); | ||
| 35 | |||
| 36 | exit (EXIT_FAILURE); | ||
| 37 | } | ||
| 38 | |||
| 39 | |||
| 40 | void | ||
| 41 | env_list (void) | ||
| 42 | { | ||
| 43 | printf ("list of available environments:\n\n"); | ||
| 44 | |||
| 45 | exit (EXIT_SUCCESS); | ||
| 46 | } | ||
| 47 | |||
| 48 | |||
| 49 | void | ||
| 50 | sc_list (void) | ||
| 51 | { | ||
| 52 | int sc_walker; | ||
| 53 | int arch_walker; | ||
| 54 | arch * a; | ||
| 55 | |||
| 56 | |||
| 57 | for (arch_walker = 0 ; shellcodes[arch_walker] != NULL ; | ||
| 58 | ++arch_walker) | ||
| 59 | { | ||
| 60 | a = shellcodes[arch_walker]; | ||
| 61 | |||
| 62 | printf ("%s:\n", a->arch_string); | ||
| 63 | for (sc_walker = 0 ; a->arch_codes[sc_walker] != NULL ; | ||
| 64 | ++sc_walker) | ||
| 65 | { | ||
| 66 | printf ("\t%-30s %3d\n", | ||
| 67 | a->arch_codes[sc_walker]->code_string, | ||
| 68 | a->arch_codes[sc_walker]->code_len); | ||
| 69 | } | ||
| 70 | printf ("\n"); | ||
| 71 | } | ||
| 72 | |||
| 73 | exit (EXIT_SUCCESS); | ||
| 74 | } | ||
| 75 | |||
| 76 | |||
| 77 | int | ||
| 78 | main (int argc, char *argv[]) | ||
| 79 | { | ||
| 80 | int c; | ||
| 81 | int xenvc = 0; | ||
| 82 | char * xenv[16]; | ||
| 83 | |||
| 84 | |||
| 85 | random_init (); | ||
| 86 | memset (xenv, '\x00', sizeof (xenv)); | ||
| 87 | |||
| 88 | if (argc < 2) | ||
| 89 | sc_list (); | ||
| 90 | |||
| 91 | while ((c = getopt (argc, argv, "hdlxe:")) != -1) { | ||
| 92 | switch (c) { | ||
| 93 | case 'h': | ||
| 94 | usage (); | ||
| 95 | break; | ||
| 96 | case 'd': | ||
| 97 | dump = 1; | ||
| 98 | break; | ||
| 99 | case 'l': | ||
| 100 | sc_list (); | ||
| 101 | break; | ||
| 102 | case 'x': | ||
| 103 | execute = 1; | ||
| 104 | break; | ||
| 105 | case 'e': | ||
| 106 | if (strcmp (optarg, "list") == 0) | ||
| 107 | env_list (); | ||
| 108 | if (xenvc >= 15) { | ||
| 109 | fprintf (stderr, "insane, huh? dont mess\n"); | ||
| 110 | exit (EXIT_FAILURE); | ||
| 111 | } | ||
| 112 | xenv[xenvc++] = optarg; | ||
| 113 | break; | ||
| 114 | default: | ||
| 115 | usage (); | ||
| 116 | break; | ||
| 117 | } | ||
| 118 | } | ||
| 119 | |||
| 120 | exit (EXIT_SUCCESS); | ||
| 121 | } | ||
| 122 | |||
| 123 | |||
