diff --git a/.gitignore b/.gitignore index 127765a..20a197e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ # Composer /vendor/ /composer.lock +/deobfuscated/ +/toDeobfuscate/ \ No newline at end of file diff --git a/README.md b/README.md index 152f434..fd90e0d 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,10 @@ optional arguments: The deobfuscated output is printed to STDOUT. +#### Batch Processing + +Create a "toDeobfuscate" directory and put the files or directories you wish to deobfuscate inside it. Run `bash batchDeobfuscate.sh`. It will create a "deobfuscated" directory with the outputs. If the "deobfuscated" directory already exists, it will clear it before running. + ### Web Server `index.php` outputs a simple textarea to paste the PHP code into. Deobfuscated code is printed when the form is submitted diff --git a/batchDeobfuscate.sh b/batchDeobfuscate.sh new file mode 100644 index 0000000..438a5fb --- /dev/null +++ b/batchDeobfuscate.sh @@ -0,0 +1,26 @@ +# Create the "deobfuscated" directory if it doesn't exist and clear it if it does +mkdir -p deobfuscated +rm -rf deobfuscated/* + +# Find all the files inside the "toDeobfuscate" directory and loop over them +find toDeobfuscate -type f | while read file; do + + # Create the directory structure inside "deobfuscated" + mkdir -p "deobfuscated/$(dirname "$file" | sed 's/toDeobfuscate\///g')" + + echo $file + + if [[ "$file" == *.php ]]; then + # run index.php using -f and save the output to the corresponding directory inside "deobfuscated" + php index.php -f "$file" > "deobfuscated/$(echo "$file" | sed 's/toDeobfuscate\///g')" + else + # if the file is not a PHP file, just copy it + cp "$file" "deobfuscated/$(echo "$file" | sed 's/toDeobfuscate\///g')" + fi +done + +echo "Done decoding!" + +echo "Missing files:" +# Compare the "toDeobfuscate" and "deobfuscated" directories and echo a list with any missing files +diff -qr toDeobfuscate deobfuscated | grep "Only in toDeobfuscate:" | awk '{print $4}' \ No newline at end of file