Update packetfu to 1.1.4

unstable
James Lee 2012-04-01 20:00:17 -06:00
parent bd5f43c918
commit 24e6131ad7
2 changed files with 27 additions and 3 deletions

View File

@ -132,7 +132,7 @@ module PacketFu
# method that returns an array rather than just the first candidate.
end
# Handles ifconfig for various (okay, one) platforms. Mac guys, fix this and submit a patch!
# Handles ifconfig for various (okay, two) platforms.
# Will have Windows done shortly.
#
# Takes an argument (either string or symbol) of the interface to look up, and
@ -182,8 +182,32 @@ module PacketFu
ret[:ip6_saddr] = $1
ret[:ip6_obj] = IPAddr.new($1)
end
end # linux
when /darwin/i
ifconfig_data = %x[ifconfig #{iface}]
if ifconfig_data =~ /#{iface}/i
ifconfig_data = ifconfig_data.split(/[\s]*\n[\s]*/)
else
raise ArgumentError, "Cannot ifconfig #{iface}"
end
end # linux
real_iface = ifconfig_data.first
ret[:iface] = real_iface.split(':')[0]
ifconfig_data.each do |s|
case s
when /ether[\s]([0-9a-fA-F:]{17})/i
ret[:eth_saddr] = $1
ret[:eth_src] = EthHeader.mac2str(ret[:eth_saddr])
when /inet[\s]*([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)(.*Mask:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+))?/i
ret[:ip_saddr] = $1
ret[:ip_src] = [IPAddr.new($1).to_i].pack("N")
ret[:ip4_obj] = IPAddr.new($1)
ret[:ip4_obj] = ret[:ip4_obj].mask($3) if $3
when /inet6[\s]*([0-9a-fA-F:\x2f]+)/
ret[:ip6_saddr] = $1
ret[:ip6_obj] = IPAddr.new($1)
end
end # darwin
end # RUBY_PLATFORM
ret
end

View File

@ -1,7 +1,7 @@
module PacketFu
# Check the repo's for version release histories
VERSION = "1.1.3" # Unscrewing the 1.1.2 gem
VERSION = "1.1.5" # Unscrewing the 1.1.4 gem
# Returns PacketFu::VERSION
def self.version