diff --git a/README.md b/README.md index eeb50d4..2a1d775 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,8 @@ - 划分url,提取github链接 - 完善邮箱匹配,减少邮箱误匹配 - 新增公司机构检测 - +### 2025-01-21 +- 删除冗余代码,修复一些显示错误 --- **雪瞳——洞悉无形,守护无界。** \ No newline at end of file diff --git a/background/background.js b/background/background.js index b2a2498..e8defe5 100644 --- a/background/background.js +++ b/background/background.js @@ -1,44 +1,24 @@ -// 域名验证规则 -const DOMAIN_RULES = { - // 常见的误报关键词 - invalidKeywords: [ - // JavaScript 关键字和内置对象 - 'prototype', 'constructor', 'function', 'object', 'array', 'string', - 'number', 'boolean', 'error', 'date', 'regexp', 'promise', 'proxy', - 'class', 'super', 'this', 'window', 'document', 'global', 'process', - 'require', 'module', 'exports', 'define', 'import', 'export', - 'default', 'return', 'yield', 'async', 'await', 'static', 'get', 'set', - - // DOM 相关 - 'event', 'element', 'node', 'style', 'color', 'font', 'text', 'size', - 'width', 'height', 'scroll', 'click', 'mouse', 'key', 'touch', 'focus', - 'blur', 'load', 'unload', 'ready', 'change', 'submit', 'reset', 'select', - - // 常见属性和方法名 - 'data', 'type', 'name', 'value', 'index', 'count', 'length', 'size', - 'key', 'keys', 'item', 'items', 'list', 'array', 'map', 'set', - 'detail', 'time', 'date', 'path', 'file', 'files', 'image', 'audio', - 'video', 'media', 'source', 'target', 'parent', 'child', 'root' - ] -}; - // 更新扩展图标的badge function updateBadge(results) { // 计算有内容的类别数量 const categories = [ results.domains, + results.absoluteApis, results.apis, - results.staticFiles, + results.moduleFiles, + results.docFiles, results.ips, results.phones, results.emails, results.idcards, - results.urls, results.jwts, results.awsKeys, - results.hashes?.md5, - results.hashes?.sha1, - results.hashes?.sha256 + results.imageFiles, + results.jsFiles, + results.vueFiles, + results.urls, + results.githubUrls, + results.companies, ]; const nonEmptyCategories = categories.filter(category => diff --git a/content/config/scanner.config.js b/content/config/scanner.config.js index 3eba20d..c258623 100644 --- a/content/config/scanner.config.js +++ b/content/config/scanner.config.js @@ -1,25 +1,5 @@ // 统一的扫描器配置 const SCANNER_CONFIG = { - // 白名单配置 - WHITELIST: [ - 'github.com', - '360.net', - 'bing.com', - 'csdn.net', - 'bilibili.com', - 'google.com', - 'youtube.com', - 'microsoft.com', - 'apple.com', - 'mozilla.org', - 'aliyun.com', - 'feishu.cn', - 'mklab.cn', - 'cnnvd.org.cn', - 'qq.com', - 'baidu.com' - ], - // API 相关配置 API: { PATTERN: /['"`](?:\/|\.\.\/|\.\/)[^\/\>\< \)\(\}\,\'\"\\](?:[^\^\>\< \)\(\{\}\,\'\"\\])*?['"`]|['"`][a-zA_Z0-9]+(?\< \)\(\{\}\,\'\"\\])*?["'`]/g, diff --git a/content/content.js b/content/content.js index 88aa147..65aaec4 100644 --- a/content/content.js +++ b/content/content.js @@ -45,14 +45,7 @@ function scanSources(sources, isHtmlContent = false) { const results = {}; // 处理普通结果 for (const key in latestResults) { - if (key !== 'hashes') { results[key] = Array.from(latestResults[key]); - } - } - // 单独处理哈希结果 - results.hashes = {}; - for (const hashType in latestResults.hashes) { - results.hashes[hashType] = Array.from(latestResults.hashes[hashType]); } // 发送扫描结果更新 @@ -153,7 +146,7 @@ function scanSources(sources, isHtmlContent = false) { // 检查域名是否在白名单中 function isInWhitelist(hostname) { - return SCANNER_CONFIG.WHITELIST.some(domain => { + return SCANNER_CONFIG.DOMAIN.WHITELIST.some(domain => { // 完全匹配或者是子域名 return hostname === domain || hostname.endsWith('.' + domain); }); @@ -174,13 +167,7 @@ async function initScan() { // 清空之前的结果 Object.keys(latestResults).forEach(key => { - if (key === 'hashes') { - Object.keys(latestResults.hashes).forEach(hashType => { - latestResults.hashes[hashType].clear(); - }); - } else { latestResults[key].clear(); - } }); // 立即开始扫描HTML内容 @@ -361,7 +348,7 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { // 只返回白名单配置 sendResponse({ config: { - WHITELIST: SCANNER_CONFIG.WHITELIST + WHITELIST: SCANNER_CONFIG.DOMAIN.WHITELIST } }); } diff --git a/popup/highlight.css b/popup/highlight.css index 14180fb..086ae14 100644 --- a/popup/highlight.css +++ b/popup/highlight.css @@ -418,18 +418,6 @@ body { background: #ff6b6b; /* 红色 - AWS Key */ } -.hash-md5-list .item::before { - background: #20c997; /* 青色 - MD5哈希 */ -} - -.hash-sha1-list .item::before { - background: #51cf66; /* 绿色 - SHA1哈希 */ -} - -.hash-sha256-list .item::before { - background: #82c91e; /* 黄绿色 - SHA256哈希 */ -} - .company-list .item::before { background: #845ef7; /* 紫色 - 机构公司 */ }