parent
04858220f2
commit
32b1e22d25
|
@ -132,7 +132,7 @@ module PacketFu
|
|||
# method that returns an array rather than just the first candidate.
|
||||
end
|
||||
|
||||
# Handles ifconfig for various (okay, two) platforms.
|
||||
# Handles ifconfig for various (okay, one) platforms. Mac guys, fix this and submit a patch!
|
||||
# Will have Windows done shortly.
|
||||
#
|
||||
# Takes an argument (either string or symbol) of the interface to look up, and
|
||||
|
@ -182,32 +182,8 @@ module PacketFu
|
|||
ret[:ip6_saddr] = $1
|
||||
ret[:ip6_obj] = IPAddr.new($1)
|
||||
end
|
||||
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
|
||||
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
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module PacketFu
|
||||
|
||||
# Check the repo's for version release histories
|
||||
VERSION = "1.1.5" # Unscrewing the 1.1.4 gem
|
||||
VERSION = "1.1.3" # Unscrewing the 1.1.2 gem
|
||||
|
||||
# Returns PacketFu::VERSION
|
||||
def self.version
|
||||
|
|
Loading…
Reference in New Issue