- Joined
- Jan 8, 2019
- Messages
- 56,623
- Solutions
- 2
- Reputation
- 32
- Reaction score
- 100,456
- Points
- 2,313
- Credits
- 32,750
6 Years of Service
76%

A simple console Java code obfuscator: adding random comments and unreachable code, clearing formatting, renaming variables.
Example of obfuscated code:
/*i2EuesSMS4riq55*/package obfuscator;import java.io.*;import /*Yoj`r`epCK*/ java.util.Scanner;public /*QUCopDP[Nx*/ //yMwB47ljgtwXK_I
class Main{String /*lSA]tTqpGj*/ zTdCL(){String
/*uZxIMGHOjJ*/ /*f[jsC8vK`5*/ fwLwDA="Daniil";String IhSjms="Rud";while(fwLwDA!=""){System.out.println(fwLwDA+IhSjms);}return IhSjms;}public static void main(String[]args){Scanner scanner=new Scanner(System.in);String HSFRZZ="";while(HSFRZZ.isEmpty()){System.out.println("Enter the path to the file to open:");HSFRZZ=scanner.nextLine();try(FileReader fr=new FileReader(HSFRZZ)){StringBuilder stringBuffer=new StringBuilder();int vCJqPj;while((vCJqPj=fr.read())!=-1){stringBuffer.append((char)vCJqPj);}String CDIaPb=AddUnreachableCode.addUnreachCode(stringBuffer.toString());CDIaPb=CodeCleaning.cleanCode(CDIaPb);CDIaPb=RenameVariables.IdentifierNameReplacing(CDIaPb);CDIaPb=AddRandomComments.createComments(CDIaPb);writeInFile(CDIaPb);}catch(IOException e){System.out.println("File not found");HSFRZZ="";}}scanner.close();}private static void writeInFile(String str)throws IOException{String TNPYSg=System.getProperty("user.home")+"/Desktop";String HSFRZZ=TNPYSg+"/output.txt";FileWriter writer=new FileWriter(HSFRZZ,false);writer.append(str);writer.flush();writer.close();System.out.println("The obfuscated code has been successfully saved to the desktop.");}}
To see this hidden content, you must like this content.