fix: 外部审查 8 项修复 + 国密 TLS 按需回退
测试构建 / 代码检查 (push) Has been cancelled
测试构建 / 单元测试和构建 (push) Has been cancelled
测试构建 / 构建验证 (push) Has been cancelled

- UserAgent 默认值回退 + 注册 -ua flag (#2)
- README 编译命令 main.go → . (#3)
- README 版本号同步 rc.1 (#4)
- Client.go gmtls stdout 劫持删除 (#5)
- ms17010 smb1GetResponse size<32 越界 panic (#6)
- SSH 拨号超时统一 ModuleTimeout (#8)
- AddPorts 死字段删除 (#9)
- 国密 TLS 按需回退:标准 TLS 握手失败时仅在错误为
  cipher/protocol 不兼容时尝试国密,跳过超时/拒绝等连接级错误
This commit is contained in:
ZacharyZcR
2026-06-15 04:46:25 +08:00
parent 2f7d2d49c6
commit 6eff1d5ccf
13 changed files with 75 additions and 43 deletions
+1
View File
@@ -137,6 +137,7 @@ func Flag(Info *HostInfo) error {
flag.StringVar(&fv.TargetURL, "u", "", i18n.GetText("flag_target_url"))
flag.StringVar(&fv.URLsFile, "uf", "", i18n.GetText("flag_urls_file"))
flag.StringVar(&fv.Cookie, "cookie", "", i18n.GetText("flag_cookie"))
flag.StringVar(&fv.UserAgent, "ua", "", i18n.GetText("flag_user_agent"))
flag.Int64Var(&fv.WebTimeout, "wt", 5, i18n.GetText("flag_web_timeout"))
flag.IntVar(&fv.MaxRedirects, "max-redirect", 10, i18n.GetText("flag_max_redirects"))
flag.StringVar(&fv.HTTPProxy, "proxy", "", i18n.GetText("flag_http_proxy"))
+9 -2
View File
@@ -27,7 +27,6 @@ type FlagVars struct {
ExcludeHostsFile string
Ports string
ExcludePorts string
AddPorts string
HostsFile string
PortsFile string
@@ -226,7 +225,7 @@ func BuildConfigFromFlags(fv *FlagVars) *Config {
},
HTTP: HTTPConfig{
Cookie: fv.Cookie,
UserAgent: fv.UserAgent,
UserAgent: defaultUserAgent(fv.UserAgent),
Accept: fv.Accept,
},
LocalExploit: LocalExploitConfig{
@@ -246,3 +245,11 @@ func BuildConfigFromFlags(fv *FlagVars) *Config {
func isStdoutTerminal() bool {
return term.IsTerminal(int(os.Stdout.Fd()))
}
// defaultUserAgent 用户未通过 -ua 指定时回退到默认 UA,避免发送空 User-Agent 被 WAF 识别
func defaultUserAgent(ua string) string {
if ua != "" {
return ua
}
return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
}
+3 -2
View File
@@ -955,8 +955,9 @@ func TestBuildConfigFromFlags_BoundaryValues(t *testing.T) {
if cfg.HTTP.Cookie != "" {
t.Errorf("Cookie 应该为空")
}
if cfg.HTTP.UserAgent != "" {
t.Errorf("UserAgent 应该为空")
// 空输入回退到默认 UA,避免发送空 User-Agent
if cfg.HTTP.UserAgent == "" {
t.Errorf("UserAgent 空输入应回退到默认 UA")
}
},
},
+2
View File
@@ -64,6 +64,8 @@ flag_urls_file:
other: "URLs file"
flag_cookie:
other: "HTTP Cookie"
flag_user_agent:
other: "Custom User-Agent header"
flag_web_timeout:
other: "Web timeout"
flag_max_redirects:
+2
View File
@@ -64,6 +64,8 @@ flag_urls_file:
other: "URL文件"
flag_cookie:
other: "HTTP Cookie"
flag_user_agent:
other: "自定义 User-Agent 请求头"
flag_web_timeout:
other: "Web超时时间"
flag_max_redirects: