mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
fix lint issues before merge
This commit is contained in:
@@ -58,7 +58,7 @@ func (p *CleanerPlugin) cleanFiles(output *strings.Builder, dir string, names []
|
||||
for _, name := range names {
|
||||
path := filepath.Join(dir, name)
|
||||
if err := os.Remove(path); err == nil {
|
||||
output.WriteString(fmt.Sprintf("[清理] %s\n", path))
|
||||
fmt.Fprintf(output, "[清理] %s\n", path)
|
||||
cleaned++
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ func (p *CleanerPlugin) cleanGlob(output *strings.Builder, dir, pattern string)
|
||||
cleaned := 0
|
||||
for _, f := range matches {
|
||||
if err := os.Remove(f); err == nil {
|
||||
output.WriteString(fmt.Sprintf("[清理] %s\n", f))
|
||||
fmt.Fprintf(output, "[清理] %s\n", f)
|
||||
cleaned++
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func (p *CleanerPlugin) cleanUnix(output *strings.Builder) int {
|
||||
}
|
||||
for _, hf := range histFiles {
|
||||
if p.scrubHistory(hf) {
|
||||
output.WriteString(fmt.Sprintf("[清理] %s 中的 fscan 记录\n", hf))
|
||||
fmt.Fprintf(output, "[清理] %s 中的 fscan 记录\n", hf)
|
||||
cleaned++
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ func (p *ActiveMQPlugin) identifyService(ctx context.Context, info *common.HostI
|
||||
return &ScanResult{
|
||||
Success: false,
|
||||
Service: "activemq",
|
||||
Error: fmt.Errorf("Failed to read response: %w", err),
|
||||
Error: fmt.Errorf("failed to read response: %w", err),
|
||||
}
|
||||
}
|
||||
if n == 0 {
|
||||
|
||||
@@ -169,9 +169,10 @@ var cqlStreamID int16
|
||||
|
||||
func cqlSend(conn net.Conn, opcode byte, body []byte) error {
|
||||
id := cqlStreamID
|
||||
cqlStreamID++
|
||||
if cqlStreamID > 32767 {
|
||||
if cqlStreamID == 32767 {
|
||||
cqlStreamID = 0
|
||||
} else {
|
||||
cqlStreamID++
|
||||
}
|
||||
|
||||
// frame: [1B version|flags] [2B stream] [1B opcode] [4B length] [body]
|
||||
|
||||
@@ -323,7 +323,6 @@ func mssqlParseLoginTokens(payload []byte, result *mssqlRawResult) (bool, error)
|
||||
return false, fmt.Errorf("mssql: truncated done token")
|
||||
}
|
||||
status := binary.LittleEndian.Uint16(payload[pos : pos+2])
|
||||
pos += 12
|
||||
return status&(tdsDoneError|tdsDoneSrvError) == 0, nil
|
||||
default:
|
||||
return false, fmt.Errorf("mssql: unexpected login token 0x%02x", token)
|
||||
|
||||
@@ -341,8 +341,13 @@ func (s *oracleSession) putString(v string) {
|
||||
func (s *oracleSession) putInt(v interface{}, size uint8, bigEndian, compress bool) {
|
||||
num := toInt64(v)
|
||||
if compress {
|
||||
neg := num < 0
|
||||
encoded := uint64(num)
|
||||
if neg {
|
||||
encoded = uint64(-(num + 1)) + 1
|
||||
}
|
||||
temp := make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(temp, uint64(num))
|
||||
binary.BigEndian.PutUint64(temp, encoded)
|
||||
temp = bytes.TrimLeft(temp, "\x00")
|
||||
if 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)
|
||||
return
|
||||
}
|
||||
if num < 0 {
|
||||
num = -num
|
||||
if neg {
|
||||
size |= 0x80
|
||||
}
|
||||
s.out.WriteByte(size)
|
||||
|
||||
@@ -243,7 +243,7 @@ func (p *WebTitlePlugin) formatHeaders(headers http.Header) string {
|
||||
var builder strings.Builder
|
||||
for name, values := range headers {
|
||||
for _, value := range values {
|
||||
builder.WriteString(fmt.Sprintf("%s: %s\n", name, value))
|
||||
fmt.Fprintf(&builder, "%s: %s\n", name, value)
|
||||
}
|
||||
}
|
||||
return builder.String()
|
||||
|
||||
Reference in New Issue
Block a user