https://github.com/safememoryzone/cobfus
Simple C-obfuscator written in C.
https://github.com/safememoryzone/cobfus
c obfuscator
Last synced: about 2 months ago
JSON representation
Simple C-obfuscator written in C.
- Host: GitHub
- URL: https://github.com/safememoryzone/cobfus
- Owner: SafeMemoryZone
- License: mit
- Created: 2024-06-13T15:49:48.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-06-30T09:58:08.000Z (11 months ago)
- Last Synced: 2025-02-10T21:36:48.711Z (3 months ago)
- Topics: c, obfuscator
- Language: C
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cobfus
A simple C-obfuscator written in C.## Example
Obfuscated [donut.c](https://www.a1k0n.net/2011/07/20/donut-math.html):
```c
int _0;double sin(),cos();main(){float _1=0,_2=0,_3,_4,_5[1760];char _6[1760];printf("\x1b[2J");for(
;;){memset(_6,32,1760);memset(_5,0,7040);for(_4=0;6.28>_4;_4+=0.07){for(_3=0;6.28>_3;_3+=0.02){float
_7=sin(_3),_8=cos(_4),_9=sin(_1),_10=sin(_4),_11=cos(_1),_12=_8+2,_13=1/(_7*_12*_9+_10*_11+5),_14=
cos(_3),_15=cos(_2),_16=sin(_2),_17=_7*_12*_11-_10*_9;int _18=40+30*_13*(_14*_12*_15-_17*_16),_19=12
+15*_13*(_14*_12*_16+_17*_15),_20=_18+80*_19,_21=8*((_10*_9-_7*_8*_11)*_15-_7*_8*_9-_10*_11-_14*_8*
_16);if(22>_19&&_19>0&&_18>0&&80>_18&&_13>_5[_20]){_5[_20]=_13;_6[_20]=".,-~:;=!*#$@"[_21>0?_21:0];}
}}printf("\x1b[d");for(_0=0;1761>_0;_0++)putchar(_0%80?_6[_0]:10);_1+=0.04;_2+=0.02;}}
```## Quickstart
```console
$ cc -o cobfus src/cobfus.c
```## Usage
```console
$ ./cobfus [-o ] [-l ] [-i ...]
```### Flags
- `-o`: output file (default is `.obfus`)
- `-l`: target line len (in chars) - the obfuscator will try to keep this line len
- `-i`: a list of symbols that won't be renamed (some are automatically ignored like `main`, `printf`, `malloc`, `free` ...)## Limitations
The input program must only use primitive data types and specify the functions that should not be renamed (see `ignored_c_funcs`).