Are there any python libraries that can safely interpret obfusticated javascript strings? -
i want able de-obfusticate javascript strings in python javascript code maybe malicious. there libraries available this?
i started build own realised bigger undertaking first realised. not have safely map javascript string functions python ones (including regex), i'd have deal arrays, loops, variables relevant loop, etc.
edit: here's example of mean
str1 = 'sdfhsjkdfhidhgjkdfngjkdfhgjkdfpdhfgkdfjuhdfjkghdfkgjtdfhgjkdfgf'; str2 = str1.replace(/[a-z]/g, '');
str2 should equal "input"
and here's example:
arr = ['-', 'm', '1', 'a', 'a', 'l', 's', 'i', 'r', 'c', 'f', 'i', '#', 'o', '[', 'u', '$', 's']; str = "" (i=1; i<arr.length; i+=2) { str = str + arr[i]; }
str should "malicious"
a option jsbeautifier, can handle free obfuscators (actually, obfuscator know). there option eval
javascript using rhino, it's blacklisted default (being unsafe).
disclosure: coauthored jsbeautifier, wrote python deobfuscation architecture. way, if find js jsbeautifier cannot handle, consider opening issue on project bugtracker :)
Comments
Post a Comment