Home

Awesome

obfCoder

Simple obfuscator for source code written in language C++.

Configuration

Compiling

  1. Clone or download the repository.
  2. Open repository folder as workspace in Visual Code.
  3. Download and install Qt 5.12.2 3.1 Set path in CMakeLists.txt to Qt folder
  4. Install OpenSSL binaries (or compile and install)
  5. Build project.

Technology

Program handling

  1. Use to 'F' button to choose file for obfuscation
  2. In the second field enter the name of the output file, e.g. test.cpp 2.1 Then choose by next button 'F' the path to save the final file. This is important because the name and path will change only after you confirm it in the folder select dialog.
  3. Select the options you want to use from the box to the right.
  4. Then click the Execute button. A blacked-out file should be generated in the specified folder.

Features

Delete comments

This option searches after each line of comment text or comment blocks and deletes them Delete spaces where possible.

Before:

double x1 = 0; //Comment
/* Block // :)
*/

After:

double x1 = 0; 

Change loops

The option searches for nested loops and transforms them into a single loop. The function only works for cases starting iterations from 0. In addition, it should not be used on loops that contain zero elements after an external loop.

Before:

int main() 
{ 
    for (int i = 0; i < 5; i++) 
    { 
        for (int j = 0; j < 3; j++) 
        { 
             std::cout << i*j << " "; 
        } 
    } 
return 0; 
} 

After:

int main( )
{ 
    for( int t = 0 ; t < ( 5 * 3 ) ; t ++ ) 
    { 
    std::cout << ( t / ( 3 * 1 ) ) * ( t % ( 3 * 1 ) )  << " " ; 
    } 
return 0 ; 
} 

Add Additional code

This option adds loop or other blocks to the code that do not affect the operation but make it harder to read. There are two main arguments here:

int test = 15;

After:

int test = 15 ; 
	 test += 2;
	 test -= 2;
int test = 15;

After:

int test = 15 ; 
 
	 int ou ; 
	 for( ou = 0; ou < 3; ou ++) { 
 	 test ++; }
	 test -= 3;
int test = 15;

After:

int test = 15 ; 
 
	 int di = 0; 
	 bool kd = true; 
	 int sp ; 
	 for( sp = 0; sp < 5; sp ++) {
	 di += (int) test ;
	 if( di ) kd = false; 
 } 

Loop For unconnected - It works on the same principle as the polovial, but instead uses a switch statement and the main variable is used to determine the location and is not taken anywhere. Similar to the loop, only instead of relying on a variable it creates a new one on which it makes changes. The main variable itself serves as a value to assign to the new variable.

Before:

int test = 15;

After:

int test = 15 ; 
 
 	 int am = 0; 
	 int el = 1; 
	 int yy ; 
	 for( yy = 0; yy < 0; yy ++) {
	 am *= el ;
	 switch( am )  { 
 case 0: el = 0; 
 break; 
 case 1: el = 1; 
 break;
 case 3: el = 3; 
 break; 
 case 7: el = 7; 
 break; 
 case 10: el = 10; 
 break; 
 default: el = 14; 
 break; }
 }

Incrementation - Increments the variable n times and then undoes the whole process.

int test = 15;

After:

int test = 15 ; 
	 test ++ ;
	 test ++ ;
	 test ++ ;
	 test -- ;
	 test -- ;
	 test -- ;

Rename variables

This option searches for all variables in the text that are of basic types. Then, it converts them into a random UNICODE character.

Before:

int test = 15;
double test2 = 20;
string obfCoder = "obfCoder";

After:

int 倓 = 15 ; 
double 弫 = 20 ; 
string 囊 = "obfCoder" ; 

Encryption

Option using OpenSSL libraries to encrypt values in code with AES algorithm. The function adds libraries and decryption functions to the code. It is important to add OpenSSL libraries to the solution of the file that is being obfuscated. The option itself has two possibilities:

Before:

int test = 15;
double test2 = 20;
string obfCoder = "obfCoder";

After:

#include <string>
#include <fstream>
#include <openssl/aes.h>
int adxux333(unsigned char* wpqai532, int istzp349) {
std::ifstream file("key.txt"); 
 std::string str; 
 std::getline(file, str); 
 unsigned char* wfdb0285 = (unsigned char*)str.c_str(); 
 AES_KEY qhazb092;
  unsigned char symzr361[80];
 AES_set_decrypt_key(wfdb0285, 128, &qhazb092);
	AES_decrypt(wpqai532, symzr361, &qhazb092);
std::string llfuz352; 
 for (const auto& ittfq612 : symzr361) 
 llfuz352 += ittfq612; 
 return stoi(llfuz352) - istzp349; }
int test = adxux333((unsigned char*)"\xdb\x6f\x32\x19\xe9\x76\xc\x1c\x1f\x6b\xb4\xf2\x6f\xbf\x3e\xb4\x1\x0\x0\x0\x1a\x2\x0\x0\x25\x23\xa7\xe7\xf6\x7f\x0\x0\x20\x74\x4f\xc4\x47\x0\x0\x0\x28\x4a\x57\xd2\x1a\x2\x0\x0\x98\x7e\x4f\xc4\x47\x0\x0\x0\x1\x0\x0\x0\x0\x0\x0\x0\xdc\x8f\xab\xe7\xf6\x7f\x0\x0\x10\x74\x4f\xc4\x47\x0\x0\x0" , 369096511 ) ; 
double test2 = adxux333((unsigned char*)"\x8a\x30\xe7\x6\x6\x4d\x16\x8b\x49\x75\xef\x7a\xf3\x0\x9\xd6\x1\x0\x0\x0\x1a\x2\x0\x0\x25\x23\xa7\xe7\xf6\x7f\x0\x0\x20\x74\x4f\xc4\x47\x0\x0\x0\xb8\x4d\x57\xd2\x1a\x2\x0\x0\x98\x7e\x4f\xc4\x47\x0\x0\x0\x1\x0\x0\x0\x0\x0\x0\x0\xdc\x8f\xab\xe7\xf6\x7f\x0\x0\x10\x74\x4f\xc4\x47\x0\x0\x0" , 1201805486 ) ; 
string obfCoder = "obfCoder" ; 

Delete transitions to new line

It requires the Delete comments option to work. This deletes the \n character in all possible places.

Before:

#include<string>
int test = 15;
double test2 = 20;
string obfCoder = "obfCoder";

After:

#include<string>
int test = 15;double test2 = 20;string obfCoder = "obfCoder";

Delete unnecessary space

Delete spaces where possible.

Before:

#include<string>
int test = 15;
double test2 = 20;
string obfCoder = "obf" + test2 + "Coder";

After:

#include<string>
int test=15;
double test2=20;
string obfCoder="obf"+test2+"Coder";

Notes and Tips

License

MIT

ACKNOWLEDGEMENTS

This research was supported by ZUT Highfliers School (Szkoła Orłow ZUT) project, coordinated ´ by Dr. Piotr Sulikowski, within the framework of the program of the Minister of Education and Science (Grant No. MNiSW/2019/391/DIR/KH, POWR.03.01.00-00-P015/18), co-financed by the European Social Fund, the amount of financing PLN 1,704,201,66. ***