fix(portfinger): 修复SMB2服务指纹识别和NetInfo输出问题

- 添加SMB2ProgNeg探针支持现代Windows的SMB2协议
- 修复Go regexp对高位字节的UTF-8兼容问题,使用Latin-1转换
- 修复探针失败后连接重建逻辑
- 修复vendor_product字段名不匹配问题
- 修复NetInfo多行输出被其他日志打断的问题
This commit is contained in:
ZacharyZcR
2026-01-20 16:10:57 +08:00
parent b86f39d2cc
commit d624d84a86
7 changed files with 98 additions and 18 deletions
+16 -3
View File
@@ -2,6 +2,7 @@ package logging
import (
"fmt"
"strings"
"sync"
"time"
@@ -116,10 +117,22 @@ func (l *Logger) log(level LogLevel, content string) {
// 格式化消息:保留前缀,去掉时间戳
prefix := l.getLevelPrefix(level)
logMsg := fmt.Sprintf("%s %s", prefix, content)
// 输出消息
l.outputMessage(level, logMsg)
// 处理多行内容:给每行加上前缀,然后作为一个整体输出
if strings.Contains(content, "\n") {
lines := strings.Split(content, "\n")
var formattedLines []string
for _, line := range lines {
if line != "" {
formattedLines = append(formattedLines, fmt.Sprintf("%s %s", prefix, line))
}
}
logMsg := strings.Join(formattedLines, "\n")
l.outputMessage(level, logMsg)
} else {
logMsg := fmt.Sprintf("%s %s", prefix, content)
l.outputMessage(level, logMsg)
}
// 根据慢速输出设置决定是否添加延迟
if l.config.SlowOutput {