Skip to content

Instantly share code, notes, and snippets.

@DanyelMorales
Created December 20, 2022 07:43
Show Gist options
  • Save DanyelMorales/63ea7925734f7abb01fae3f4f5ee9441 to your computer and use it in GitHub Desktop.
Save DanyelMorales/63ea7925734f7abb01fae3f4f5ee9441 to your computer and use it in GitHub Desktop.
Ofuscator core
#!/bin/bash
output=$3
filex=tmpmainfile.sh
echo $"$(cat $2)" > $filex
banner=$(figlet "$1" | gzip | base64)
banner="base64 -d <<<\"$banner\" | gunzip"
key="# ===BANNER==="
perl -i -pe "s@$key@$banner@gms" ${filex}
currentDir=$(dirname "$0")
cp $currentDir/template.sh $output
funcaname="xf"$(dbus-uuidgen)
barridoName="b"$(dbus-uuidgen)
markerName="m"$(dbus-uuidgen)
markerNameVar="m"$(dbus-uuidgen)
echo -n $markerNameVar"=\$(awk '/^___"$markerName"___/ {print NR+1; exit 0; }' \"\${0}\");" >> $output
echo -n $barridoName"=\$(tail -n+\${"$markerNameVar"} \"\${0}\");" >> $output
echo "" >> $output
echo 'function '$funcaname'(){' >> $output
echo 'echo $(base64 -d <<< "$1"| gunzip);' >> $output
echo '}' >> $output
REGX=()
IN=$(cat $filex)
while IFS=$'\n' read -ra ADDR; do
for i in "${ADDR[@]}"; do
varxxa="X02D"$(dbus-uuidgen)
cz=$(echo $"$i" | tr -d '\0'| gzip| base64 )
echo -n $varxxa"=\$($funcaname \"$cz\");" >> $output
REGX+=($varxxa)
done
done <<< "$IN"
echo -n $"pbv921=\$(eval \"echo \$\\\"\$"$barridoName"\\\"\");" >> $output
echo -n "b17320=\"\$(cat \${0})\";" >> $output
echo -n "echo \$\"\$pbv921\" > \${0};" >> $output
echo -n "echo \$\"\$(\${0} \${@})\" && echo \$\"\$b17320\" > \${0};" >> $output
echo "exit 0;" >> $output
echo "___"$markerName"___" >> $output
for i in "${REGX[@]}"; do
echo -n "$"$i"\$z" >> $output
done
echo -n "\"\"" >> $output
rm $filex &2>/dev/null
#!/bin/bash
z="
";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment