Obfuscate Scripts

OWASP-ZSC

Requires OWASP-ZSC. ZSC overwrites the input file — keep an original, and strip any unobfuscated code from the output.

zsc -p python/simple_ascii      -i 'HideMe.py'
zsc -p python/simple_base64_rev -i 'HideMe.py'
zsc -p python/simple_hex        -i 'HideMe.py'
zsc -p python/simple_hex_rev    -i 'HideMe.py'   # shorter than simple_hex
zsc -p python/rot13             -i 'HideMe.py'

Also works for javascript, ruby, php and perl, with the same simple_ascii / hex / base64 / hex_rev / base64_rev variants.

Get just the obfuscated code into a file:

cp script.py output.py
lines=$(expr $(wc -l < output.py) + 4)
zsc -p python/simple_ascii -i output.py >> /dev/null
tail +$lines output.py | python -

pyminifier (Python only)

pyminifier -O --nonlatin INFILE.PY | grep -vi 'pyminifier' > OUTFILE.py