源码如下,保存为html即可直接使用。
免费版:
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
</head>
<body>
<h2>混淆加密JS代码,防止分析、复制、盗用</h2>
<input type="button" value="调用JShaman.com接口,混淆加密JS代码" onclick="common_example()" style="font-size: 30px;"><br>
<br>
<script>
function common_example(){
$.ajax({
url: "http://www.jshaman.com:800/submit_js_code/",
dataType: "json",
data : {
//JS代码
"js_code": `
function get_copyright(){
var domain = "jshaman.com";
var from_year = 2017;
var copyright = "(c)" + from_year + "-" + (new Date).getFullYear() + "," + domain;
return copyright;
}
console.log(get_copyright());
`,
//VIP码
"vip_code": "free"
},
method: "POST",
}).done(function (res) {
//返回结果
if(res.status == 0){
document.getElementById("common_code_result").innerHTML = res.content;
}else{
alert(res.message)
}
}).fail(function(){
alert("发生了未知错误!");
});
}
</script>
<div id="common_code_result" style="font-size: 9px;">
function get_copyright(){<br>
var domain = "jshaman.com";<br>
var from_year = 2017;<br>
var copyright = "(c)" + from_year + "-" + (new Date).getFullYear() + "," + domain;<br>
return copyright;<br>
}<br>
console.log(get_copyright());<br>
</div>
</body>
</html>
免费版能配置参数,下面是购买VIP后的版本,可自定义加密参数:
<html>标签:function,domain,code,加密,copyright,get,JS,源码,var From: https://blog.51cto.com/jsjiami/5992440
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
</head>
<body>
<h2>混淆加密JS代码,防止分析、复制、盗用</h2>
<input type="button" value="调用JShaman.com接口,混淆加密JS代码" onclick="common_example()" style="font-size: 30px;"><br>
<br>
<script>
function common_example(){
//参数配置
var common_config = {
//压缩
"compact": true,
//平展控制流
"controlFlowFlattening": true,
//字符串阵列化
"stringArray": true,
//字符串加密
"stringArrayEncoding": true,
//禁用命令行输出
"disableConsoleOutput": true,
//反浏览器调试
"debugProtection": true,
//时间限定
"time_range":false,
//域名锁定
"domainLock": [],
//保留字
"reservedNames": []
}
$.ajax({
url: "http://www.jshaman.com:800/submit_js_code/",
dataType: "json",
data : {
//JS代码
"js_code": `
function get_copyright(){
var domain = "jshaman.com";
var from_year = 2017;
var copyright = "(c)" + from_year + "-" + (new Date).getFullYear() + "," + domain;
return copyright;
}
console.log(get_copyright());
`,
//参数
"config": common_config,
//VIP码
"vip_code": "js9v-ux7a-xnbf"
},
method: "POST",
}).done(function (res) {
//返回结果
if(res.status == 0){
document.getElementById("common_code_result").innerHTML = res.content;
}else{
alert(res.message)
}
}).fail(function(){
alert("发生了未知错误!");
});
}
</script>
<div id="common_code_result" style="font-size: 9px;">
function get_copyright(){<br>
var domain = "jshaman.com";<br>
var from_year = 2017;<br>
var copyright = "(c)" + from_year + "-" + (new Date).getFullYear() + "," + domain;<br>
return copyright;<br>
}<br>
console.log(get_copyright());<br>
</div>
</body>
</html>