在Node.JS中调用JShaman接口,实现JS代码加密

2023-05-16

在Node.JS中调用JShaman接口,实现JS代码加密。

使用axios库实现https的post请求,代码如下:

const axios = require("axios");
const  jshamanConfig = {
    //源码
    "js_code": 'function get_copyright(){    var domain = "中文";    var from_year = 2017;    var copyright = "(c)" + from_year + "-" + (new Date).getFullYear() + "," + domain;    return copyright;}console.log(get_copyright());',
    //vip码
    "vip_code": "free",
};
axios.post("https://www.jshaman.com:4430/submit_js_code", jshamanConfig).then(function (res) {
    if (res.status == 200) {
        if (res.data && res.data.status == 0) {
            console.log("----请求成功----");
            console.log(res.data.content)
        } else {
            console.error(res.data.message);
        }
    } else {
        console.error(res.status);
    }
    }).catch(function (error) {
    console.error(error);
    }
);

运行后,得到了加密的JS代码,如下图:

上面,使用的是JShaman的免费接口,如同在官网使用免费加密效果一样:

如要配置参数,则需写入自己在JShaman的VIP码,带参数可启用更多保护选项,加密效果会更好。

代码如下:

const axios = require("axios");
const  jshamanConfig = {
	//源码
	"js_code": 'function get_copyright(){    var domain = "中文";    var from_year = 2017;    var copyright = "(c)" + from_year + "-" + (new Date).getFullYear() + "," + domain;    return copyright;}console.log(get_copyright());',
	"config":{
		// 压缩
		"compact": true,
		//平展控制流
		"controlFlowFlattening": true,
		//僵尸代码
		"deadCodeInjection": true,
		//字符串阵列化
		"stringArray": true,
		//字符串加密
		"stringArrayEncoding": true,
		//禁用命令行输出
		"disableConsoleOutput": false,
		//反浏览器调试
		"debugProtection": true,
		//时间限定
		"time_range": false,
		"time_start": "",
		"time_end": "",
		// 域名锁定
		"domainLock": [],
		// 保留字
		"reservedNames": []
	},
	//JShaman vip码
	"vip_code": "vip码",
};
axios.post("https://www.jshaman.com:4430/submit_js_code", jshamanConfig).then(function (res) {
	if (res.status == 200) {
		if (res.data && res.data.status == 0) {
			console.log("----请求成功----");
			console.log(res.data.content)
		} else {
			console.error(res.data.message);
		}
	} else {
		console.error(res.status);
	}
	}).catch(function (error) {
	console.error(error);
	}
);

运行效果:

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在Node.JS中调用JShaman接口,实现JS代码加密 的相关文章

随机推荐