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.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 other/shellkit/shellcode.c (limited to 'other/shellkit/shellcode.c') diff --git a/other/shellkit/shellcode.c b/other/shellkit/shellcode.c new file mode 100644 index 0000000..330fe2e --- /dev/null +++ b/other/shellkit/shellcode.c @@ -0,0 +1,61 @@ + +/* TODO: better randomness + */ + +#include +#include +#include +#include +#include "shellcode.h" + + +unsigned long int +random_get (unsigned long int low, unsigned long int high) +{ + unsigned long int val; + + if (low > high) { + low ^= high; + high ^= low; + low ^= high; + } + + val = (unsigned long int) random (); + val %= (high - low); + val += low; + + return (val); +} + + +void +random_init (void) +{ + srandom (time (NULL)); +} + + +int +bad (unsigned char u) +{ + if (u == '\x00' || u == '\x0a' || u == '\x0d' || u == '\x25') + return (1); + + return (0); +} + +int +badstr (unsigned char *code, int code_len, unsigned char *bad, int bad_len) +{ + int n; + + for (code_len -= 1 ; code_len >= 0 ; --code_len) { + for (n = 0 ; n < bad_len ; ++n) + if (code[code_len] == bad[n]) + return (1); + } + + return (0); +} + + -- cgit v1.3