Currently reversing a .jar program recreationally, and I understand the workflow proposed here:
But whenever I go to repackage the folder containing the .class files into my .jar a couple of things go wrong. Firstly the file is a different size than the original, and the .jar will not run at all and instead throws a manifest error.
""" no main manifest attribute, in xxx.jar """
The only change I am making at this time is to a string changing it from "Welcome!" to "LOL!xox!".
I repackage the .jar with the following command: jar -cvf xxx-2.jar -C xxx-1/ .
If I extract the new .jar again and diff the two directories I get changes in directories that I didn't touch
└──╼ $diff -q xxx-1/ xxx-2/
Common subdirectories: xxx-1/META-INF and xxx-2/META-INF
Common subdirectories: xxx-1/net and xxx-2/net
Common subdirectories: xxx-1/org and xxx-2/org
It's worth noting that after executing jar -cvf xxx-2.jar -C xxx-1/ .
I see a significant amount of deflation (30-60%) during execution. I suspect this is some sort of Java version issue, currently running:
└──╼ $java -version
openjdk version "13.0.5.1" 2020-11-06
OpenJDK Runtime Environment (build 13.0.5.1+1-Debian-1)
OpenJDK 64-Bit Server VM (build 13.0.5.1+1-Debian-1, mixed mode)
And the Manifest contains the following version information:
- Manifest-Version: 1.0
- Ant-Version: Apache Ant 1.10.10
- Created-By: 16.0.1+0 (Homebrew)
- Main-Class: net.xxx-1.Main
- Build-Date: 2021-08-02
- Build-Revision: 8736
Original header: https://i.stack.imgur.com/HP0fE.jpg
"patched" header https://i.stack.imgur.com/qk5Rz.jpg
Original footer: https://i.stack.imgur.com/rwojo.jpg
"patched" footer: https://i.stack.imgur.com/zb5Ys.jpg
How do I generate a .jar file where the only change is the string I want to change?
Edit: Added header and foot screenshots