Module: Rex::Post::Meterpreter::Extensions::Stdapi::Net::SocketSubsystem::TcpClientChannel::SocketInterface

Defined in:
lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



59
60
61
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb', line 59

def channel
  @channel
end

Instance Method Details

#getpeernameObject



52
53
54
55
56
57
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb', line 52

def getpeername
  return super if not channel
  tmp,caddr,cport = channel.client.sock.getpeername
  maddr,mport = [ channel.params.peerhost, channel.params.peerport ]
  [ tmp, "#{maddr}", "#{mport}" ]
end

#getsocknameObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb', line 37

def getsockname
  return super if not channel
  # Find the first host in our chain (our address)
  hops = 0
  csock = channel.client.sock
  while(csock.respond_to?('channel'))
    csock = csock.channel.client.sock
    hops += 1
  end
  tmp,caddr,cport = csock.getsockname
  tmp,raddr,rport = csock.getpeername
  maddr,mport = [ channel.params.localhost, channel.params.localport ]
  [ tmp, "#{caddr}#{(hops > 0) ? "-_#{hops}_" : ""}-#{raddr}", "#{mport}" ]
end

#type?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb', line 33

def type?
  'tcp'
end