diff --git a/lib/monkey/packetfu/utils.rb b/lib/monkey/packetfu/utils.rb index d1a9ecd7..82a2de81 100644 --- a/lib/monkey/packetfu/utils.rb +++ b/lib/monkey/packetfu/utils.rb @@ -25,9 +25,10 @@ def self.ifconfig(iface='eth0') Logger.debug "ifconfig #{iface}" + ifconfig_data = Shell.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 @@ -59,7 +60,6 @@ def self.ifconfig(iface='eth0') end end # linux when /darwin/i - ifconfig_data = %x[ifconfig #{iface}] Logger.debug "OSX ifconfig #{iface}:\n#{ifconfig_data}" if ifconfig_data =~ /#{iface}/i diff --git a/lib/shell.rb b/lib/shell.rb index 9ff557ac..0784b967 100644 --- a/lib/shell.rb +++ b/lib/shell.rb @@ -16,6 +16,11 @@ def execute(command) end return r end + + def ifconfig(iface) + # ensure default en language, see https://github.com/evilsocket/bettercap/issues/6 + self.execute( "LANG=en ifconfig #{iface}" ) + end end end