Files
metasploit-gs/lib/rex/post/meterpreter/extensions/stdapi/net/route.rb
T
MM f83a7f14ac Switch to netlink for listing interfaces
* Adds support for listing IPv6 addresses on POSIX meterpreter
* Ensures crash logs are only created if debugging is enabled
* Fixes a bug in sniffer where a lock was not acquired correctly

Squashed commit of the following:

commit 955124b264a675c7d67187703bf23b58f0aba6d8
Author: MM <gaspmat@gmail.com>
Date:   Thu Feb 23 23:42:26 2012 +0100

    posix meterpreter - IPv6 support for route and ipconfig using netlink sockets

[Closes #196]
2012-02-24 16:42:12 -07:00

68 lines
1.0 KiB
Ruby

#!/usr/bin/env ruby
require 'ipaddr'
module Rex
module Post
module Meterpreter
module Extensions
module Stdapi
module Net
###
#
# Represents a logical network route.
#
###
class Route
##
#
# Constructor
#
##
#
# Initializes a route instance.
#
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
#
# Provides a pretty version of the route.
#
def pretty
return sprintf("%16s %16s %16s %d %16s", subnet, netmask, gateway, metric, interface)
end
#
# The subnet mask associated with the route.
#
attr_accessor :subnet
#
# The netmask of the subnet route.
#
attr_accessor :netmask
#
# The gateway to take for the subnet route.
#
attr_accessor :gateway
#
# The interface to take for the subnet route.
#
attr_accessor :interface
#
# The metric of the route.
#
attr_accessor :metric
end
end; end; end; end; end; end