Created
April 15, 2011 16:04
-
-
Save davestevens/921949 to your computer and use it in GitHub Desktop.
Quick way to mangle variable names in a Perl script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# run with; | |
# perl perlObf.pl inputFile.pl > outpuFile.pl | |
use Digest::MD5 qw(md5_hex); | |
while( <> ) { | |
while(/([\$\%\@]#?)([A-Za-z]\w+)/gm) { | |
if($2 ne 'ARGV') { | |
$current = '\\'.$1.$2; $new = $1.'_'.md5_hex($2); | |
s/$current/$new/; | |
} | |
} | |
print; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment