演示代码如下,用JShaman对这段代码进行混淆加密:
function demo(){alert("hello www.jshaman.com");}demo();
一、通用版
1、配置选项:压缩代码 。
保护效果:
function demo(){alert('hellox20www.jshaman.com');}demo();
注:压缩代码会把多行代码去回车、换行等,压缩成一行 。后续代码为展示效果,不启用此选项 。
2、配置选项:平展控制流 。
保护效果:
function demo() {var _0x4a3b8e = {'XmPVw': function (_0x1355fc, _0x5c2d37) {return _0x1355fc(_0x5c2d37);}};_0x4a3b8e['XmPVw'](alert, 'hellox20www.jshaman.com');}demo();
3、配置选项:平展控制流、字符串阵列化 。
保护效果:
var _0x82e5 = ['nwrbW4FdJX4jWOBdTCoAW6JcSxv3pgdcKCoNsM3cPq','W6pcM8kOd8ov'];var _0x4590 = function (_0x82e5ae, _0x45902b) {_0x82e5ae = _0x82e5ae - 0x0;var _0x587e12 = _0x82e5[_0x82e5ae];if (_0x4590['XyqpMq'] === undefined) {var _0x26da87 = function (_0x1e1ad6) {var _0x274be3 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0xb0c2f9 = '';for (var _0x1912d0 = 0x0, _0x5c2960, _0x22b5f1, _0x28e8bc = 0x0; _0x22b5f1 = _0x1e1ad6['charAt'](_0x28e8bc++); ~_0x22b5f1 && (_0x5c2960 = _0x1912d0 % 0x4 ? _0x5c2960 * 0x40 + _0x22b5f1 : _0x22b5f1, _0x1912d0++ % 0x4) ? _0xb0c2f9 += String['fromCharCode'](0xff & _0x5c2960 >> (-0x2 * _0x1912d0 & 0x6)) : 0x0) {_0x22b5f1 = _0x274be3['indexOf'](_0x22b5f1);}return _0xb0c2f9;};var _0x16b0e0 = function (_0x609832, _0x5c0381) {var _0x18fd8d = [], _0x32615e = 0x0, _0x582ade, _0x55fd07 = '', _0x1f72ed = '';_0x609832 = _0x26da87(_0x609832);for (var _0x314140 = 0x0, _0x5dadb9 = _0x609832['length']; _0x314140 < _0x5dadb9; _0x314140++) {_0x1f72ed += '%' + ('00' + _0x609832['charCodeAt'](_0x314140)['toString'](0x10))['slice'](-0x2);}_0x609832 = decodeURIComponent(_0x1f72ed);var _0x24999f;for (_0x24999f = 0x0; _0x24999f < 0x100; _0x24999f++) {_0x18fd8d[_0x24999f] = _0x24999f;}for (_0x24999f = 0x0; _0x24999f < 0x100; _0x24999f++) {_0x32615e = (_0x32615e + _0x18fd8d[_0x24999f] + _0x5c0381['charCodeAt'](_0x24999f % _0x5c0381['length'])) % 0x100;_0x582ade = _0x18fd8d[_0x24999f];_0x18fd8d[_0x24999f] = _0x18fd8d[_0x32615e];_0x18fd8d[_0x32615e] = _0x582ade;}_0x24999f = 0x0;_0x32615e = 0x0;for (var _0x10c19b = 0x0; _0x10c19b < _0x609832['length']; _0x10c19b++) {_0x24999f = (_0x24999f + 0x1) % 0x100;_0x32615e = (_0x32615e + _0x18fd8d[_0x24999f]) % 0x100;_0x582ade = _0x18fd8d[_0x24999f];_0x18fd8d[_0x24999f] = _0x18fd8d[_0x32615e];_0x18fd8d[_0x32615e] = _0x582ade;_0x55fd07 += String['fromCharCode'](_0x609832['charCodeAt'](_0x10c19b) ^ _0x18fd8d[(_0x18fd8d[_0x24999f] + _0x18fd8d[_0x32615e]) % 0x100]);}return _0x55fd07;};_0x4590['NSBhHr'] = _0x16b0e0;_0x4590['voCAvk'] = {};_0x4590['XyqpMq'] = !![];}var _0x5f28ea = _0x82e5[0x0];var _0xd67353 = _0x82e5ae + _0x5f28ea;var _0x2a62d8 = _0x4590['voCAvk'][_0xd67353];if (_0x2a62d8 === undefined) {if (_0x4590['MBnVai'] === undefined) {_0x4590['MBnVai'] = !![];}_0x587e12 = _0x4590['NSBhHr'](_0x587e12, _0x45902b);_0x4590['voCAvk'][_0xd67353] = _0x587e12;} else {_0x587e12 = _0x2a62d8;}return _0x587e12;};function demo() {var _0x5dadb9 = function (_0x3dc225, _0x42a267, _0x13b98a, _0x11e5f6, _0x7b0b47) {return _0x4590(_0x3dc225 - 0x2a8, _0x13b98a);};var _0x12dd82 = function (_0x2fb53e, _0x921459, _0x1bcee7, _0x3f69f3, _0x2f7a79) {return _0x4590(_0x2fb53e - 0x2a8, _0x1bcee7);};var _0x18fd8d = { 'YswdY': _0x5dadb9(0x2a8, 0x2a9, '^oy&', 0x2a9, 0x2a7) };alert(_0x18fd8d[_0x12dd82(0x2a9, 0x2aa, 'nOhI', 0x2aa, 0x2a9)]);}demo();
4、配置选项:平展控制流、字符串阵列化、字符串加密 。
保护效果:
var _0x1d27 = ['AgvSBg8GD3D3lMPZAgfTyw4Uy29T'];var _0x18ef = function (_0x1d27d2, _0x18ef77) {_0x1d27d2 = _0x1d27d2 - 0x0;var _0x239a13 = _0x1d27[_0x1d27d2];if (_0x18ef['yqPBYS'] === undefined) {var _0x48eece = function (_0x33f95c) {var _0x526067 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x36f0f1 = '';for (var _0x2c72ea = 0x0, _0x39809e, _0xb8d60b, _0x7deb24 = 0x0; _0xb8d60b = _0x33f95c['charAt'](_0x7deb24++); ~_0xb8d60b && (_0x39809e = _0x2c72ea % 0x4 ? _0x39809e * 0x40 + _0xb8d60b : _0xb8d60b, _0x2c72ea++ % 0x4) ? _0x36f0f1 += String['fromCharCode'](0xff & _0x39809e >> (-0x2 * _0x2c72ea & 0x6)) : 0x0) {_0xb8d60b = _0x526067['indexOf'](_0xb8d60b);}return _0x36f0f1;};_0x18ef['uAegLo'] = function (_0x282f57) {var _0x4110f4 = _0x48eece(_0x282f57);var _0x4c9168 = [];for (var _0x46dd40 = 0x0, _0x3512bd = _0x4110f4['length']; _0x46dd40 < _0x3512bd; _0x46dd40++) {_0x4c9168 += '%' + ('00' + _0x4110f4['charCodeAt'](_0x46dd40)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4c9168);};_0x18ef['PNQUnC'] = {};_0x18ef['yqPBYS'] = !![];}var _0x3cff06 = _0x1d27[0x0];var _0x55c4f1 = _0x1d27d2 + _0x3cff06;var _0x4fac92 = _0x18ef['PNQUnC'][_0x55c4f1];if (_0x4fac92 === undefined) {_0x239a13 = _0x18ef['uAegLo'](_0x239a13);_0x18ef['PNQUnC'][_0x55c4f1] = _0x239a13;} else {_0x239a13 = _0x4fac92;}return _0x239a13;};var _0x239a = function (_0x1d27d2, _0x18ef77) {_0x1d27d2 = _0x1d27d2 - 0x0;var _0x239a13 = _0x1d27[_0x1d27d2];if (_0x239a['LehifA'] === undefined) {var _0x48eece = function (_0x526067) {var _0x36f0f1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x2c72ea = '';for (var _0x39809e = 0x0, _0xb8d60b, _0x7deb24, _0x282f57 = 0x0; _0x7deb24 = _0x526067['charAt'](_0x282f57++); ~_0x7deb24 && (_0xb8d60b = _0x39809e % 0x4 ? _0xb8d60b * 0x40 + _0x7deb24 : _0x7deb24, _0x39809e++ % 0x4) ? _0x2c72ea += String['fromCharCode'](0xff & _0xb8d60b >> (-0x2 * _0x39809e & 0x6)) : 0x0) {_0x7deb24 = _0x36f0f1['indexOf'](_0x7deb24);}return _0x2c72ea;};var _0x33f95c = function (_0x4110f4, _0x4c9168) {var _0x46dd40 = [], _0x3512bd = 0x0, _0x1a42fb, _0x21563a = '', _0x14c329 = '';_0x4110f4 = _0x48eece(_0x4110f4);for (var _0x51d4e6 = 0x0, _0x22faf8 = _0x4110f4['length']; _0x51d4e6 < _0x22faf8; _0x51d4e6++) {_0x14c329 += '%' + ('00' + _0x4110f4['charCodeAt'](_0x51d4e6)['toString'](0x10))['slice'](-0x2);}_0x4110f4 = decodeURIComponent(_0x14c329);var _0x1721e1;for (_0x1721e1 = 0x0; _0x1721e1 < 0x100; _0x1721e1++) {_0x46dd40[_0x1721e1] = _0x1721e1;}for (_0x1721e1 = 0x0; _0x1721e1 < 0x100; _0x1721e1++) {_0x3512bd = (_0x3512bd + _0x46dd40[_0x1721e1] + _0x4c9168['charCodeAt'](_0x1721e1 % _0x4c9168['length'])) % 0x100;_0x1a42fb = _0x46dd40[_0x1721e1];_0x46dd40[_0x1721e1] = _0x46dd40[_0x3512bd];_0x46dd40[_0x3512bd] = _0x1a42fb;}_0x1721e1 = 0x0;_0x3512bd = 0x0;for (var _0x5a26fa = 0x0; _0x5a26fa < _0x4110f4['length']; _0x5a26fa++) {_0x1721e1 = (_0x1721e1 + 0x1) % 0x100;_0x3512bd = (_0x3512bd + _0x46dd40[_0x1721e1]) % 0x100;_0x1a42fb = _0x46dd40[_0x1721e1];_0x46dd40[_0x1721e1] = _0x46dd40[_0x3512bd];_0x46dd40[_0x3512bd] = _0x1a42fb;_0x21563a += String['fromCharCode'](_0x4110f4['charCodeAt'](_0x5a26fa) ^ _0x46dd40[(_0x46dd40[_0x1721e1] + _0x46dd40[_0x3512bd]) % 0x100]);}return _0x21563a;};_0x239a['agvFal'] = _0x33f95c;_0x239a['faAojy'] = {};_0x239a['LehifA'] = !![];}var _0x3cff06 = _0x1d27[0x0];var _0x55c4f1 = _0x1d27d2 + _0x3cff06;var _0x4fac92 = _0x239a['faAojy'][_0x55c4f1];if (_0x4fac92 === undefined) {if (_0x239a['WNkuzT'] === undefined) {_0x239a['WNkuzT'] = !![];}_0x239a13 = _0x239a['agvFal'](_0x239a13, _0x18ef77);_0x239a['faAojy'][_0x55c4f1] = _0x239a13;} else {_0x239a13 = _0x4fac92;}return _0x239a13;};function demo() {var _0x282f57 = function (_0x2ff7bb, _0x1accfc, _0x81ea65, _0xc75723, _0x27134) {return _0x18ef(_0xc75723 - 0x1e6, _0x27134);};alert(_0x282f57(0x1e6, 0x1e5, 0x1e6, 0x1e6, 0x1e6));}demo();
推荐阅读
- 基于netty构建一个http服务
- 哪款代码对比工具比较好用?
- 这两个Python工具真香!修改代码不会影响运行
- 用无代码平台搭建请假流程
- 无限金币金手指代码,街机金手指无限钱特色
- Pythonic风格代码有什么好处?附12个代码实例
- css加载loading效果的片段
- Google公布程序员一天代码量!你猜对了么?
- 微软开放AI安全风险评估工具Counterfit源代码
- 教你一段代码实现批量重命名