From 50247ee1e493d9ca27f7efc1db42a9563de9f7c8 Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Mon, 11 Aug 2025 04:11:36 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B8=85=E7=90=86=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E6=AD=BB=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除plugins/local/connector.go中未使用的GetCommonDirectories和GetSensitiveFiles函数 - 移除整个connector.go文件,因为其只包含死代码 - 通过deadcode工具验证,确保代码库整洁 --- Plugins/local/connector.go | 79 -------------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 Plugins/local/connector.go diff --git a/Plugins/local/connector.go b/Plugins/local/connector.go deleted file mode 100644 index 337315f..0000000 --- a/Plugins/local/connector.go +++ /dev/null @@ -1,79 +0,0 @@ -package local - -import ( - "os" - "runtime" - "path/filepath" -) - -// 本地插件实用工具函数 -// 由于移除了LocalConnector概念,这个文件现在包含实用的工具函数 - -// GetCommonDirectories 获取常见目录路径 - 实用工具函数 -func GetCommonDirectories() []string { - var dirs []string - - homeDir, _ := os.UserHomeDir() - - switch runtime.GOOS { - case "windows": - dirs = []string{ - homeDir, - filepath.Join(homeDir, "Desktop"), - filepath.Join(homeDir, "Documents"), - filepath.Join(homeDir, "Downloads"), - "C:\\Users\\Public\\Documents", - "C:\\Users\\Public\\Desktop", - "C:\\Program Files", - "C:\\Program Files (x86)", - } - case "linux", "darwin": - dirs = []string{ - homeDir, - filepath.Join(homeDir, "Desktop"), - filepath.Join(homeDir, "Documents"), - filepath.Join(homeDir, "Downloads"), - "/opt", - "/usr/local", - "/var/www", - "/var/log", - } - } - - return dirs -} - -// GetSensitiveFiles 获取敏感文件路径 - 实用工具函数 -func GetSensitiveFiles() []string { - var files []string - - homeDir, _ := os.UserHomeDir() - - switch runtime.GOOS { - case "windows": - files = []string{ - "C:\\boot.ini", - "C:\\windows\\system32\\inetsrv\\MetaBase.xml", - "C:\\windows\\repair\\sam", - "C:\\windows\\system32\\config\\sam", - filepath.Join(homeDir, "AppData", "Local", "Google", "Chrome", "User Data", "Default", "Login Data"), - filepath.Join(homeDir, "AppData", "Local", "Microsoft", "Edge", "User Data", "Default", "Login Data"), - filepath.Join(homeDir, "AppData", "Roaming", "Mozilla", "Firefox", "Profiles"), - } - case "linux", "darwin": - files = []string{ - "/etc/passwd", - "/etc/shadow", - "/etc/hosts", - "/etc/ssh/ssh_config", - "/root/.ssh/id_rsa", - "/root/.ssh/authorized_keys", - "/root/.bash_history", - filepath.Join(homeDir, ".ssh/id_rsa"), - filepath.Join(homeDir, ".ssh/authorized_keys"), - filepath.Join(homeDir, ".bash_history"), - } - } - - return files -} \ No newline at end of file