Wednesday, April 18, 2012

How to minify/obfuscate a bash script

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!





No comments:

Post a Comment