最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網 會員登陸 & 注冊

javascript-obfuscator 混淆代碼

2023-03-03 02:28 作者:灼_眼の夏_娜  | 我要投稿

// index.json

{

? ? "compact": false,

? ? "controlFlowFlattening": true,

? ? "controlFlowFlatteningThreshold": 1,

? ? "numbersToExpressions": true,

? ? "simplify": true,

? ? "shuffleStringArray": true,

? ? "splitStrings": true,

? ? "stringArrayThreshold": 1

}

// index.js

// 檢索的相對文件夾

const relativePath = './js'

// 不需要混淆的js或文件夾

const exitFile = ['jquery-3.6.1.min.js']

?

?

var fs = require('fs')

var process = require('child_process');

var readDir = fs.readdirSync(relativePath);

?

?

// 需要存在的js

const czFile = []

?

var filePath = relativePath

var arr = new Array()

readFile(readDir, filePath)

// 讀取相對路徑下的所有文件

function readFile(readDir, filePath) {

? ? if (readDir.length > 0) {

? ? ? ? for (var i = 0; i < readDir.length; i++) {

? ? ? ? ? ? scannerFile(readDir[i], filePath)

? ? ? ? }

? ? }

}

// 掃描文件進行檢索出js文件進行混淆

function scannerFile(file, filePath) {

? ? console.log("file-----" + file);

? ? var readdirpath = ""

? ? if (filePath == './') {

? ? ? ? readdirpath = filePath + file

? ? } else {

? ? ? ? readdirpath = filePath + "/" + file

? ? }

? ? if (exitFile.indexOf(file) < 0) {

? ? ? ? console.log('-->Start entering FS');

? ? ? ? fs.stat(readdirpath, (err, data) => {

? ? ? ? ? ? if (err) {

? ? ? ? ? ? ? ? console.log(err);

? ? ? ? ? ? } else {

? ? ? ? ? ? ? ? if (data.isDirectory()) {

? ? ? ? ? ? ? ? ? ? console.log('-->isDirectory:' + file);

? ? ? ? ? ? ? ? ? ? var readChildDir = fs.readdirSync(readdirpath);

? ? ? ? ? ? ? ? ? ? console.log(readChildDir);

? ? ? ? ? ? ? ? ? ? readFile(readChildDir, readdirpath)

? ? ? ? ? ? ? ? } else {

? ? ? ? ? ? ? ? ? ? console.log('-->isNotDirectory:' + file);

? ? ? ? ? ? ? ? ? ? if (file.indexOf('.js') >= 0 && file.indexOf('.json') < 0) {

? ? ? ? ? ? ? ? ? ? ? ? // 開始混淆代碼

? ? ? ? ? ? ? ? ? ? ? ? console.log('-->Start confusing code:' + file);

? ? ? ? ? ? ? ? ? ? ? ? var cmd = ' javascript-obfuscator ' + readdirpath + ' --config index.json --output ' + readdirpath;

? ? ? ? ? ? ? ? ? ? ? ? process.exec(cmd, function(error, stdout, stderr) {

? ? ? ? ? ? ? ? ? ? ? ? ? ? console.log("error:" + error);

? ? ? ? ? ? ? ? ? ? ? ? ? ? console.log("stdout:" + stdout);

? ? ? ? ? ? ? ? ? ? ? ? ? ? console.log("stderr:" + stderr);

? ? ? ? ? ? ? ? ? ? ? ? });

? ? ? ? ? ? ? ? ? ? ? ? arr.push(readdirpath)

? ? ? ? ? ? ? ? ? ? } else {

? ? ? ? ? ? ? ? ? ? ? ? console.log('Non-folder - Non-js code :' + file);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? })

?

? ? } else {

? ? ? ? console.log('-->skip------------');

? ? }

}

使用方式:


javascript-obfuscator 混淆代碼的評論 (共 條)

分享到微博請遵守國家法律
乐东| 手机| 南宫市| 杂多县| 泽普县| 独山县| 嘉义县| 密山市| 密云县| 台东市| 阿鲁科尔沁旗| 岳西县| 水城县| 广宁县| 胶南市| 安徽省| 临海市| 东宁县| 永德县| 安远县| 镇雄县| 中西区| 贵州省| 浠水县| 青川县| 濉溪县| 宁明县| 九江市| 凌云县| 东兴市| 延长县| 白玉县| 枣庄市| 防城港市| 绥江县| 册亨县| 漯河市| 大竹县| 定襄县| 周宁县| 凤城市|