Skip to content

Commit 3c40e5b

Browse files
committed
fix: 修复一个很nc的bug,格式化错误
1 parent 277c6b5 commit 3c40e5b

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/analyzer/request-analyzer.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,22 @@ class RequestAnalyzer {
5050
if (typeof unsafeWindow[param.value] !== "function") {
5151
// 如果都没有对应的全局函数存在的话,则直接判定为0分
5252
return 0;
53+
}
54+
let jsonpScore = 100;
5355

54-
let jsonpScore = 100;
55-
56-
// 判断参数中的jsonp参数特征,参数名
57-
const paramName = param.name.toLowerCase();
58-
if (paramName.indexOf("callback") !== -1) {
59-
jsonpScore += 10;
60-
}
61-
62-
// 参数值,寻找时间戳特征
63-
const timestampRegexp = /\b(\d{10}|\d{13})\b/g;
64-
const match = timestampRegexp.exec(param.value);
65-
if (match && this.isValidJsonpTimestamp(match)) {
66-
jsonpScore += 50;
67-
}
56+
// 判断参数中的jsonp参数特征,参数名
57+
const paramName = param.name.toLowerCase();
58+
if (paramName.indexOf("callback") !== -1) {
59+
jsonpScore += 10;
60+
}
6861

69-
return jsonpScore;
62+
// 参数值,寻找时间戳特征
63+
const match = new RegExp(/(\d{13}|\d{10})/).exec(param.value);
64+
if (match && this.isValidJsonpTimestamp(match[0])) {
65+
jsonpScore += 50;
7066
}
67+
68+
return jsonpScore;
7169
}
7270

7371
/**

src/hook/script-hook.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class ScriptHook {
3434
const requestContext = RequestContext.parseRequestContext(newSrc);
3535
const scriptContext = new ScriptContext(newSrc, requestContext, null);
3636

37-
debugger;
3837
const requestAnalyzer = new RequestAnalyzer();
3938
requestAnalyzer.analyze(requestContext);
4039

0 commit comments

Comments
 (0)