Created
November 12, 2010 04:05
-
-
Save mando/673711 to your computer and use it in GitHub Desktop.
This file contains 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
def obfuscate (str, passes) | |
while passes > 0 | |
lines = str.split() | |
percent = Random.new.rand(15..20) | |
line_count = int(percent / lines.length) | |
lines_end = lines.length - line_count | |
line_num = Random.new.rand(1..lines_end) | |
lbegin = line_num | |
uend = line_num + line_count | |
until line_num = lines_end | |
newlines.push(lines[line_num]) | |
++line_num | |
end | |
startlabel = "open_" + passes | |
endlabel = "close_" + passes | |
lines.push(endlabel + ":") | |
newlines.each do |entry| | |
lines.push(entry) | |
end | |
lines.push("jmp " + startlabel) | |
lines[lbegin] = "jmp " + endlabel; | |
++lbegin | |
lines[lbegin] = startlabel + ":" | |
++lbegin | |
lines.slice(lbegin..uend) | |
--passes | |
lines.each do |e| | |
nstr = e + "\n" | |
end | |
obfuscate(nstr, passes) | |
end | |
return nstr | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment