This commit is contained in:
sickle committed 2025-01-16 13:28:44 +08:00
1 parent 9561684bad
commit 80ab399d7c
5 files changed
+19 -13

No files matched your search

+1
View File
@@ -131,6 +131,7 @@
- 新增模块路径,拆分细化API
- 更改三方库的匹配规则
- 增加更多的过滤集
- 修复js搜集出错的bug
---
**雪瞳——洞悉无形,守护无界。**
+6 -1
View File
@@ -27,10 +27,12 @@ const SCANNER_CONFIG = {
JS_PATTERN: /\.(js|jsx|ts|tsx)(?:\?[^'"]*)?$/i,
// 文档文件模式
DOC_PATTERN: /\.(pdf|doc|docx|xls|xlsx|ppt|exe|apk|zip|pptx|txt|md|csv)(?:\?[^'"]*)?$/i,
// css字体模式
FONT_PATTERN: /\.(ttf|eot|woff|woff2|otf|css)(?:\?[^'"]*)?$/i,
// 需要跳过的第三方JS库正则匹配规则
SKIP_JS_PATTERNS: [
// jQuery相关
/jquery(?:[.-]?\d*\.?\d*\.?\d*|-\d+\.\d+\.\d+|\.cookie)?(?:\.min)?\.js$/i,
/jquery(?:[.-]?\d*\.?\d*\.?\d*|-\d+\.\d+\.\d+|\.cookie)?(?:validate)?(?:\.blockui)?(?:\.min)?\.js$/i,
/(?:vue|vue-router|vuex)[.-]?\d*\.?\d*\.?\d*(?:\.min)?\.js$/i,
@@ -96,6 +98,9 @@ const SCANNER_CONFIG = {
'video/x-ms-asf',
'video/quicktime',
'js/lib',
'js/plugin',
'application/msword',
'application/vnd.ms-word.document.macroenabled.12',
'application/vnd.ms-word.template.macroenabled.12',
+6 -6
View File
@@ -17,17 +17,17 @@ const latestResults = {
domains: new Set(), // 域名结果集
apis: new Set(), // API 结果集
moduleFiles: new Set(), // 模块路径结果集
imageFiles: new Set(), // 音频图片结果集
jsFiles: new Set(), // JS文件结果集
docFiles: new Set(), // 文档文件结果集
vueFiles: new Set(), // Vue 文件结果集
ips: new Set(), // IP 地址结果集
phones: new Set(), // 手机号结果集
emails: new Set(), // 邮箱结果集
idcards: new Set(), // 身份证号结果集
urls: new Set(), // URL 结果集
jwts: new Set(), // JWT Token 结果集
awsKeys: new Set(), // AWS Access Key 结果集
imageFiles: new Set(), // 音频图片结果集
jsFiles: new Set(), // JS文件结果集
vueFiles: new Set(), // Vue 文件结果集
urls: new Set(), // URL 结果集
hashes: { // 哈希结果集
md5: new Set(),
sha1: new Set(),
@@ -266,10 +266,10 @@ async function collectAndScanResources() {
// 从页面内容匹配获取
const pageContent = document.documentElement.outerHTML;
const jsPattern = /(?:src|href)=['"]([^'"]+\.(?:js)(?:\?[^\s'"]*)?)['"]/g;
const jsPattern = /['"](?:[^'"]+\.(?:js)(?:\?[^\s'"]*)?)['"]/g;
const jsMatches = Array.from(pageContent.matchAll(jsPattern))
.map(match => {
const path = match[1];
const path = match[0].slice(1, -1);
try {
if (path.startsWith('http')) {
return path;
+5 -5
View File
@@ -6,8 +6,8 @@ const SCANNER_FILTER = {
// 去除首尾的引号
match = match.slice(1, -1);
//如果是css文件则丢弃
if (match.split("?")[0].endsWith('.css')) {
//如果是css字体文件则丢弃
if (SCANNER_CONFIG.API.FONT_PATTERN.test(match)) {
return true;
}
@@ -205,16 +205,17 @@ const SCANNER_FILTER = {
url: (match, resultsSet) => {
try {
resultsSet?.urls?.add(match);
// 解析URL
const url = new URL(match);
const currentHost = window.location.host;
// 检查是否是当前域名或IP
if (url.host === currentHost) {
// 获取路径部分
const path = url.pathname;
if (match.split("?")[0].endsWith('.css')) {
//如果是css字体文件则丢弃
if (SCANNER_CONFIG.API.FONT_PATTERN.test(match)) {
return true;
}
// 检查是否是图片文件
@@ -246,7 +247,6 @@ const SCANNER_FILTER = {
}
// 如果不是当前域名或解析失败,将完整URL添加到URL结果集
resultsSet?.urls?.add(match);
return true;
},
+1 -1
View File
@@ -63,7 +63,7 @@ function displayResults(results) {
{ id: 'idcard-list', data: results.idcards, title: '身份证号' },
{ id: 'jwt-list', data: results.jwts, title: 'JWT Token' },
{ id: 'aws-list', data: results.awsKeys, title: 'AWS Key' },
{ id: 'image-list', data: results.imageFiles, title: '图片资源' },
{ id: 'image-list', data: results.imageFiles, title: '音频图片' },
{ id: 'js-list', data: results.jsFiles, title: 'JS文件' },
{ id: 'vue-list', data: results.vueFiles, title: 'Vue文件' },
{ id: 'url-list', data: results.urls, title: 'URL' },