70回答

3收藏

AST混淆实战:仿obfuscator混淆控制流平坦化

信息分享 信息分享 12905 人阅读 | 70 人回复 | 2021-01-19

混淆效果混淆前:window = {};
window.atob = function(r) {
    e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    var o = String(r).replace(/=+$/, "");
    if(o.length % 4 == 1) throw new t("'atob' failed: The string to be decoded is not correctly encoded.");
    for(var n, a, i = 0, c = 0, d = ""; a = o.charAt(c++); ~a && (n = i % 4 ? 64 * n + a : a, i++ % 4) ? d += String.fromCharCode(255 & n >> (-2 * i & 6)) : 0) a = e.indexOf(a);
    return d
}
window.btoa = function(r) {
    e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    for(var o, n, a = String(r), i = 0, c = e, d = ""; a.charAt(0 | i) || (c = "=", i % 1); d += c.charAt(63 & o >> 8 - i % 1 * 8)) {
        if(n = a.charCodeAt(i += .75), n > 255) throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
        o = o << 8 | n
    }
    return d
}混淆后:window = {};
window.atob = function (_0xc0750g) {
  var _0xfbb16d = "4|1|2|3|0"["split"]("|"),
      _0xec2868 = 0;
  while (!![]) {
    switch (_0xfbb16d[_0xec2868++]) {
      case "0":
        return _0xec4345;
        continue;
      case "1":
        var _0x1adc16 = String(_0xc0750g).replace(/=+$/, "");
        continue;
      case "2":
        if (_0x1adc16.length % 4 == 1) throw new t("'atob' failed: The string to be decoded is not correctly encoded.");
        continue;
      case "3":
        for (var _0xb342a5, _0x7ecb47, _0xc54a87 = 0, _0xa14d1g = 0, _0xec4345 = ""; _0x7ecb47 = _0x1adc16.charAt(_0xa14d1g++); ~_0x7ecb47 && (_0xb342a5 = _0xc54a87 % 4 ? 64 * _0xb342a5 + _0x7ecb47 : _0x7ecb47, _0xc54a87++ % 4) ? _0xec4345 += String.fromCharCode(255 & _0xb342a5 >> (-2 * _0xc54a87 & 6)) : 0) _0x7ecb47 = e.indexOf(_0x7ecb47);
        continue;
      case "4":
        e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
        continue;
    }
    break;
  }
};
window.btoa = function (_0xdc05f0) {
  var _0x39674c = "2|1|0"["split"]("|"),
      _0x902bcb = 0;
  while (!![]) {
    switch (_0x39674c[_0x902bcb++]) {
      case "0":
        return _0xde212b;
        continue;
      case "1":
        for (var _0xed1fcd, _0x33g15b, _0x5153cd = String(_0xdc05f0), _0xeea791 = 0, _0xc94d67 = e, _0xde212b = ""; _0x5153cd.charAt(0 | _0xeea791) || (_0xc94d67 = "=", _0xeea791 % 1); _0xde212b += _0xc94d67.charAt(63 & _0xed1fcd >> 8 - _0xeea791 % 1 * 8)) {
          var _0xcgcd3c = "0|1"["split"]("|"),
              _0x3922ce = 0;
          while (!![]) {
            switch (_0xcgcd3c[_0x3922ce++]) {
              case "0":
                if (_0x33g15b = _0x5153cd.charCodeAt(_0xeea791 += .75), _0x33g15b > 255) throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
                continue;
              case "1":
                _0xed1fcd = _0xed1fcd << 8 | _0x33g15b;
                continue;
            }
            break;
          }
        }
        continue;
      case "2":
        e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
        continue;
    }
    break;
  }
};
混淆后的代码,就是我们常见的obfuscator混淆代码。

github地址,欢迎star:




https://github.com/Tsaiboss/ControlFlow
分享到:
回复

使用道具 举报

回答|共 70 个

搬砖的手微微颤抖

发表于 2021-1-19 22:49:20 | 显示全部楼层

蔡老板tql,yyds
回复

使用道具 举报

harvey

发表于 2021-1-19 22:58:49 | 显示全部楼层

蔡老板!蔡老板!蔡老板!
回复

使用道具 举报

crab_left

发表于 2021-1-22 09:21:44 | 显示全部楼层

蔡老板tql, yyds
回复

使用道具 举报

mmm

发表于 2021-1-22 09:25:47 | 显示全部楼层

dddd
回复

使用道具 举报

harvey

发表于 2021-1-22 09:26:30 | 显示全部楼层

用下面顶一顶蔡老板
回复

使用道具 举报

Liberty

发表于 2021-1-22 09:48:18 | 显示全部楼层

蔡老板tql!
回复

使用道具 举报

冬晨夕阳

发表于 2021-1-22 14:58:01 | 显示全部楼层

能给个自己文章的修改权限吗
回复

使用道具 举报

qqqqq5000

发表于 2021-1-23 10:16:18 | 显示全部楼层

用下面顶一顶蔡老板
回复

使用道具 举报

zxbzxb180

发表于 2021-1-26 10:54:16 | 显示全部楼层

666
回复

使用道具 举报