From c9cbeced5b3f2bdd7407e29c0811e65954132540 Mon Sep 17 00:00:00 2001 From: Root THC Date: Tue, 24 Feb 2026 12:42:47 +0000 Subject: initial --- other/shellkit/shellcode.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 other/shellkit/shellcode.h (limited to 'other/shellkit/shellcode.h') diff --git a/other/shellkit/shellcode.h b/other/shellkit/shellcode.h new file mode 100644 index 0000000..02e090c --- /dev/null +++ b/other/shellkit/shellcode.h @@ -0,0 +1,62 @@ + +/* shellcode.h - shellcode structure and function definitions + * + * team teso + */ + +#ifndef SHELLCODE_H +#define SHELLCODE_H + + +/* (nop_gen) function type which will generate a nop space: + * parameters: unsigned char *dest, unsigned int dest_len + * + * will generate no more than dest_len bytes of nop space. the length + * is rounded down to a multiple of arch_codelen, so for risc archs be + * sure dest_len % arch_codelen is zero + * + * return the number of nop bytes generated (not the instruction count) + * + * XXX: name your functions _nop + */ +typedef unsigned int (* nop_gen)(unsigned char *, unsigned int, + unsigned char *, int); + +/* helper macro to set individual bits + */ +#define BSET(dest, len, val, bw) { \ + dest &= ~(((unsigned char) ~0) >> bw); /* clear lower bits */ \ + dest |= val << (8 - bw - len); /* set value bits */ \ + bw += len; \ +} + + +typedef struct { + char * code_string; /* description string of the code */ + unsigned int code_len; /* length of code in bytes */ + unsigned char * code; /* code byte array */ +} shellcode; + + +typedef struct { + char * arch_string; /* description string of this arch */ + unsigned int arch_codelen; /* minimum instruction length */ + nop_gen arch_nop; /* nop space generation function */ + shellcode ** arch_codes; /* shellcode array for this arch */ +} arch; + + +unsigned long int +random_get (unsigned long int low, unsigned long int high); + +void +random_init (void); + +int +bad (unsigned char u); + +int +badstr (unsigned char *code, int code_len, unsigned char *bad, int bad_len); + +#endif + -- cgit v1.3