diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..11a611b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# 统一换行符为 LF +* text=auto eol=lf diff --git a/README.md b/README.md index 5b8e78f..6c28e9c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ 内网综合扫描工具,一键自动化漏扫。 -**版本**: 2.1.1 | **官网**: https://fscan.club/ +**版本**: 2.1.1 ## 功能特性 diff --git a/README_EN.md b/README_EN.md index e7ad008..b5213b5 100644 --- a/README_EN.md +++ b/README_EN.md @@ -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 diff --git a/common/i18n/i18n.go b/common/i18n/i18n.go index 4397e5e..9bc89e3 100644 --- a/common/i18n/i18n.go +++ b/common/i18n/i18n.go @@ -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 diff --git a/core/portfinger/match_engine_test.go b/core/portfinger/match_engine_test.go index 9066957..e8185fd 100644 --- a/core/portfinger/match_engine_test.go +++ b/core/portfinger/match_engine_test.go @@ -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字节级匹配应成功") } }