JS代码反混淆步骤

1、待解码的JS特征

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c-

-){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}

('p 1Y=0;p 1K=0;p 21=0;p 4t=1x;p R=1Q["\\6\\u\\9\\6\\b\\j\\c\\
...

\\a\\e\\j\\6";2P

(2J)}})})};',62,296,'||||||x65|||x74|x61|x6E|x69|x72|x6C|x63||x6F|x64|x73|x70|x67|x68|x75|x6D|var|x79|x54||x62|x78|x76||||x45|x6B|x43|if|document|x53|_0x14abx25|x31|

x49|x66|x50|x42|x41|x22|localStorage|x4E|x23|function|bPage|x4C|_0x14abx11|x4F|x46|x77|x5F|x3A|x30|x2D|x39||x3D|x20|_0x14abx5c|_0x14abx4b|_0x14abx2e|true|x33|_0x14ab

x5e|x55|_0x14abx46|_0x14abx3d|x44|x26|Number|this|_0x14abx4a|_0x14abx22|return|x2F|_0x14abx4f|_0x14abx2c|x52|x2E|_0x14abx2b|_0x14abx10|x36|_0x14abx4c|x57|_0x14abx34|

x4D|false|for|_0x14abx40|break|newSpan|_0x14abx6|x32|x3F|_0x14abx16|_0x14abx5f|_0x14abx59|_0x14abx7|_0x14abx9|weight|x5B|_0x14abx18|_0x14abx8|_0x14abx29|else|chrome|

x5D|x2C|_0x14abx6d|window|new|value|_0x14abx60|price|_0x14abx5d|extractNumber|shipping_fee|_0x14abx2f|_0x14abx57|x2B|case|x5C|_0x14abx3a|_0x14abx1d|newA|_0x14abx44|r

adius|_0x14abx63|x28|x38|x29|uFFE5|_0x14abx37|_0x14abx38|_0x14abx36|_0x14abx17|_0x14abx15|u91CD|updateTable|_0x14abx14|_0x14abx39|_0x14abx31|u8BF7|u53F7|u5355|JSON|u

8F93|u5165|_0x14abx52|x7A|_0x14abx51|x71|angle|_0x14abx35|_0x14abx23|Math|_0x14abx61|_0x14abx24|_0x14abx64|_0x14abx27|_0x14abx6e|0625|primary|icons|RegExp|collapsibl

e|coudanclicked|_0x14abxf|_0x14abxd|_0x14abxc|insertTableItem|_0x14abxe|_0x14abxb|event|null|_0x14abx49|_0x14abx1c|_0x14abx53|loading|uFF1A|_0x14abx55|_0x14abx5a||he

ader|clearStyle|_0x14abx20|active|_0x14abx65|restoreNotifySettings|x3C|_0x14abx28|_0x14abx32|x37|_0x14abx68|u6CE8|_0x14abx1a|checked|x51|_0x14abx3e|_0x14abx30|action

|u4FE1|pattern|_0x14abx45|_0x14abx33|x3E|u5907|_0x14abx56|_0x14abx58|returnTab|u606F|_0x14abx50|insertCompany|insertOverAllPrice|url|60|defaultValue|with|id|x34|_0x1

4abx62|_0x14abx66|UI|restorePackageRecord|u65B0|alert|u8FD0|uFF0C|_0x14abx48|x7D|setInterval|package|2739619|x35|getMinFee|show|20462262|x58|Object|type|removeTableI

tem|switch|package_JSON|hide|searchClicked|Array|res|carrierChanged|cls|_0x14abx13|50|x7C|x56|0283495231|x2A|extractWeight|45359237|compute|_0x14abx42|_0x14abx43|add

Clicked|u4EF7|CheckIntervalChanged|u683C|encodeURIComponent|circleLineWidth|x5A|tabid|badded|init1|find_amazon_discounts|u672A|NotifySettingChanged|u77E5|x48|switchT

ab|u590D|u91CF|x24|default|x7B|u8BEF|u8D39|uFF01|u78C5|u9519|u90AE'.split('|'),0,{}))

2、解码函数

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c-

-){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}

('p 1Y=0;p 1K=0;p 21=0;p 4t=1x;p R=1Q

便捷的解码工具:http://box.inote.cc/

3、解码后的JS

var price = 0;
var weight = 0;
var shipping_fee = 0;
var badded = false;
var bPage = chrome["\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E"]["\x67\x65\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65"]();
function compute(_0x14abx6) {
    if (_0x14abx6 == "\x6F\x75\x6E\x63\x65\x73\x54\x65\x78\x74") {
        var _0x14abx7 = $("\x23\x6F\x75\x6E\x63\x65\x73\x54\x65\x78\x74")["\x76\x61\x6C"]();
      
...

变量经过混淆,将就着看

chrome["\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E"]["\x67\x65\x74\x42\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x50\x61\x67\x65"]();
string>byte[] 然后进行\x转义


4、对字符串进行处理


简单的HEXSTR解码工具,网上大把:

public class HexUtil
{
    private static String HexCode[] =
    {
        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
        "A", "B", "C", "D", "E", "F"
    };
   
    /**
     * 将单个字节转成Hex String
     * @param b   字节
     * @return String Hex String
     */
    public static String byte2HexStr(byte b)
    {
        int n = b;
        if (n < 0)
        {
            n = 256 + n;
        }
        int d1 = n / 16;
        int d2 = n % 16;
        return HexCode[d1] + HexCode[d2];
    }
   
    /**
     * 将字节数组转成Hex String
     * @param b
     * @return String
     */
    public static String bytes2HexStr(byte[] b)
    {
        if(b==null || b.length==0)
        {
            return null;
        }
        StringBuffer strBuf = new StringBuffer();
        for(int i=0; i<b.length; i++)
        {
            strBuf.append(byte2HexStr(b[i]));
        }
        return strBuf.toString();
    }
   
    /**
     * 将单个hex Str转换成字节
     * @param str
     * @return byte
     */
    public static byte hexStr2Byte(String str)
    {
        byte ret = 0;
        for(byte i=0;i<HexCode.length;i++)
        {
            if(HexCode[i].equalsIgnoreCase(str))
            {
                return i;
            }
        }  
        return ret;
    }
   
    /**
     * 将hex Str转换成字节数组
     * @param str
     * @return byte[]
     */
    public static byte[] hexStr2Bytes(String str)
    {
        if(str==null || str.equals(""))
        { 
            byte bArray[]=new byte[0];
            return bArray;
        }  
       
        byte[] bytes = new byte[str.length()/2];
        for(int i=0;i<bytes.length;i++)
        {
            String high = str.substring(i*2,i*2+1);
            String low = str.substring(i*2+1,i*2+2);
            bytes[i] = (byte) (hexStr2Byte(high)*16 + hexStr2Byte(low));
//            if(bytes[i]==0x0d || bytes[i]==0x0a){
//             bytes[i]=' ';
//            }
        }
        return bytes;
    }

    /**
     * 将hex Str转换成字节数组,处理回车换行
     * @param str
     * @return byte[]
     */
    public static byte[] hexStr2Bytes2(String str)
    {
        if(str==null || str.equals(""))
        { 
            byte bArray[]=new byte[0];
            return bArray;
        }  
       
        byte[] bytes = new byte[str.length()/2];
        for(int i=0;i<bytes.length;i++)
        {
            String high = str.substring(i*2,i*2+1);
            String low = str.substring(i*2+1,i*2+2);
            bytes[i] = (byte) (hexStr2Byte(high)*16 + hexStr2Byte(low));
            if(bytes[i]==0x0d || bytes[i]==0x0a){
             bytes[i]=' ';
            }
        }
        return bytes;
    }
   
 public static String byte2hex(byte[] b) {
  
  String hs = "";
  
  String stmp = "";
  
  for (int n = 0; n < b.length; n++) {
   
   stmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
   
   if (stmp.length() == 1)
    
    hs = hs + "0" + stmp;
   
   else
    
    hs = hs + stmp;
   
  }
  
  return hs.toUpperCase();
  
 }
 
 
 
 public static byte[] hex2byte(byte[] b) {
  
  if((b.length%2)!=0)
   
   throw new IllegalArgumentException("长度不是偶数");
  
  byte[] b2 = new byte[b.length/2];
  
  for (int n = 0; n < b.length; n+=2) {
   
   String item = new String(b,n,2);
   
   b2[n/2] = (byte)Integer.parseInt(item,16);
   
  }
  
  return b2;
 }
 
 public static byte[] hexStr2byte(String b) {
  
  if((b.length()%2)!=0)
   
   throw new IllegalArgumentException("长度不是偶数");
  
  byte[] b2 = new byte[b.length()/2];
  
  for (int n = 0; n < b.length(); n+=2) {
   
   String item =b.substring(n, n+2);
   
   b2[n/2] = (byte)Integer.parseInt(item,16);
   
  }
  
  return b2;
 }
 
 public static void main(String[] args) {
 
 
  System.out.println(new String(hexStr2Bytes("66616C7365")));

  
 }
}

5、中文解码
格式:\uXXXX\uXXXX

VB版本的解码函数,懒得换成JAVA的了

http://download.csdn.net/detail/cutemouse/4263917

 

6、代码美化等工具

http://tool.chinaz.com/js.aspx

 

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页