debug
This commit is contained in:
167
code/public/public/js/yueduqsbs.js
Normal file
167
code/public/public/js/yueduqsbs.js
Normal file
@@ -0,0 +1,167 @@
|
||||
function cleanMaliciousCode(decodedStr) {
|
||||
// 定义一系列的恶意代码和关键字
|
||||
const maliciousPatterns = [
|
||||
/eval\s*\(/gi, // 检测 eval
|
||||
/document\.location/gi, // 页面跳转
|
||||
/window\.location/gi, // 页面跳转
|
||||
/window\.location\.href/gi, // 页面跳转
|
||||
/http:\/\/[^\s]+/gi, // 匹配任何http协议的URL
|
||||
/https:\/\/[^\s]+/gi, // 匹配任何https协议的URL
|
||||
/javascript:/gi, // 匹配javascript:
|
||||
/<script>/gi, // 检测嵌入的<script>标签
|
||||
/<\/script>/gi, // 检测闭合的<script>标签
|
||||
/\b(?:[a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}\b/gi ,// 匹配任何域名,如 example.com
|
||||
/m.23wx.com/gi, // 检测闭合的<script>标签
|
||||
/23wx.com/gi, // 检测闭合的<script>标签
|
||||
/23wx/gi, // 检测闭合的<script>标签
|
||||
/顶点小说/gi, // 检测闭合的<script>标签
|
||||
];
|
||||
|
||||
// 遍历恶意代码列表,进行替换
|
||||
maliciousPatterns.forEach(pattern => {
|
||||
decodedStr = decodedStr.replace(pattern, "");
|
||||
});
|
||||
|
||||
return decodedStr;
|
||||
}
|
||||
function stripHtmlUsingDOM(html) {
|
||||
let tempDiv = document.createElement("div");
|
||||
tempDiv.innerHTML = html;
|
||||
return tempDiv.innerText || tempDiv.textContent;
|
||||
}
|
||||
var qsbs = {
|
||||
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||
|
||||
aa: function (input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
input = qsbs._utf8_encode(input);
|
||||
|
||||
while (i < input.length) {
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
if (isNaN(chr2)) {
|
||||
enc3 = enc4 = 64;
|
||||
} else if (isNaN(chr3)) {
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
|
||||
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
bb: function (input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
|
||||
while (i < input.length) {
|
||||
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
if (enc3 != 64) {
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
if (enc4 != 64) {
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
}
|
||||
|
||||
output = qsbs._utf8_decode(output);
|
||||
return output;
|
||||
},
|
||||
|
||||
bbb: function (input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
|
||||
while (i < input.length) {
|
||||
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
if (enc3 != 64) {
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
if (enc4 != 64) {
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
}
|
||||
|
||||
output = qsbs._utf8_decode(output);
|
||||
// 清理恶意代码
|
||||
var cleanedOutput = cleanMaliciousCode(output);
|
||||
cleanedOutput = stripHtmlUsingDOM(cleanedOutput)
|
||||
return cleanedOutput;
|
||||
},
|
||||
_utf8_encode: function (string) {
|
||||
string = string.replace(/\r\n/g, "\n");
|
||||
var utftext = "";
|
||||
for (var n = 0; n < string.length; n++) {
|
||||
var c = string.charCodeAt(n);
|
||||
if (c < 128) {
|
||||
utftext += String.fromCharCode(c);
|
||||
} else if ((c > 127) && (c < 2048)) {
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
} else {
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
}
|
||||
return utftext;
|
||||
},
|
||||
|
||||
_utf8_decode: function (utftext) {
|
||||
var string = "";
|
||||
var i = 0;
|
||||
var c = c1 = c2 = 0;
|
||||
|
||||
while (i < utftext.length) {
|
||||
c = utftext.charCodeAt(i);
|
||||
if (c < 128) {
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
} else if ((c > 191) && (c < 224)) {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||
i += 2;
|
||||
} else {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
c3 = utftext.charCodeAt(i + 2);
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
return string;
|
||||
}
|
||||
};
|
||||
@@ -31,6 +31,7 @@
|
||||
// } catch (err) { }
|
||||
// })();
|
||||
|
||||
|
||||
function isMobile() {
|
||||
return /Android|iPhone|iPad|iPod|Windows Phone/i.test(navigator.userAgent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user