mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-09-14 05:56:46 +08:00

- 简化本地插件架构,移除不必要的连接器抽象 - 重构6个本地插件使用统一的简化架构 - 更新平台支持配置:Windows专用插件(avdetect/dcinfo/minidump),跨平台插件(fileinfo/reverseshell/socks5proxy) - 修复插件注册和系统集成 - 优化代码结构和错误处理
79 lines
1.9 KiB
Go
79 lines
1.9 KiB
Go
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
|
||
} |