Created
February 2, 2011 07:30
-
-
Save capotej/807367 to your computer and use it in GitHub Desktop.
the opposite of
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
| require 'erb' | |
| src = File.read(ARGV[0]) | |
| data_segment = src.split(/(;)/).first | |
| code_segment = src.split(/(;)/)[1..-1].join | |
| data_segment.match(/var (_0x\w*{4})=/) | |
| holder_var = $1 | |
| $strings_arr = eval(data_segment.split('=').last) | |
| regex = Regexp.new("#{holder_var}\\[(\\d{1,2})\\]") | |
| prepared_erb = code_segment.gsub(regex, "\"<%=convert(\\1)%>\"") | |
| def convert(i) | |
| $strings_arr[i] | |
| end | |
| replaced_src = ERB.new(prepared_erb).result.sub(';','') | |
| puts replaced_src | |
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
| // original source | |
| // | |
| // var a="Hello World!"; | |
| // function MsgBox(msg) | |
| // { | |
| // alert(msg+"\n"+a); | |
| // } | |
| // MsgBox("OK"); | |
| //obfuscated with http://www.javascriptobfuscator.com/default.aspx | |
| var _0x70aa=["\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x21","\x0A","\x4F\x4B"];var a=_0x70aa[0];function MsgBox(_0xd4fcx3){alert(_0xd4fcx3+_0x70aa[1]+a);} ;MsgBox(_0x70aa[2]); |
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
| //output of ruby deobfuscator.rb example.js > output.js | |
| var a="Hello World!";function MsgBox(_0xd4fcx3){alert(_0xd4fcx3+" | |
| "+a);} ;MsgBox("OK"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment