1 | 1 | | // Obfuscation of C? Why not? |
2 | 2 | | // Coded by (C) DosX, 2024 |
3 | 3 | | // |
4 | | - | // no_obf = disable obfuscation |
| 4 | + | // [Additional options] |
| 5 | + | // cflow_v2 = more powerful Control Flow obfuscation (slowly!) |
| 6 | + | // hide_antidebug = use dynamic calls to hide antidebugger |
| 7 | + | // |
| 8 | + | // [Disabling default features] |
5 | 9 | | // no_cflow = disable control flow obfuscation |
6 | 10 | | // no_antidebug = disable antidebug protection |
7 | | - | // hide_antidebug = use dynamic calls to hide antidebugger |
| 11 | + | // |
| 12 | + | // no_obf = disable obfuscation |
8 | 13 | | // |
9 | 14 | | // GitHub: |
10 | 15 | | // https://github.com/DosX-dev/obfus.h |
| skipped 132 lines |
143 | 148 | | return int_Proxy(condition); |
144 | 149 | | } |
145 | 150 | | |
| 151 | + | // Control Flow (global) |
146 | 152 | | #if !defined(no_cflow) && no_cflow != 1 |
147 | 153 | | |
| 154 | + | #if !defined(cflow_v2) && cflow_v2 != 1 |
| 155 | + | |
| 156 | + | // Control flow obfuscation for 'if', V1 |
148 | 157 | | #define if(condition) if ((RND(0, 1000)) > _0 && (RND(2, 1000) > condition_True() && condition_Proxy(RND(0, 1000000), condition) && RND(1, 9999999999) > _0 && (int_Proxy(RND(0, 1000)) < RND(1001, 100000000)))) |
| 158 | + | |
| 159 | + | #else |
| 160 | + | |
| 161 | + | // Control flow obfuscation for 'if', V2 (strong!) |
| 162 | + | #define if(condition) \ |
| 163 | + | if (int_Proxy(RND(1, 1000000)) < _0) { \ |
| 164 | + | __asm__ __volatile(".byte 0x00"); \ |
| 165 | + | } else if (int_Proxy((RND(0, 1000)) > _0 && (RND(2, 1000) > condition_True() && condition_Proxy(RND(0, 100000000), condition) && RND(1, 9999999999) > _0 && (int_Proxy(RND(0, 1000)) < RND(1001, 100000000)))) * TRUE) |
| 166 | + | |
| 167 | + | #endif |
| 168 | + | |
149 | 169 | | #define else \ |
150 | 170 | | else if (_0 > RND(1, 1000)) { \ |
151 | 171 | | junkFunc(RND(0, 1000)); \ |
| skipped 12 lines |
164 | 184 | | else |
165 | 185 | | |
166 | 186 | | #define while(condition) while ((RND(0, 1000)) > _0 && _8 > _3 && condition_True() && RND(1, 9999999999) > _0 && condition_Proxy(RND(0, 1000), condition) && _5) |
167 | | - | #define for(data) for (data && int_Proxy(TRUE * (RND(0, 1000))) + FALSE || _1) |
| 187 | + | |
| 188 | + | #define for(data) for (data && int_Proxy(TRUE * (RND(0, 10000))) + FALSE || _1) |
168 | 189 | | |
169 | 190 | | #endif |
170 | 191 | | |
| skipped 176 lines |
347 | 368 | | |
348 | 369 | | char funcName[18]; |
349 | 370 | | funcName[_9 + _8] = _0; |
350 | | - | funcName[16] = _t; |
351 | | - | funcName[_7] = _g; |
352 | | - | funcName[_0] = _I; |
353 | | - | funcName[_1] = _s; |
354 | | - | funcName[14] = _e; |
355 | | - | funcName[_9] = _r; |
356 | | - | funcName[13] = _s; |
357 | | - | funcName[15] = _n; |
358 | | - | funcName[_2] = _D; |
359 | | - | funcName[_3] = _e; |
360 | | - | funcName[10] = _P; |
361 | | - | funcName[_4] = _b; |
362 | | - | funcName[_5] = _u; |
363 | | - | funcName[_8] = _e; |
364 | | - | funcName[11] = _r; |
365 | | - | funcName[_6] = _g; |
366 | | - | funcName[12] = _e; |
| 371 | + | |
| 372 | + | funcName[_9 + _7 * _1] = _t; |
| 373 | + | funcName[_2 + _5 * _1] = _g; |
| 374 | + | funcName[_0 * _8 * _1] = _I; |
| 375 | + | funcName[_1 + _0 * _1] = _s; |
| 376 | + | funcName[_7 * _2 * _1] = _e; |
| 377 | + | funcName[_3 * _3 * _1] = _r; |
| 378 | + | funcName[_9 + _4 * _1] = _s; |
| 379 | + | funcName[_5 * _3 * _1] = _n; |
| 380 | + | BREAK_STACK_3; |
| 381 | + | funcName[_1 + _1 * _1] = _D; |
| 382 | + | funcName[_1 + _2 * _1] = _e; |
| 383 | + | funcName[_5 * _2 * _1] = _P; |
| 384 | + | funcName[_2 + _2 * _1] = _b; |
| 385 | + | funcName[_3 + _2 * _1] = _u; |
| 386 | + | funcName[_4 * _2 * _1] = _e; |
| 387 | + | funcName[_2 + _9 * _1] = _r; |
| 388 | + | funcName[_3 * _2 * _1] = _g; |
| 389 | + | funcName[_6 * _2 * _1] = _e; |
367 | 390 | | |
368 | 391 | | return ((BOOL(*)())GetProcAddress(LoadLibraryA(result), funcName))(); |
369 | 392 | | #endif |
| skipped 523 lines |