class Rex::Post::Meterpreter::Extensions::Stdapi::Net::Netstat
This class represents a connection (listening, connected) on the remote machine.
Attributes
inode[RW]
The socket inode
local_addr[RW]
The local address of the connection
local_addr_str[RW]
The local address of the connection plus the port
local_port[RW]
The local port of the connection.
pid_name[RW]
The name of the process to which the connection belongs to
protocol[RW]
The protocol type (tcp/tcp6/udp/udp6)
remote_addr[RW]
The remote address (peer) of the connection
remote_addr_str[RW]
The remote address (peer) of the connection plus the port or *
remote_port[RW]
The remote port of the connection.
state[RW]
The state of the connection (close, listening, syn_sent…)
uid[RW]
The uid of the user who started the process to which the connection belongs to
Public Class Methods
new(opts={})
click to toggle source
Returns a netstat entry and initializes it to the supplied parameters.
# File lib/rex/post/meterpreter/extensions/stdapi/net/netstat.rb, line 29 def initialize(opts={}) self.local_addr = IPAddr.new_ntoh(opts[:local_addr]).to_s self.remote_addr = IPAddr.new_ntoh(opts[:remote_addr]).to_s self.local_port = opts[:local_port] self.remote_port = opts[:remote_port] self.protocol = opts[:protocol] self.state = opts[:state] self.uid = opts[:uid] || 0 self.inode = opts[:inode] || 0 self.pid_name = opts[:pid_name] self.local_addr_str = sprintf("%s:%d",self.local_addr, self.local_port) if self.remote_port == 0 port = "*" else port = self.remote_port.to_s end self.remote_addr_str = sprintf("%s:%s",self.remote_addr, port) end