使用cdn版本vue开发的h5网页如何进行混淆加密保护源码?
网友回复
可以将HTML放到template中,然后混淆,例如:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1-dev.js"></script>
</head>
<body>
<div id="app"></div>
<script>
new Vue({
el: '#app',
template: `
<div>
<h1>{{ message }}</h1>
<button @click="changeMessage">Change Message</button>
</div>
`,
data: {
message: 'Hello, Vue!'
},
methods: {
changeMessage() {
this.message = 'Hello, World!';
}
}
});
</script>
</body>
</html>
我们把js部分复制出来,然后打开这个在线工具,对js代码进行混淆点击打开链接
这是混淆后的html源码,还可设置允许打开的域名
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1-dev.js"></script>
</head>
<body>
<div id="app"></div>
<script>
function _0x2e9e(_0x266987, _0x59faad) {
var _0x2e9ea6 = _0x59fa();
return _0x2e9e = function (_0x375a4e, _0x350f1a) {
_0x375a4e = _0x375a4e - (-0x1a0a + 0x52 * 0x57 + -0x3f);
var _0xecbf66 = _0x2e9ea6[_0x375a4e];
return _0xecbf66;
}, _0x2e9e(_0x266987, _0x59faad);
}
var _0x508791 = _0x2e9e;
function _0x59fa() {
var _0x5b5991 = [
'nction()\x20',
'ZqgQR',
'1171490miWrio',
'1190679rIAPmb',
'e)\x20{}',
'OjVxx',
'Tjywp',
'QEuuj',
'debu',
'ctor(\x22retu',
'utton\x20@cli',
'counter',
'hange\x20Mess',
'445923uOqIzE',
'n>\x0a\x20\x20\x20\x20\x20\x20\x20',
'KItqC',
'setInterva',
'VkJFO',
'div>\x0a\x20\x20\x20\x20\x20',
'SPhsd',
'init',
'oYlQG',
'aleQm',
'vggwd',
'\x20</div>\x0a\x20\x20',
'388416xQItcR',
'hONgy',
'fbgfR',
'Message\x22>C',
'{\x20message\x20',
'string',
'{}.constru',
'length',
'zaQbc',
'buzxp',
'BjnFk',
'\x20\x20\x20\x20\x20<h1>{',
'\x20\x20\x20\x20\x20\x20\x20\x20<b',
'fiSEA',
'3EnhxBf',
'GBmDd',
'Hello,\x20Wor',
'apply',
'uznIL',
'fJFdK',
'0-9a-zA-Z_',
'sVnwY',
'AhoME',
'stateObjec',
'message',
'test',
'qkfwn',
'\x20\x20\x20\x20',
'return\x20(fu',
'WGhyP',
'ck=\x22change',
'FRHDA',
'Hello,\x20Vue',
'while\x20(tru',
'SpfBq',
'vZoGh',
'}}</h1>\x0a\x20\x20',
'call',
'gger',
'EknSt',
'ZUkYo',
'\x5c(\x20*\x5c)',
'chain',
'#app',
'729336owAdht',
'age</butto',
'\x0a\x20\x20\x20\x20\x20\x20\x20\x20<',
'VWZnb',
'6IWuzRx',
'$]*)',
'a-zA-Z_$][',
'279334utvkfW',
'input',
'704356YNDwvp',
'mXROw',
'function\x20*',
'\x5c+\x5c+\x20*(?:[',
'ryFdd',
'rn\x20this\x22)(',
'BpJxx',
'action',
'lGIkG',
'ld!',
'constructo',
'OHQGd'
];
_0x59fa = function () {
return _0x5b5991;
};
return _0x59fa();
}
(function (_0x455a42, _0x39b041) {
var _0x4cabd7 = _0x2e9e, _0x53deed = _0x455a42();
while (!![]) {
try {
var _0x3605b5 = parseInt(_0x4cabd7(0x1af)) / (0xea * 0xb + ...
点击查看剩余70%