|
|
|
@ -11,7 +11,6 @@ import (
|
|
|
|
|
"golang.org/x/crypto/ssh"
|
|
|
|
|
"net"
|
|
|
|
|
"os"
|
|
|
|
|
"os/signal"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
@ -31,7 +30,7 @@ func init() {
|
|
|
|
|
cmdSSHJar.Flags().StringVarP(&keyFile, "key", "k", "", "私钥文件")
|
|
|
|
|
cmdSSHJar.Flags().StringVarP(&KeyPasswd, "passwd", "p", "", "私钥密码")
|
|
|
|
|
cmdSSHJar.Flags().StringVarP(&outpath, "output", "o", "", "输出文件")
|
|
|
|
|
cmdSSHJar.Flags().StringVarP(&serverVersion, "version", "v", "OpenSSH", "SSH版本")
|
|
|
|
|
cmdSSHJar.Flags().StringVarP(&serverVersion, "version", "v", "SSH-2.0-OpenSSH_8.0", "SSH版本")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var cmdSSHJar = &cobra.Command{
|
|
|
|
@ -64,6 +63,7 @@ func runSSHHoneyJar(listenAddr, keyFile, KeyPasswd, outpath, version string) {
|
|
|
|
|
data := []string{time.Now().Format("2006-01-02 15:04:05"), c.RemoteAddr().String(), c.User(), string(pass)}
|
|
|
|
|
if f != nil {
|
|
|
|
|
conn.Write(data)
|
|
|
|
|
conn.Flush()
|
|
|
|
|
}
|
|
|
|
|
if curlUrl != "" {
|
|
|
|
|
go func() {
|
|
|
|
@ -125,16 +125,7 @@ func runSSHHoneyJar(listenAddr, keyFile, KeyPasswd, outpath, version string) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
starlog.Noticeln("SSH HoneyJar is listening on", listenAddr)
|
|
|
|
|
sig := make(chan os.Signal, 1)
|
|
|
|
|
signal.Notify(sig, os.Interrupt, os.Kill)
|
|
|
|
|
for {
|
|
|
|
|
select {
|
|
|
|
|
case <-sig:
|
|
|
|
|
starlog.Noticef("SSH HoneyJar is shutting down")
|
|
|
|
|
listener.Close()
|
|
|
|
|
return
|
|
|
|
|
default:
|
|
|
|
|
}
|
|
|
|
|
conn, err := listener.Accept()
|
|
|
|
|
if err != nil {
|
|
|
|
|
continue
|
|
|
|
|