现在简单的十六进制deob很简单,我很好奇是否有一个工具来重命名变量的用法。例如:
是否有一个工具可以从数组中获取变量名称,并在代码正文中重命名用法?
答案 0 :(得分:2)
使用本网站,大部分代码都可以格式化并可读:http://jsbeautifier.org/
然而,在顶部留下了一个巨大的数组,其中包含代码中使用的大多数变量/字符串。要在整个代码中插入其内容,您可以使用以下JavaScript来搜索和替换每个实例:
for (var i=0; i<keywords.length; i++) {
if (keywords[i].match(/^[a-zA-Z][a-zA-Z0-9_]*$/)) { // Could be a standalone variable
// Replace any instances the string is used in an array accessor ['x'] with a dot .x
code = code.replace(new RegExp('\\['+arrayName+'\\['+i+'\\]\\]','g'),'.'+keywords[i]);
}
// Insert as strings throughout code, escaping anything necessary
code = code.replace(new RegExp(arrayName+'\\['+i+'\\]','g'),'\''+
keywords[i].replace(/\\/g,'\\\\').replace(/\r/g,'\\r').replace(/\n/g,'\\n').replace(/'/g,'\\\'')+
'\'');
} console.log(code);
确保为该代码创建三个变量,arrayName
(一串'_0x67a5'
),keywords
(数组)和code
(代码后面的代码)数组)。为了准确地将代码包含在字符串中,我建议使用Notepad ++替换所有反斜杠,引号和换行符(使用扩展/正则表达式查找:\r\n
,替换为:\\r\\n\\\r\n
)。
这留下了一些以十六进制命名的变量,但它们都是特定函数的本地变量,并且更容易理解。结果可以在这里看到:http://pastebin.com/kQjz2T0P
答案 1 :(得分:1)
如果您使用python,请使用以下命令处理顶部的大数组:
import re
#first open the file and read into the variable 'text'
result = re.sub(r"\\x([0-9A-F]{2})", lambda m: chr(int(m.group(1), 16)), text)
答案 2 :(得分:0)
是。 String.replace(regex,function(found,selected))
方法。
h0=$('.de1').text();
h1=h0.split('$')[0].split('=')[1];
h2=h0.slice(h1.length+12);
eval('ar='+h1);
h3=h2.replace(/_0x67a5\[(\d*)\]/g,function(a,b){return '"'+ar[parseInt(b)]+'"'});
h4=h3.replace(/;(?!=['"])/g,';<br>').replace(/\\x(..)/g,function(a,b){return '&#x'+b+';'}).replace(/\\u(....)/g,function(a,b){return '&#x'+b+';'}).replace(/_0x(....)/g,function(a,b){return '&#x'+b+';'})
$('#abrpm').html(h4);
&#13;