Skip to content
This repository has been archived by the owner on Feb 28, 2018. It is now read-only.

Commit

Permalink
Added debug logs to PacketFu monkey patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Jul 20, 2015
1 parent caba7d2 commit 0794794
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/monkey/packetfu/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@
# regular expression.
#
# ORIGINAL: https://github.com/packetfu/packetfu/blob/master/lib/packetfu/utils.rb#L204
require_relative '../../logger'

module PacketFu
class Utils
def self.ifconfig(iface='eth0')
ret = {}
iface = iface.to_s.scan(/[0-9A-Za-z]/).join

Logger.debug "ifconfig #{iface}"

case RUBY_PLATFORM
when /linux/i
ifconfig_data = %x[ifconfig #{iface}]
Logger.debug "Linux ifconfig #{iface}:\n#{ifconfig_data}"

if ifconfig_data =~ /#{iface}/i
ifconfig_data = ifconfig_data.split(/[\s]*\n[\s]*/)
else
Expand Down Expand Up @@ -53,6 +60,8 @@ def self.ifconfig(iface='eth0')
end # linux
when /darwin/i
ifconfig_data = %x[ifconfig #{iface}]
Logger.debug "OSX ifconfig #{iface}:\n#{ifconfig_data}"

if ifconfig_data =~ /#{iface}/i
ifconfig_data = ifconfig_data.split(/[\s]*\n[\s]*/)
else
Expand Down

0 comments on commit 0794794

Please sign in to comment.