24 lines
481 B
Go
24 lines
481 B
Go
package winpwn
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
)
|
|
|
|
// Remote opens a TCP connection to a remote target as a Tube, the Go
|
|
// analogue of pwntools' remote().
|
|
func Remote(host string, port string) (*Tube, error) {
|
|
address := host + ":" + port
|
|
|
|
Info("Opening connection to %s", address)
|
|
|
|
conn, err := net.Dial("tcp", address)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("connect to %s: %w", address, err)
|
|
}
|
|
|
|
Success("Connected to %s", address)
|
|
|
|
return newTube(nil, conn, conn, conn), nil
|
|
}
|