mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-02-09 02:09:17 +08:00
feat: 优化域探测显示,调整Web扫描逻辑
This commit is contained in:
@@ -876,14 +876,15 @@ var (
|
||||
AddPasswords string // 原PassAdd
|
||||
|
||||
// 扫描配置
|
||||
ScanMode string // 原Scantype
|
||||
ThreadNum int // 原Threads
|
||||
UseSynScan bool
|
||||
Timeout int64 = 3
|
||||
LiveTop int
|
||||
DisablePing bool // 原NoPing
|
||||
UsePing bool // 原Ping
|
||||
Command string
|
||||
ScanMode string // 原Scantype
|
||||
ThreadNum int // 原Threads
|
||||
UseSynScan bool
|
||||
Timeout int64 = 3
|
||||
LiveTop int
|
||||
DisablePing bool // 原NoPing
|
||||
UsePing bool // 原Ping
|
||||
Command string
|
||||
SkipFingerprint bool
|
||||
|
||||
// 本地扫描配置
|
||||
LocalScan bool
|
||||
@@ -896,17 +897,14 @@ var (
|
||||
PortsFile string // 原PortFile
|
||||
|
||||
// Web配置
|
||||
TargetURL string // 原URL
|
||||
URLsFile string // 原UrlFile
|
||||
URLs []string // 原Urls
|
||||
WebTimeout int64 = 5
|
||||
HttpProxy string // 原Proxy
|
||||
Socks5Proxy string
|
||||
|
||||
// POC配置
|
||||
PocPath string
|
||||
Pocinfo PocInfo
|
||||
DisablePoc bool // 原NoPoc
|
||||
PocPath string
|
||||
Pocinfo PocInfo
|
||||
|
||||
// Redis配置
|
||||
RedisFile string
|
||||
|
||||
@@ -185,7 +185,6 @@ func Flag(Info *HostInfo) {
|
||||
" - Port: 端口扫描模式\n"+
|
||||
" - ICMP: ICMP存活探测\n"+
|
||||
" - Local: 本地信息收集\n\n"+
|
||||
" - UDP: UDP扫描模式\n\n"+
|
||||
"单个插件模式(小写):\n"+
|
||||
" Web类: web, fcgi\n"+
|
||||
" 数据库类: mysql, mssql, redis, mongodb, postgres, oracle, memcached\n"+
|
||||
@@ -199,9 +198,10 @@ func Flag(Info *HostInfo) {
|
||||
flag.BoolVar(&DisablePing, "np", false, "禁用主机存活探测")
|
||||
flag.BoolVar(&UsePing, "ping", false, "使用系统ping命令替代ICMP探测")
|
||||
flag.StringVar(&Command, "c", "", "指定要执行的系统命令(支持ssh和wmiexec)")
|
||||
flag.BoolVar(&SkipFingerprint, "skip", false, "跳过端口指纹识别")
|
||||
|
||||
// 本地扫描配置
|
||||
flag.BoolVar(&LocalScan, "local", false, "启用本地网段扫描模式")
|
||||
flag.BoolVar(&LocalScan, "local", false, "启用本地扫描模式")
|
||||
|
||||
// 文件配置
|
||||
flag.StringVar(&HostsFile, "hf", "", "从文件中读取目标主机列表")
|
||||
@@ -211,8 +211,6 @@ func Flag(Info *HostInfo) {
|
||||
flag.StringVar(&PortsFile, "portf", "", "从文件中读取端口列表")
|
||||
|
||||
// Web配置
|
||||
flag.StringVar(&TargetURL, "u", "", "指定目标URL")
|
||||
flag.StringVar(&URLsFile, "uf", "", "从文件中读取URL列表")
|
||||
flag.StringVar(&Cookie, "cookie", "", "设置HTTP请求Cookie")
|
||||
flag.Int64Var(&WebTimeout, "wt", 5, "设置Web请求超时时间(单位:秒)")
|
||||
flag.StringVar(&HttpProxy, "proxy", "", "设置HTTP代理服务器")
|
||||
@@ -221,7 +219,6 @@ func Flag(Info *HostInfo) {
|
||||
// POC配置
|
||||
flag.StringVar(&PocPath, "pocpath", "", "指定自定义POC文件路径")
|
||||
flag.StringVar(&Pocinfo.PocName, "pocname", "", "指定要使用的POC名称,如: -pocname weblogic")
|
||||
flag.BoolVar(&DisablePoc, "nopoc", false, "禁用Web漏洞POC扫描")
|
||||
flag.BoolVar(&PocFull, "full", false, "启用完整POC扫描(如测试shiro全部100个key)")
|
||||
flag.BoolVar(&DnsLog, "dns", false, "启用dnslog进行漏洞验证")
|
||||
flag.IntVar(&PocNum, "num", 20, "设置POC扫描并发数")
|
||||
@@ -248,7 +245,7 @@ func Flag(Info *HostInfo) {
|
||||
flag.BoolVar(&NoColor, "nocolor", false, "禁用彩色输出显示")
|
||||
flag.BoolVar(&JsonFormat, "json", false, "以JSON格式输出结果")
|
||||
flag.StringVar(&LogLevel, "log", LogLevelInfo, "日志输出级别(ALL/SUCCESS/ERROR/INFO/DEBUG)")
|
||||
flag.BoolVar(&NoProgress, "noprogress", false, "禁用进度条显示")
|
||||
flag.BoolVar(&NoProgress, "nopg", false, "禁用进度条显示")
|
||||
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
@@ -83,9 +83,17 @@ func formatLogMessage(entry *LogEntry) string {
|
||||
|
||||
// 修改 printLog 函数
|
||||
func printLog(entry *LogEntry) {
|
||||
if LogLevel != LogLevelAll &&
|
||||
entry.Level != LogLevel &&
|
||||
!(LogLevel == LogLevelInfo && (entry.Level == LogLevelInfo || entry.Level == LogLevelSuccess)) {
|
||||
// 默认情况(LogLevelInfo)下打印 INFO、SUCCESS、ERROR
|
||||
if LogLevel == LogLevelInfo {
|
||||
if entry.Level != LogLevelInfo &&
|
||||
entry.Level != LogLevelSuccess &&
|
||||
entry.Level != LogLevelError {
|
||||
return
|
||||
}
|
||||
} else if LogLevel == LogLevelDebug || LogLevel == LogLevelAll {
|
||||
// Debug或ALL模式打印所有日志
|
||||
} else if entry.Level != LogLevel {
|
||||
// 其他情况只打印指定等级的日志
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -114,40 +114,6 @@ func ParsePass(Info *HostInfo) error {
|
||||
LogInfo(fmt.Sprintf("加载有效哈希值: %d 个", validCount))
|
||||
}
|
||||
|
||||
// 处理直接指定的URL列表
|
||||
if TargetURL != "" {
|
||||
urls := strings.Split(TargetURL, ",")
|
||||
tmpUrls := make(map[string]struct{})
|
||||
for _, url := range urls {
|
||||
if url != "" {
|
||||
if _, ok := tmpUrls[url]; !ok {
|
||||
tmpUrls[url] = struct{}{}
|
||||
URLs = append(URLs, url)
|
||||
}
|
||||
}
|
||||
}
|
||||
LogInfo(fmt.Sprintf("加载URL: %d 个", len(URLs)))
|
||||
}
|
||||
|
||||
// 从文件加载URL列表
|
||||
if URLsFile != "" {
|
||||
urls, err := Readfile(URLsFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("读取URL文件失败: %v", err)
|
||||
}
|
||||
|
||||
tmpUrls := make(map[string]struct{})
|
||||
for _, url := range urls {
|
||||
if url != "" {
|
||||
if _, ok := tmpUrls[url]; !ok {
|
||||
tmpUrls[url] = struct{}{}
|
||||
URLs = append(URLs, url)
|
||||
}
|
||||
}
|
||||
}
|
||||
LogInfo(fmt.Sprintf("从文件加载URL: %d 个", len(urls)))
|
||||
}
|
||||
|
||||
// 从文件加载端口列表
|
||||
if PortsFile != "" {
|
||||
ports, err := Readfile(PortsFile)
|
||||
@@ -206,7 +172,7 @@ func Readfile(filename string) ([]string, error) {
|
||||
// ParseInput 解析和验证输入参数配置
|
||||
func ParseInput(Info *HostInfo) error {
|
||||
// 检查必要的目标参数
|
||||
if Info.Host == "" && HostsFile == "" && TargetURL == "" && URLsFile == "" {
|
||||
if Info.Host == "" && HostsFile == "" {
|
||||
LogError("未指定扫描目标")
|
||||
flag.Usage()
|
||||
return fmt.Errorf("必须指定扫描目标")
|
||||
|
||||
@@ -18,7 +18,7 @@ const (
|
||||
// 插件分类映射表 - 所有插件名使用小写
|
||||
var pluginGroups = map[string][]string{
|
||||
ModeAll: {
|
||||
"web", "fcgi", // web类
|
||||
"webtitle", "webpoc", "fcgi", // web类
|
||||
"mysql", "mssql", "redis", "mongodb", "postgres", // 数据库类
|
||||
"oracle", "memcached", "elasticsearch", "rabbitmq", "kafka", "activemq", "cassandra", "neo4j", // 数据库类
|
||||
"ftp", "ssh", "telnet", "smb", "rdp", "vnc", "netbios", "ldap", "smtp", "imap", "pop3", "snmp", "modbus", "rsync", // 服务类
|
||||
@@ -26,14 +26,14 @@ var pluginGroups = map[string][]string{
|
||||
"findnet", // 其他
|
||||
},
|
||||
ModeBasic: {
|
||||
"web", "ftp", "ssh", "smb", "findnet",
|
||||
"webtitle", "ftp", "ssh", "smb", "findnet",
|
||||
},
|
||||
ModeDatabase: {
|
||||
"mysql", "mssql", "redis", "mongodb",
|
||||
"postgres", "oracle", "memcached", "elasticsearch", "rabbitmq", "kafka", "activemq", "cassandra", "neo4j",
|
||||
},
|
||||
ModeWeb: {
|
||||
"web", "fcgi",
|
||||
"webtitle", "webpoc", "fcgi",
|
||||
},
|
||||
ModeService: {
|
||||
"ftp", "ssh", "telnet", "smb", "rdp", "vnc", "netbios", "ldap", "smtp", "imap", "pop3", "modbus", "rsync",
|
||||
|
||||
Reference in New Issue
Block a user