vimasig / Bozar

Java bytecode obfuscator with GUI
MIT License
152 stars 19 forks source link

Setting main class attribute in MANIFEST.MF to a class that doesnt exist (Name Obfuscation) #3

Closed MOMIN5 closed 3 years ago

MOMIN5 commented 3 years ago

Describe the bug When i try to name obfuscate, it sets the MainClass attribute to a class that doesnt exist

To Reproduce use the "Alphabet" method in a jar with mainclass
here is my config (saved in .txt for only uploading as attachement) bozarConfig.txt

Expected behavior sets the main variable as the obfuscated main file name

Screenshots bozer

Bozar version the newest one in releases

Additional context nope

vimasig commented 3 years ago

I made a JAR like that to test this classes

Renaming job is done correctly and the application is running without any issues. metainf

Did you get any errors when obfuscating? Maybe class exists but cannot be written for another reason. Does the new class count match the old one?

Also, "Dummy class" watermark is enabled in your config but I can't see that. Look for errors in the console for that too.

Can you provide more information so I can reproduce it?

MOMIN5 commented 3 years ago

huh, I tested it in a Windows VM and it worked, maybe it's a Linux only issue?

working on windows bz3

it still didn't create a dummy class tho, here are the two errors I got (in the windows VM)

bz1 bz2

vimasig commented 3 years ago

The main issue looks like Bozar can't process all of your classes. The class count is different from the first SS. Looks like something is wrong with CustomClassWriter (used to find classes) but I can't tell without making tests.

Try disabling shuffle so maybe you can always get the same error & result. (Shuffle can cause the unprocessable class to be randomly selected. Which is why you get different class count)

You can try excluding all classes and removing them one by one to find unprocessable classes.

Unfortunately, I can't reproduce this issue. Can you provide a sample JAR/code which can reproduce this?

MOMIN5 commented 3 years ago

i turned shuffle off, there is no error but now there are only 3 classes and no dummy class, some classes of the jar is in kotlin tho, maybe this has to do something with the fact that the jar is an anti-debugger / anti-dumper, its a heavily modified version of Falcon-forge with some extra disablers, I will send you the original jar later after removing all the sensitive details

MOMIN5 commented 3 years ago

here is the jar, sorry for being late btw [removed cause private info]

Also any idea why it doesnt include any library files in the output jar when i exclude them from obfuscating

vimasig commented 3 years ago

Fixed. Will be released as v1.6.0 soon.

Do you want libraries to be automatically placed in the output JAR? Or the input jar contains libraries already, but when you exclude them, they're not placed in the output JAR?

MOMIN5 commented 3 years ago

the input jar contains libraries already, but when i exclude them, they're not placed in the output JAR

vimasig commented 3 years ago

I think it's not related to exclude. In v1.5, Bozar aborts the writing process when an exception occurs while processing classes. This should not happen in v1.6 as the issue is fixed, and it will continue even when an exception occurs.

Let me know if it still happens

MOMIN5 commented 3 years ago

thanks it worked :+1: