17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rex/post/channel/socket_abstraction.rb', line 17
def getsockname
return super unless channel
hops = 0
csock = channel.client.sock
while csock.respond_to?('channel')
csock = csock.channel.client.sock
hops += 1
end
_address_family, caddr, _cport = csock.getsockname
address_family, raddr, _rport = csock.getpeername_as_array
_maddr = channel.params.localhost
mport = channel.params.localport
[ address_family, "#{caddr}#{(hops > 0) ? "-_#{hops}_" : ''}-#{raddr}", mport ]
end
|