sshpoke/patch/ssh_fakehost.patch

24 lines
830 B
Diff

--- pkg/proto/ssh/tcpip.go 2023-11-18 21:39:15.394837005 +0300
+++ pkg/proto/ssh/tcpip.go 2023-11-18 21:38:25.706173351 +0300
@@ -101,14 +101,18 @@
// ListenTCP requests the remote peer open a listening socket
// on laddr. Incoming connections will be available by calling
// Accept on the returned net.Listener.
-func (c *Client) ListenTCP(laddr *net.TCPAddr) (net.Listener, error) {
+func (c *Client) ListenTCP(laddr *net.TCPAddr, fakeHost ...string) (net.Listener, error) {
c.handleForwardsOnce.Do(c.handleForwards)
if laddr.Port == 0 && isBrokenOpenSSHVersion(string(c.ServerVersion())) {
return c.autoPortListenWorkaround(laddr)
}
+ host := laddr.IP.String()
+ if len(fakeHost) > 0 {
+ host = fakeHost[0]
+ }
m := channelForwardMsg{
- laddr.IP.String(),
+ host,
uint32(laddr.Port),
}
// send message