Of course a bash file cannot be truly obfuscated and will always be readable. And I don't want to wrap them in some binary package. And renaming local variables wouldn't be worth the trouble.
But is there a reliable simple bash obfuscator or minifier which at least removes all the indentation, all the empty lines and all whitespace without breaking anything? And especially the comments and commented out portions of the script which might contain sensitive documents or information?
I would be afraid of simple grep/sed-lines to do this because "HEREDOCs" must not be modified of course, so a little bit of real parsing is necessary.
Maybe there's a tool to do this, that would be great!
For simple usage, just pass the command you want to obfuscate with -c , or the script you want to obfuscate with -f . You can copy the obfuscated payload to your clipboard with --clip , or write it to a file with -o .
Obfuscation means to make something difficult to understand. Programming code is often obfuscated to protect intellectual property or trade secrets, and to prevent an attacker from reverse engineering a proprietary software program. Encrypting some or all of a program's code is one obfuscation method.
:P here is something funny.
say your script is named origin
and the obfuscated one is named obsf
.
here is origin
:
#!/bin/sh echo "fooo"
here is obsf
$ echo "echo $(base64 origin)" > obsf $ cat obsf echo IyEvYmluL3NoCmVjaG8gImZvb28iCg== $ chmod +x obsf
now rm origin
and run obsf
like this:
$ sh obsf | base64 -d | sh fooo
heh :3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With