This commit is contained in:
sickle committed 2025-01-17 01:54:21 +08:00
1 parent b01f1824c7
commit 5306c6af79
4 files changed
+4 -40

No files matched your search

+3
View File
@@ -132,6 +132,9 @@
- 更改三方库的匹配规则
- 增加更多的过滤集
- 修复js搜集出错的bug
### 2025-01-17
- 修改域名匹配,域名获取更加精准
- 移除hash的匹配
---
**雪瞳——洞悉无形,守护无界。**
-5
View File
@@ -275,11 +275,6 @@ const SCANNER_CONFIG = {
URL: /(?:https?|wss?|ftp):\/\/(?:(?:[\w-]+\.)+[a-z]{2,}|(?:\d{1,3}\.){3}\d{1,3})(?::\d{2,5})?(?:\/[^\s'"]*)?/gi,
JWT: /(?:ey[A-Za-z0-9_-]{10,}\.[A-Za-z0-9._-]{10,}|ey[A-Za-z0-9_\/+-]{10,}\.[A-Za-z0-9._\/+-]{10,})/g,
AWS_KEY: /AKIA[0-9A-Z]{16}/g,
HASH: {
MD5: /[a-f0-9]{32}/gi,
SHA1: /[a-f0-9]{40}/gi,
SHA256: /[a-f0-9]{64}/gi
}
}
};
+1 -20
View File
@@ -28,11 +28,6 @@ const latestResults = {
jsFiles: new Set(), // JS文件结果集
vueFiles: new Set(), // Vue 文件结果集
urls: new Set(), // URL 结果集
hashes: { // 哈希结果集
md5: new Set(),
sha1: new Set(),
sha256: new Set()
}
};
// 优化扫描函数
@@ -99,23 +94,9 @@ function scanSources(sources, isHtmlContent = false) {
// 对大文本进行分块处理
for (const chunk of splitIntoChunks(source)) {
// 处理哈希模式
for (const [hashType, hashPattern] of Object.entries(SCANNER_CONFIG.PATTERNS.HASH)) {
try {
const pattern = new RegExp(hashPattern.source, hashPattern.flags.includes('g') ? hashPattern.flags : hashPattern.flags + 'g');
for (const match of getAllMatches(chunk, pattern)) {
if (SCANNER_FILTER.hash[hashType.toLowerCase()](match, latestResults)) {
hasNewResults = true;
}
}
} catch (e) {
console.error('Error processing hash pattern:', hashType, e);
}
}
// 处理其他模式
for (const [key, pattern] of Object.entries(SCANNER_CONFIG.PATTERNS)) {
if (key === 'HASH' || key === 'DOMAIN_FILTER' || key === 'DOMAIN_RESOURCE') continue;
if (key === 'DOMAIN_FILTER' || key === 'DOMAIN_RESOURCE') continue;
try {
const regex = new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g');
-15
View File
@@ -223,21 +223,6 @@ const SCANNER_FILTER = {
aws_key: (match, resultsSet) => {
resultsSet?.awsKeys?.add(match);
return true;
},
hash: {
md5: (match, resultsSet) => {
resultsSet?.hashes?.md5?.add(match);
return true;
},
sha1: (match, resultsSet) => {
resultsSet?.hashes?.sha1?.add(match);
return true;
},
sha256: (match, resultsSet) => {
resultsSet?.hashes?.sha256?.add(match);
return true;
}
}
};