Last active
May 6, 2020 12:28
-
-
Save kevinquinnyo/cffade9823e4707ccf33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage=" $0 \"full quoted path to hacked file\"" | |
original_file="$1" | |
inputfile="/tmp/file1.php" | |
outputfile="/tmp/file2.php" | |
die() | |
{ | |
msg="$@" | |
printf "%s\n" "$msg" | |
exit 1 | |
} | |
obfuscated () | |
{ | |
local file="$1"; | |
egrep -o ' eval.gzinflate.base64_decode.' "$file" > /dev/null && return 0; | |
return 1 | |
} | |
c=1 | |
deobfuscate () | |
{ | |
local inf="$1" | |
echo -ne "Pass $c : " | |
md5sum "$inf" | |
if obfuscated "$inf"; then | |
sed 's/\ eval/ echo/' "$inf" > "$outputfile" | |
php "$outputfile" > "$inputfile" | |
let c++ | |
deobfuscate "$inputfile" | |
else | |
echo "STOP: Check $inputfile for payload" | |
exit 0 | |
fi | |
} | |
# test original file to see if it contains obfuscation | |
[[ -e "$original_file" ]] || die "$usage" | |
if obfuscated "$original_file"; then | |
deobfuscate "$original_file" | |
else | |
die "Original file "$original_file" does not contain eval(gzinflate(base64_decode(..." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output: