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!
: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