From cd1eb7338dac97d9dfd71b007df4c7f65ca574d1 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sun, 21 Jul 2024 23:02:54 +0200 Subject: [PATCH] agent now giving the exact commands to run to use it from the client side. --- cmd/agent/agent.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cmd/agent/agent.go b/cmd/agent/agent.go index a02b9a0..102378a 100755 --- a/cmd/agent/agent.go +++ b/cmd/agent/agent.go @@ -10,8 +10,10 @@ import ( "io" "log" "net" + "net/url" "os" "os/exec" + "strings" "syscall" "time" "unsafe" @@ -194,5 +196,25 @@ func main() { }) //service = ConnectionServer(netCatServer) //service = ConnectionServer(echoServer) + log.Println() + log.Printf("Clients should use the following commands to connect to this agent:") + log.Println() + clientUrl := strings.ReplaceAll(wsURL, "/agent/", "/client/") + sshCommand := fmt.Sprintf("ssh -oServerAliveInterval=10 -oProxyCommand=\"wsproxy %s\" abc@localhost", + clientUrl) + sftpCommand := fmt.Sprintf("sftp -oServerAliveInterval=10 -oProxyCommand=\"wsproxy %s\" abc@localhost", + clientUrl) + log.Println(" # For SSH") + log.Println(" " + sshCommand) + log.Println() + log.Println(" # for SFTP") + log.Println(" " + sftpCommand) + log.Println() + urlObject, _ := url.Parse(wsURL) + + log.Printf("wsproxy can be downloaded from %s", + strings.ReplaceAll(urlObject.Scheme, "ws", "http")+ + "://"+urlObject.Host+"/docs/wsproxy") + log.Println() service.Run(listener) }