Class: Rex::Post::Meterpreter::Extensions::Stdapi::Net::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/post/meterpreter/extensions/stdapi/net/route.rb

Overview

Represents a logical network route.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subnet, netmask, gateway, interface = '', metric = 0) ⇒ Route

Initializes a route instance.



28
29
30
31
32
33
34
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/route.rb', line 28

def initialize(subnet, netmask, gateway, interface='', metric=0)
  self.subnet  = IPAddr.new_ntoh(subnet).to_s
  self.netmask = IPAddr.new_ntoh(netmask).to_s
  self.gateway = IPAddr.new_ntoh(gateway).to_s
  self.interface = interface
  self.metric = metric
end

Instance Attribute Details

#gatewayObject

The gateway to take for the subnet route.



54
55
56
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/route.rb', line 54

def gateway
  @gateway
end

#interfaceObject

The interface to take for the subnet route.



58
59
60
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/route.rb', line 58

def interface
  @interface
end

#metricObject

The metric of the route.



62
63
64
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/route.rb', line 62

def metric
  @metric
end

#netmaskObject

The netmask of the subnet route.



50
51
52
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/route.rb', line 50

def netmask
  @netmask
end

#subnetObject

The subnet mask associated with the route.



46
47
48
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/route.rb', line 46

def subnet
  @subnet
end

Instance Method Details

#prettyObject

Provides a pretty version of the route.



39
40
41
# File 'lib/rex/post/meterpreter/extensions/stdapi/net/route.rb', line 39

def pretty
  return sprintf("%16s %16s %16s %d %16s", subnet, netmask, gateway, metric, interface)
end