Skip to content

Instantly share code, notes, and snippets.

@svagionitis
Created November 12, 2015 14:21
Show Gist options
  • Save svagionitis/bfe5123e97e066aef384 to your computer and use it in GitHub Desktop.
Save svagionitis/bfe5123e97e066aef384 to your computer and use it in GitHub Desktop.
Script for decompiling a jar file using JAD.
#!/bin/sh
# Decompile a jar file and create a compressed
# file with the sources.
# The [JAD decompiler](http://varaneckas.com/jad/)
# is used.
if [ $# -eq 0 ]; then
echo "Usage: $0 [jar]"
exit 1
fi
JAR=$1
unzip -d $JAR.jad_src $JAR
cd $JAR.jad_src
for f in `find . -name '*.class'`; do
jad -d $(dirname $f) -s java -lnc $f
done
cd -
# Tar and compress it to a file
tar cvf $JAR.jad_src.tar $JAR.jad_src
bzip2 -9 $JAR.jad_src.tar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment