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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
/*
* stage1_primitives
*/
#include <stdint.h>
#include <stdio.h>
#include "stage1_primitives.h"
#include "stage0_primitives.h"
#include "ip_tools.h"
#include "common.h"
#include <string.h>
#include "shit.h"
//#define LC_CONF_OFFSET 0xb6088
extern FILE* fp;
char* write32_unslid(uint32_t where,
uint32_t what) {
char* ret = "";
_asprintf(&ret,
"%s%s",
ret,
write32_slid(LC_CONF_OFFSET,
where - 0xa0));
_asprintf(&ret,
"%s"
"timer{"
"counter%u;"
"}",
ret,
what);
return ret;
}
char* write32_unslid_pre(uint32_t where) {
char* ret = "";
_asprintf(&ret,
"%s%s",
ret,
write32_slid(LC_CONF_OFFSET,
where - 0xa0));
return ret;
}
char* writebuf_old_unslid(uint32_t where,
char* what,
uint32_t len) {
char* ret = "";
uint32_t* lol = (uint32_t*)what;
while (((void*)lol - (void*)what) < len) {
_asprintf(&ret,
"%s%s",
ret,
write32_unslid_pre(where + ((void*)lol - (void*)what)));
/*
* i make an exception for 80 cols here
*/
_asprintf(&ret, "%stimer{", ret);
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%scounter%u;", ret, *lol); lol++; }
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%sinterval%usec;", ret, *lol); lol++; }
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%spersend%u;", ret, *lol); lol++; }
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%sphase1%usec;", ret, *lol); lol++; }
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%sphase2%usec;", ret, *lol); lol++; }
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%snatt_keepalive%usec;", ret, *lol); lol++; }
_asprintf(&ret,
"%s}",
ret);
}
strcpy(fuck_memory_leaks, ret);
free(ret);
return fuck_memory_leaks;
return ret;
}
char* writebuf_unslid(uint32_t where,
char* what,
uint32_t len) {
char* ret = "";
uint32_t* lol = (uint32_t*)what;
#if 0
for (uint32_t here = where; here < where + len; here++) {
asprintf(&ret,
"%s%s",
ret,
write32_unslid_pre(here));
asprintf(&ret, "%stimer{counter%u;}", ret, *(uint8_t*)(what + (here - where)));
}
#endif
#if 1
while (((void*)lol - (void*)what) < len) {
_asprintf(&ret,
"%s%s",
ret,
write32_unslid_pre(where + ((void*)lol - (void*)what)));
/*
* i make an exception for 80 cols here
*/
_asprintf(&ret, "%stimer{", ret);
/*
* this is so fucking ugly
*/
if ((((*lol) & 0x80000000) >> 31) == 1) {
lol:
_asprintf(&ret,
"%s}",
ret);
for (uint32_t here = ((void*)lol - (void*)what); here < ((void*)lol - (void*)what) + 4; here++) {
_asprintf(&ret,
"%s%s",
ret,
write32_unslid_pre(here + where));
_asprintf(&ret, "%stimer{counter%u;}", ret, *(uint8_t*)(what + (here)));
}
lol++;
continue;
}
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%scounter%u;", ret, *lol); lol++; }
if ((((*lol) & 0x80000000) >> 31) == 1) goto lol;
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%sinterval%usec;", ret, *lol); lol++; }
if ((((*lol) & 0x80000000) >> 31) == 1) goto lol;
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%spersend%u;", ret, *lol); lol++; }
if ((((*lol) & 0x80000000) >> 31) == 1) goto lol;
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%sphase1%usec;", ret, *lol); lol++; }
if ((((*lol) & 0x80000000) >> 31) == 1) goto lol;
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%sphase2%usec;", ret, *lol); lol++; }
if ((((*lol) & 0x80000000) >> 31) == 1) goto lol;
if (((void*)lol - (void*)what) < len) { _asprintf(&ret, "%snatt_keepalive%usec;", ret, *lol); lol++; }
_asprintf(&ret,
"%s}",
ret);
}
#endif
return ret;
}
|