fix lint issues before merge

This commit is contained in:
ZacharyZcR
2026-05-18 17:59:00 +08:00
parent 5942d3bbcb
commit 5a884ca6ad
7 changed files with 17 additions and 13 deletions
+2 -2
View File
@@ -421,10 +421,10 @@ func matchFold(a, b string) bool {
// 格式: addr service [Product:xxx ||Version:xxx] Banner:(xxx) // 格式: addr service [Product:xxx ||Version:xxx] Banner:(xxx)
func buildServiceLogMessage(addr string, serviceInfo *ServiceInfo, isWeb bool) string { func buildServiceLogMessage(addr string, serviceInfo *ServiceInfo, isWeb bool) string {
var msg strings.Builder var msg strings.Builder
msg.WriteString(fmt.Sprintf("%-21s", addr)) fmt.Fprintf(&msg, "%-21s", addr)
if serviceInfo.Name != "unknown" { if serviceInfo.Name != "unknown" {
msg.WriteString(fmt.Sprintf(" %-8s", serviceInfo.Name)) fmt.Fprintf(&msg, " %-8s", serviceInfo.Name)
} }
// 构建 [Product:xxx ||Version:xxx] 格式 // 构建 [Product:xxx ||Version:xxx] 格式
+3 -3
View File
@@ -58,7 +58,7 @@ func (p *CleanerPlugin) cleanFiles(output *strings.Builder, dir string, names []
for _, name := range names { for _, name := range names {
path := filepath.Join(dir, name) path := filepath.Join(dir, name)
if err := os.Remove(path); err == nil { if err := os.Remove(path); err == nil {
output.WriteString(fmt.Sprintf("[清理] %s\n", path)) fmt.Fprintf(output, "[清理] %s\n", path)
cleaned++ cleaned++
} }
} }
@@ -70,7 +70,7 @@ func (p *CleanerPlugin) cleanGlob(output *strings.Builder, dir, pattern string)
cleaned := 0 cleaned := 0
for _, f := range matches { for _, f := range matches {
if err := os.Remove(f); err == nil { if err := os.Remove(f); err == nil {
output.WriteString(fmt.Sprintf("[清理] %s\n", f)) fmt.Fprintf(output, "[清理] %s\n", f)
cleaned++ cleaned++
} }
} }
@@ -87,7 +87,7 @@ func (p *CleanerPlugin) cleanUnix(output *strings.Builder) int {
} }
for _, hf := range histFiles { for _, hf := range histFiles {
if p.scrubHistory(hf) { if p.scrubHistory(hf) {
output.WriteString(fmt.Sprintf("[清理] %s 中的 fscan 记录\n", hf)) fmt.Fprintf(output, "[清理] %s 中的 fscan 记录\n", hf)
cleaned++ cleaned++
} }
} }
+1 -1
View File
@@ -229,7 +229,7 @@ func (p *ActiveMQPlugin) identifyService(ctx context.Context, info *common.HostI
return &ScanResult{ return &ScanResult{
Success: false, Success: false,
Service: "activemq", Service: "activemq",
Error: fmt.Errorf("Failed to read response: %w", err), Error: fmt.Errorf("failed to read response: %w", err),
} }
} }
if n == 0 { if n == 0 {
+3 -2
View File
@@ -169,9 +169,10 @@ var cqlStreamID int16
func cqlSend(conn net.Conn, opcode byte, body []byte) error { func cqlSend(conn net.Conn, opcode byte, body []byte) error {
id := cqlStreamID id := cqlStreamID
cqlStreamID++ if cqlStreamID == 32767 {
if cqlStreamID > 32767 {
cqlStreamID = 0 cqlStreamID = 0
} else {
cqlStreamID++
} }
// frame: [1B version|flags] [2B stream] [1B opcode] [4B length] [body] // frame: [1B version|flags] [2B stream] [1B opcode] [4B length] [body]
-1
View File
@@ -323,7 +323,6 @@ func mssqlParseLoginTokens(payload []byte, result *mssqlRawResult) (bool, error)
return false, fmt.Errorf("mssql: truncated done token") return false, fmt.Errorf("mssql: truncated done token")
} }
status := binary.LittleEndian.Uint16(payload[pos : pos+2]) status := binary.LittleEndian.Uint16(payload[pos : pos+2])
pos += 12
return status&(tdsDoneError|tdsDoneSrvError) == 0, nil return status&(tdsDoneError|tdsDoneSrvError) == 0, nil
default: default:
return false, fmt.Errorf("mssql: unexpected login token 0x%02x", token) return false, fmt.Errorf("mssql: unexpected login token 0x%02x", token)
+7 -3
View File
@@ -341,8 +341,13 @@ func (s *oracleSession) putString(v string) {
func (s *oracleSession) putInt(v interface{}, size uint8, bigEndian, compress bool) { func (s *oracleSession) putInt(v interface{}, size uint8, bigEndian, compress bool) {
num := toInt64(v) num := toInt64(v)
if compress { if compress {
neg := num < 0
encoded := uint64(num)
if neg {
encoded = uint64(-(num + 1)) + 1
}
temp := make([]byte, 8) temp := make([]byte, 8)
binary.BigEndian.PutUint64(temp, uint64(num)) binary.BigEndian.PutUint64(temp, encoded)
temp = bytes.TrimLeft(temp, "\x00") temp = bytes.TrimLeft(temp, "\x00")
if size > uint8(len(temp)) { if size > uint8(len(temp)) {
size = uint8(len(temp)) size = uint8(len(temp))
@@ -351,8 +356,7 @@ func (s *oracleSession) putInt(v interface{}, size uint8, bigEndian, compress bo
s.out.WriteByte(0) s.out.WriteByte(0)
return return
} }
if num < 0 { if neg {
num = -num
size |= 0x80 size |= 0x80
} }
s.out.WriteByte(size) s.out.WriteByte(size)
+1 -1
View File
@@ -243,7 +243,7 @@ func (p *WebTitlePlugin) formatHeaders(headers http.Header) string {
var builder strings.Builder var builder strings.Builder
for name, values := range headers { for name, values := range headers {
for _, value := range values { for _, value := range values {
builder.WriteString(fmt.Sprintf("%s: %s\n", name, value)) fmt.Fprintf(&builder, "%s: %s\n", name, value)
} }
} }
return builder.String() return builder.String()