Path: blob/master/lib/rex/post/meterpreter/extensions/stdapi/net/route.rb
19612 views
# -*- coding: binary -*-12require 'ipaddr'34module Rex5module Post6module Meterpreter7module Extensions8module Stdapi9module Net1011###12#13# Represents a logical network route.14#15###16class Route1718##19#20# Constructor21#22##2324#25# Initializes a route instance.26#27def initialize(subnet, netmask, gateway, interface='', metric=0)28self.subnet = IPAddr.new_ntoh(subnet).to_s29self.netmask = IPAddr.new_ntoh(netmask).to_s30self.gateway = IPAddr.new_ntoh(gateway).to_s31self.interface = interface32self.metric = metric33end3435#36# Provides a pretty version of the route.37#38def pretty39return sprintf("%16s %16s %16s %d %16s", subnet, netmask, gateway, metric, interface)40end4142#43# The subnet mask associated with the route.44#45attr_accessor :subnet46#47# The netmask of the subnet route.48#49attr_accessor :netmask50#51# The gateway to take for the subnet route.52#53attr_accessor :gateway54#55# The interface to take for the subnet route.56#57attr_accessor :interface58#59# The metric of the route.60#61attr_accessor :metric626364end6566end; end; end; end; end; end676869