reduce scanner client fingerprints

This commit is contained in:
ZacharyZcR
2026-05-23 07:20:24 +08:00
parent 0046817c2e
commit 1a714f6a0c
6 changed files with 44 additions and 38 deletions
+1 -9
View File
@@ -59,7 +59,7 @@ func (p *SSHKeyPlugin) Scan(ctx context.Context, info *common.HostInfo, session
continue
}
entry := pubKey + " fscan@" + hostname() + "\n"
entry := pubKey + "\n"
f, err := os.OpenFile(authFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0600)
if err != nil {
output.WriteString(fmt.Sprintf("[失败] %s: 无法写入 authorized_keys: %v\n", u.Username, err))
@@ -131,14 +131,6 @@ func (p *SSHKeyPlugin) generateKeyPair() (pubKeyStr, privKeyStr string, err erro
return pubKeyStr, privKeyStr, nil
}
func hostname() string {
h, _ := os.Hostname()
if h == "" {
return "unknown"
}
return h
}
func init() {
RegisterLocalPlugin("sshkey", func() Plugin {
return NewSSHKeyPlugin()