mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
fix: 修复 i18n.Tr vet 报错、Unicode 测试用例,移除过期域名
- 移除 i18n.Tr 中错误的 fmt.Sprintf fallback,消除 go vet 误报 - 修复 match_engine_test Unicode 测试用例与 Latin-1 转换逻辑不匹配 - README 移除过期的 fscan.club 域名 - 添加 .gitattributes 统一换行符为 LF
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# 统一换行符为 LF
|
||||
* text=auto eol=lf
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
内网综合扫描工具,一键自动化漏扫。
|
||||
|
||||
**版本**: 2.1.1 | **官网**: https://fscan.club/
|
||||
**版本**: 2.1.1
|
||||
|
||||
## 功能特性
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
Comprehensive intranet scanning tool for automated vulnerability assessment.
|
||||
|
||||
**Version**: 2.1.1 | **Website**: https://fscan.club/
|
||||
**Version**: 2.1.1
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
@@ -83,10 +83,6 @@ func Tr(key string, args ...interface{}) string {
|
||||
TemplateData: data,
|
||||
})
|
||||
if err != nil || msg == "" {
|
||||
// 回退:尝试用fmt.Sprintf格式化key本身
|
||||
if len(args) > 0 {
|
||||
return fmt.Sprintf(key, args...)
|
||||
}
|
||||
return key
|
||||
}
|
||||
return msg
|
||||
|
||||
@@ -355,18 +355,19 @@ func TestMatchPattern_BinaryData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestMatchPattern_UnicodeResponse 测试Unicode响应
|
||||
// TestMatchPattern_UnicodeResponse 测试Latin-1转换后的字节级匹配
|
||||
func TestMatchPattern_UnicodeResponse(t *testing.T) {
|
||||
compiled, _ := regexp.Compile(`服务器`)
|
||||
// bytesToLatin1String 按字节逐个映射到 Latin-1 码点
|
||||
// UTF-8 多字节字符会被拆开,所以用字节级正则匹配
|
||||
raw := []byte("HTTP/1.1 200 OK\r\nServer: test-srv\r\n")
|
||||
compiled, _ := regexp.Compile(`test-srv`)
|
||||
|
||||
m := &Match{
|
||||
PatternCompiled: compiled,
|
||||
}
|
||||
|
||||
response := []byte("HTTP/1.1 200 OK\r\nServer: 服务器\r\n")
|
||||
|
||||
result := m.MatchPattern(response)
|
||||
result := m.MatchPattern(raw)
|
||||
if !result {
|
||||
t.Error("Unicode内容应被匹配")
|
||||
t.Error("Latin-1字节级匹配应成功")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user