Created
November 1, 2018 18:28
-
-
Save egre55/c9929bd4ee8c258165c2fe06806e75ca to your computer and use it in GitHub Desktop.
simple_case_obfuscator.sh
This file contains 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
# simple case obfuscator | |
# author: @egre55 | |
# usage: ./simple_case_obfuscator.sh Invoke-PowerShellTcp.ps1 | |
if [ "$1" == "" ]; then | |
printf "\nusage: ./simple_case_obfuscator.sh Invoke-PowerShellTcp.ps1\n\n" | |
exit 0 | |
fi | |
file=$1 | |
limit=$(wc $file | awk -F" " '{print $3}') | |
max=$(($limit / 2)) | |
cp "$1" "$1.bak" | |
printf "[+] created backup file $1.bak\n[+] case-encoding $1\n" | |
sed -i "/^$/d" $file | |
sed -i -E ':a;N;$!ba;s/\n/¬/g' $file | |
for i in $(seq 1 $max) | |
do | |
position=$(shuf -i 0-$limit -n 1) | |
sed -i "s/./\U&/$position" $file 2>/dev/null | |
done | |
for i in $(seq 1 $max) | |
do | |
position=$(shuf -i 0-$limit -n 1) | |
sed -i "s/./\L&/$position" $file 2>/dev/null | |
done | |
sed -i "s/¬/\n/g" $file | |
printf "[+] done\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment