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

Commit

Permalink
Ensuring english localization when executing ifconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Jul 21, 2015
1 parent 0794794 commit c8d8f71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/monkey/packetfu/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions lib/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 comments on commit c8d8f71

@Goldich
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that this is the best way? On Ubuntu you get the following error after this particular change:

$ sudo ./bettercap.rb -I eth0 -D
---------------------------------------------------------
                   BETTERCAP v1.0.6


          by Simone 'evilsocket' Margaritelli
                  [email protected]    
---------------------------------------------------------

[D] ifconfig eth0
[E] No such file or directory - LANG=en ifconfig eth0
[E] /home/oliver/programme/bettercap/bettercap/lib/shell.rb:13:in ``'
/home/oliver/programme/bettercap/bettercap/lib/shell.rb:13:in `execute'
/home/oliver/programme/bettercap/bettercap/lib/shell.rb:22:in `ifconfig'
/home/oliver/programme/bettercap/bettercap/lib/monkey/packetfu/utils.rb:28:in `ifconfig'
./bettercap.rb:93:in `<main>'

@evilsocket
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just reverted

Please sign in to comment.