mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-24 20:21:52 +08:00
fix: 修复6个运行时问题
1. 抑制 gmtls 库的 handshake error stdout 噪声 gmtls/conn.go:1304 硬编码了 fmt.Println,在调用时临时重定向 os.Stdout 2. MySQL 3306 服务名误识别为 genetec-5400 nmap 指纹库将 MySQL 握手包的随机 salt 误匹配,通过 banner 特征校正 3. 管道输出时自动禁用 ANSI 控制码 检测 stdout 是否为终端,非终端时自动启用 NoColor 4. 进度条完成消息措辞精确化 去掉冗余冒号,保持信息简洁一致 5. URL 模式跳过不必要的 TLS 探测 用户已通过 -u 显式指定 http:// 协议时直接使用,不再做 TLS 握手 6. 无网络探测数据时降低默认重试次数 -np 跳过存活探测后,将默认重试从 3 降到 2,加速不可达主机的超时
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/shadow1ng/fscan/common/config"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -195,7 +197,7 @@ func BuildConfigFromFlags(fv *FlagVars) *Config {
|
||||
File: fv.Outputfile,
|
||||
Format: fv.OutputFormat,
|
||||
DisableSave: fv.DisableSave,
|
||||
NoColor: fv.NoColor,
|
||||
NoColor: fv.NoColor || !isStdoutTerminal(),
|
||||
Silent: fv.Silent,
|
||||
DisableProgress: fv.DisableProgress,
|
||||
ShowProgress: !fv.DisableProgress,
|
||||
@@ -237,3 +239,7 @@ func BuildConfigFromFlags(fv *FlagVars) *Config {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func isStdoutTerminal() bool {
|
||||
return term.IsTerminal(int(os.Stdout.Fd()))
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ scan_alive_hosts_list:
|
||||
progress_scanning_description:
|
||||
other: "Scanning Progress"
|
||||
progress_scan_completed:
|
||||
other: "Scan Completed:"
|
||||
other: "Scan Completed"
|
||||
progress_waiting:
|
||||
other: "waiting..."
|
||||
progress_done:
|
||||
|
||||
@@ -198,7 +198,7 @@ scan_alive_hosts_list:
|
||||
progress_scanning_description:
|
||||
other: "扫描进度"
|
||||
progress_scan_completed:
|
||||
other: "扫描完成:"
|
||||
other: "扫描完成"
|
||||
progress_waiting:
|
||||
other: "等待中..."
|
||||
progress_done:
|
||||
|
||||
@@ -321,12 +321,13 @@ func (pm *ProgressManager) showCompletionInfo() {
|
||||
completionMsg := i18n.GetText("progress_scan_completed")
|
||||
doneMsg := i18n.GetText("progress_done")
|
||||
durationMsg := i18n.GetText("progress_duration")
|
||||
total := pm.total.Load()
|
||||
if pm.noColor {
|
||||
fmt.Printf("[%s] %s %d/%d (%s: %s)\n",
|
||||
doneMsg, completionMsg, pm.total.Load(), pm.total.Load(), durationMsg, formatDuration(elapsed))
|
||||
fmt.Printf("[%s] %s: %d/%d (%s: %s)\n",
|
||||
doneMsg, completionMsg, total, total, durationMsg, formatDuration(elapsed))
|
||||
} else {
|
||||
fmt.Printf("%s[%s] %s %d/%d%s %s(%s: %s)%s\n",
|
||||
AnsiGreen, doneMsg, completionMsg, pm.total.Load(), pm.total.Load(), AnsiReset,
|
||||
fmt.Printf("%s[%s] %s: %d/%d%s %s(%s: %s)%s\n",
|
||||
AnsiGreen, doneMsg, completionMsg, total, total, AnsiReset,
|
||||
AnsiGray, durationMsg, formatDuration(elapsed), AnsiReset)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user