packetfu 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -132,7 +132,7 @@ module PacketFu
132
132
  # method that returns an array rather than just the first candidate.
133
133
  end
134
134
 
135
- # Handles ifconfig for various (okay, one) platforms. Mac guys, fix this and submit a patch!
135
+ # Handles ifconfig for various (okay, two) platforms.
136
136
  # Will have Windows done shortly.
137
137
  #
138
138
  # Takes an argument (either string or symbol) of the interface to look up, and
@@ -182,8 +182,32 @@ module PacketFu
182
182
  ret[:ip6_saddr] = $1
183
183
  ret[:ip6_obj] = IPAddr.new($1)
184
184
  end
185
- end
186
- end # linux
185
+ end # linux
186
+ when /darwin/i
187
+ ifconfig_data = %x[ifconfig #{iface}]
188
+ if ifconfig_data =~ /#{iface}/i
189
+ ifconfig_data = ifconfig_data.split(/[\s]*\n[\s]*/)
190
+ else
191
+ raise ArgumentError, "Cannot ifconfig #{iface}"
192
+ end
193
+ real_iface = ifconfig_data.first
194
+ ret[:iface] = real_iface.split(':')[0]
195
+ ifconfig_data.each do |s|
196
+ case s
197
+ when /ether[\s]([0-9a-fA-F:]{17})/i
198
+ ret[:eth_saddr] = $1
199
+ ret[:eth_src] = EthHeader.mac2str(ret[:eth_saddr])
200
+ when /inet[\s]*([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)(.*Mask:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+))?/i
201
+ ret[:ip_saddr] = $1
202
+ ret[:ip_src] = [IPAddr.new($1).to_i].pack("N")
203
+ ret[:ip4_obj] = IPAddr.new($1)
204
+ ret[:ip4_obj] = ret[:ip4_obj].mask($3) if $3
205
+ when /inet6[\s]*([0-9a-fA-F:\x2f]+)/
206
+ ret[:ip6_saddr] = $1
207
+ ret[:ip6_obj] = IPAddr.new($1)
208
+ end
209
+ end # darwin
210
+ end # RUBY_PLATFORM
187
211
  ret
188
212
  end
189
213
 
@@ -1,7 +1,7 @@
1
1
  module PacketFu
2
2
 
3
3
  # Check the repo's for version release histories
4
- VERSION = "1.1.4" # Unscrewing the 1.1.2 gem
4
+ VERSION = "1.1.5" # Unscrewing the 1.1.4 gem
5
5
 
6
6
  # Returns PacketFu::VERSION
7
7
  def self.version
data/packetfu.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rake'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'packetfu'
5
- s.version = '1.1.4'
5
+ s.version = '1.1.5'
6
6
  s.authors = ['Tod Beardsley']
7
7
  s.email = 'todb@planb-security.net'
8
8
  s.summary = 'PacketFu is a mid-level packet manipulation library.'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: packetfu
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.4
5
+ version: 1.1.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tod Beardsley