bettercap: fix uninitialized constant PacketFu::EthHeaderMixin

Today I was going to test bettercap from source and I ran into a rather nasty but quite popular issue:

$ sudo bettercap --help
/usr/local/lib/ruby/gems/2.4.0/gems/bettercap-1.6.1b/lib/bettercap/spoofers/icmp.rb:24:in `<class:ICMPRedirectPacket>': uninitialized constant PacketFu::EthHeaderMixin (NameError)
from /usr/local/lib/ruby/gems/2.4.0/gems/bettercap-1.6.1b/lib/bettercap/spoofers/icmp.rb:17:in `<module:Spoofers>'
from /usr/local/lib/ruby/gems/2.4.0/gems/bettercap-1.6.1b/lib/bettercap/spoofers/icmp.rb:15:in `<module:BetterCap>'
from /usr/local/lib/ruby/gems/2.4.0/gems/bettercap-1.6.1b/lib/bettercap/spoofers/icmp.rb:14:in `<top (required)>'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/ruby/gems/2.4.0/gems/bettercap-1.6.1b/lib/bettercap.rb:58:in `block in bettercap_autoload'
from /usr/local/lib/ruby/gems/2.4.0/gems/bettercap-1.6.1b/lib/bettercap.rb:57:in `each'
from /usr/local/lib/ruby/gems/2.4.0/gems/bettercap-1.6.1b/lib/bettercap.rb:57:in `bettercap_autoload'
from /usr/local/lib/ruby/gems/2.4.0/gems/bettercap-1.6.1b/lib/bettercap.rb:62:in `<top (required)>'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/ruby/gems/2.4.0/gems/bettercap-1.6.1b/bin/bettercap:19:in `<top (required)>'
from /usr/local/bin/bettercap:22:in `load'
from /usr/local/bin/bettercap:22:in `<main>'

That uninitialized constant PacketFu::EthHeaderMixin is a popular error if you look in bettercap’s issue tracker, and among all it’s hard to find the correct solution! But thanks to evilsocket himself I was led to the correct fix.

The problem has been identified in issue 379 in packetfu > 1.1.11, which it’s apparently that’s the last compatible version. In order to clean up broken previous versions of both bettercap and packetfu I removed the following directories (this is for MacOS, may vary in *Linux):

  • /usr/local/lib/ruby/gems/2.4.0/gems/bettercap-1.6.*
  • /usr/local/lib/ruby/gems/2.4.0/gems/packetfu-1.1*

Then I proceeded with the normal installation, with a specific packetfu version:

gem install packetfu -v 1.1.11
git clone https://github.com/evilsocket/bettercap
cd bettercap
gem build bettercap.gemspec
sudo gem install bettercap*.gem

and everything worked!

 

Image credit: bettercap’s twitter

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Solve : *
6 + 3 =


Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.