From 0794794e8acbaf667ae37b55ca0dbe75697580d8 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Mon, 20 Jul 2015 18:22:12 +0200 Subject: [PATCH] Added debug logs to PacketFu monkey patch. --- lib/monkey/packetfu/utils.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/monkey/packetfu/utils.rb b/lib/monkey/packetfu/utils.rb index f5e1951d..d1a9ecd7 100644 --- a/lib/monkey/packetfu/utils.rb +++ b/lib/monkey/packetfu/utils.rb @@ -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 @@ -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