mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-09-14 14:06:44 +08:00
chore: 清理未使用的死代码
- 删除plugins/local/connector.go中未使用的GetCommonDirectories和GetSensitiveFiles函数 - 移除整个connector.go文件,因为其只包含死代码 - 通过deadcode工具验证,确保代码库整洁
This commit is contained in:
parent
a86098d6b6
commit
50247ee1e4
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user