master v2.1.0.beta.9
兔子 4 months ago
parent 23e4443cf4
commit 60a73eb0d8

@ -114,7 +114,8 @@ var CmdNatClient = &cobra.Command{
starlog.Errorln("测试NAT类型失败", err) starlog.Errorln("测试NAT类型失败", err)
return return
} }
fmt.Println("-----------------\n") fmt.Println("-----------------")
fmt.Println("")
starlog.Green("您的NAT类型为%v - %v\nswitch可能显示NAT类型为%v\n%v", res.Code, res.RFC3489, res.NintendoSwitch, res.Desc) starlog.Green("您的NAT类型为%v - %v\nswitch可能显示NAT类型为%v\n%v", res.Code, res.RFC3489, res.NintendoSwitch, res.Desc)
}, },
} }

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

@ -3,5 +3,5 @@ package net
import "testing" import "testing"
func TestSSHJar(t *testing.T) { func TestSSHJar(t *testing.T) {
//runSSHHoneyJar("0.0.0.0:22") runSSHHoneyJar("127.0.0.1:22", "", "", "./test.csv", "")
} }

Loading…
Cancel
Save