Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a simple shell utility to decompile ad entire project at once #221

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions cfr-loop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

#CFR .jar file
BINARY=$1

#EXTENSION TO ANALYZE
EXT=$2

#FOLDER TO DECOMPILE
FOLDER=$3

#OUTPUT WHERE DECOMPILE
OUTPUT=$4

#SORT FILE CONTENT
SORT=$5


if [[ $# -lt 4 ]] ; then
echo 'Please provide the following parameters: '
echo '<path to cfr jar> <extension to analyze> <path to folder to analyze> <output folder>'
echo ''
echo 'EXAMPLE:'
echo ''
echo './cfr-loop.sh ./cfr-0.150.jar .class /path/to/my/project-root /tmp/a-new-or-existing-folder-as-you-want'
exit 1
fi

echo "decompiling ..."
set -f
for f in $(find "$FOLDER" -name "*$EXT")
do
java -jar $BINARY $f --outputdir $OUTPUT
done
echo "decompiling done"

if [[ $SORT -eq sort ]] ; then
echo "sorting ..."
set -f
for fjava in $(find "$OUTPUT" -name *.java)
do
sort $fjava --output=$fjava
done
echo "sorting done"
fi