summaryrefslogtreecommitdiff
path: root/other/shellkit/shellcode.h
diff options
context:
space:
mode:
authorRoot THC2026-02-24 12:42:47 +0000
committerRoot THC2026-02-24 12:42:47 +0000
commitc9cbeced5b3f2bdd7407e29c0811e65954132540 (patch)
treeaefc355416b561111819de159ccbd86c3004cf88 /other/shellkit/shellcode.h
parent073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff)
initial
Diffstat (limited to 'other/shellkit/shellcode.h')
-rw-r--r--other/shellkit/shellcode.h62
1 files changed, 62 insertions, 0 deletions
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 @@
1
2/* shellcode.h - shellcode structure and function definitions
3 *
4 * team teso
5 */
6
7#ifndef SHELLCODE_H
8#define SHELLCODE_H
9
10
11/* (nop_gen) function type which will generate a nop space:
12 * parameters: unsigned char *dest, unsigned int dest_len
13 *
14 * will generate no more than dest_len bytes of nop space. the length
15 * is rounded down to a multiple of arch_codelen, so for risc archs be
16 * sure dest_len % arch_codelen is zero
17 *
18 * return the number of nop bytes generated (not the instruction count)
19 *
20 * XXX: name your functions <arch>_nop
21 */
22typedef unsigned int (* nop_gen)(unsigned char *, unsigned int,
23 unsigned char *, int);
24
25/* helper macro to set individual bits
26 */
27#define BSET(dest, len, val, bw) { \
28 dest &= ~(((unsigned char) ~0) >> bw); /* clear lower bits */ \
29 dest |= val << (8 - bw - len); /* set value bits */ \
30 bw += len; \
31}
32
33
34typedef struct {
35 char * code_string; /* description string of the code */
36 unsigned int code_len; /* length of code in bytes */
37 unsigned char * code; /* code byte array */
38} shellcode;
39
40
41typedef struct {
42 char * arch_string; /* description string of this arch */
43 unsigned int arch_codelen; /* minimum instruction length */
44 nop_gen arch_nop; /* nop space generation function */
45 shellcode ** arch_codes; /* shellcode array for this arch */
46} arch;
47
48
49unsigned long int
50random_get (unsigned long int low, unsigned long int high);
51
52void
53random_init (void);
54
55int
56bad (unsigned char u);
57
58int
59badstr (unsigned char *code, int code_len, unsigned char *bad, int bad_len);
60
61#endif
62