Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beef starting error, possibly not beef but rvm/ruby related... #1377

Closed
crowstone opened this issue Mar 17, 2017 · 6 comments
Closed

Beef starting error, possibly not beef but rvm/ruby related... #1377

crowstone opened this issue Mar 17, 2017 · 6 comments

Comments

@crowstone
Copy link

Environment

What version/revision of BeEF are you using?
Latest git clone (2017/03/15)

On what version of Ruby?
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
-e:1:in <main>': undefined local variable or method rsion' for main:Object (NameError)

On what browser?
not relevant, Firefox ESR

On what operating system?
Kali Rolling

Configuration

Are you using a non-default configuration?
no

Have you enabled or disabled any BeEF extensions?
no

Summary

Please provide a summary of the issue.
Starting Beef Framework dumps me this error:

root@kali:~/beef# ./beef
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'dm-core'. (Bundler::GemRequireError)
Gem Load Error is: No such file or directory @ rb_sysopen - /usr/share/ruby-addressable/unicode.data
Backtrace for gem load error is:
/usr/lib/ruby/vendor_ruby/addressable/idna/pure.rb:330:in `initialize'
/usr/lib/ruby/vendor_ruby/addressable/idna/pure.rb:330:in `open'
/usr/lib/ruby/vendor_ruby/addressable/idna/pure.rb:330:in `<module:IDNA>'
/usr/lib/ruby/vendor_ruby/addressable/idna/pure.rb:20:in `<module:Addressable>'
/usr/lib/ruby/vendor_ruby/addressable/idna/pure.rb:19:in `<top (required)>'
/usr/lib/ruby/vendor_ruby/addressable/idna.rb:24:in `require'
/usr/lib/ruby/vendor_ruby/addressable/idna.rb:24:in `rescue in <top (required)>'
/usr/lib/ruby/vendor_ruby/addressable/idna.rb:19:in `<top (required)>'
/usr/lib/ruby/vendor_ruby/addressable/uri.rb:20:in `require'
/usr/lib/ruby/vendor_ruby/addressable/uri.rb:20:in `<top (required)>'
/usr/lib/ruby/vendor_ruby/dm-core.rb:1:in `require'
/usr/lib/ruby/vendor_ruby/dm-core.rb:1:in `<top (required)>'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:91:in `require'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:91:in `block (2 levels) in require'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in `each'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in `block in require'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in `each'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in `require'
/usr/lib/ruby/vendor_ruby/bundler.rb:106:in `require'
/root/beef/core/loader.rb:10:in `<top (required)>'
/usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
./beef:24:in `<main>'
Bundler Error Backtrace:
	from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:90:in `block (2 levels) in require'
	from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in `each'
	from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in `block in require'
	from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in `each'
	from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in `require'
	from /usr/lib/ruby/vendor_ruby/bundler.rb:106:in `require'
	from /root/beef/core/loader.rb:10:in `<top (required)>'
	from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from ./beef:24:in `<main>'

Expected Behaviour

What was the expected result?

Actual Behaviour

What was the actual result?

Steps to Reproduce

./beef

Additional Information

I ran beef without any problems for months and I'm sure this error is not directly related to beef. I updated kali with apt-get update/upgrade/dist-upgrade, git pull, and gem update.
Since then I got these error messages. I tried to repair rvm, reinstall beef, no success.
Since I'm a total ruby/rvm noob I hope to get some help here. Looks like a misconfiguration problem since the /usr/share/ruby-addressable/ folder is obviously not the right place to find the gem...

@bcoles
Copy link
Collaborator

bcoles commented Mar 18, 2017

Make sure you bundle install after rvm use <version>.

@crowstone
Copy link
Author

There is something wrong with my rvm/ruby setup but that's apparently what I don't understand. If I try
rvm use 2.3.3p222, rvm use 2.3.3, rvm use 2.3 I always get

ruby-2.3.3p222 is not installed.
To install do: 'rvm install ruby-2.3.3p222'

type rvm | head -1 returns rvm is a function.
ruby -v shows ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
which ruby tells me /usr/bin/ruby

rvm list tells me

rvm rubies
# No rvm rubies installed yet. Try 'rvm help install'.

rvm install ruby-2.3.0 (and all other versions I tried) end with this error message(s):

Searching for binary rubies, this might take some time.
No binary rubies available for: debian/Kali_Linux_Rolling/x86_64/ruby-2.3.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for debian.
Installing requirements for debian.
Updating system..
Installing required packages: libreadline6-dev..
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.3.0, this may take a while depending on your cpu(s)...
ruby-2.3.0 - #downloading ruby-2.3.0, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13.5M  100 13.5M    0     0  6881k      0  0:00:02  0:00:02 --:--:-- 6881k
ruby-2.3.0 - #extracting ruby-2.3.0 to /usr/local/rvm/src/ruby-2.3.0....
ruby-2.3.0 - #applying patch /usr/local/rvm/patches/ruby/changeset_r53419.diff.
ruby-2.3.0 - #configuring..........................................................
ruby-2.3.0 - #post-configuration..
ruby-2.3.0 - #compiling.............................................................................
Error running '__rvm_make -j4',
showing last 15 lines of /usr/local/rvm/log/1490003521_ruby-2.3.0/make.log
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
installing default nkf libraries
compiling objspace_dump.c
linking shared-object json/ext/generator.so
make[2]: Leaving directory '/usr/local/rvm/src/ruby-2.3.0/ext/json/generator'
compiling object_tracing.c
linking shared-object objspace.so
make[2]: Leaving directory '/usr/local/rvm/src/ruby-2.3.0/ext/objspace'
linking shared-object nkf.so
make[2]: Leaving directory '/usr/local/rvm/src/ruby-2.3.0/ext/nkf'
make[1]: Leaving directory '/usr/local/rvm/src/ruby-2.3.0'
uncommon.mk:203: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
++ return 2
There has been an error while running make. Halting the installation.

Mysterious for the noob is that other ruby related tools like msfconsole, bettercap, ... are working.

@bcoles
Copy link
Collaborator

bcoles commented Mar 20, 2017

Thanks for providing a detailed report.

Looks like an issue with your RVM.

Try tweaking the version of Ruby in .ruby-version in the BeEF folder to a version you know works. Then rvm use that version and bundle install.

Metasploit uses 2.3.3.

Try also cloning BeEF from github and doing a bundle install rather than using the beef-xss service. Process of elimination...

Edit Also try removing the .ruby-version file. You should be able to run BeEF with system ruby on Kali.

@bcoles
Copy link
Collaborator

bcoles commented Apr 10, 2017

Hi @crowstone - any luck with this?

@bcoles bcoles closed this as completed Apr 16, 2017
@ziflar
Copy link

ziflar commented May 4, 2017

@bcoles

ruby -v

ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]

 cd /beef-xss && rm -r .ruby-version

bundle install

Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Warning: the running version of Bundler (1.13.6) is older than the version that created the lockfile (1.14.4). We suggest you upgrade to the latest version of Bundler by running gem install bundler.
Using public_suffix 2.0.5
Using ansi 1.5.0
Using chunky_png 1.3.8
Using daemons 1.2.4
Using json 1.8.6
Using json_pure 1.8.6
Using multi_json 1.12.1
Using eventmachine 1.0.9.1
Using http_parser.rb 0.6.0
Using erubis 2.7.0
Using espeak-ruby 1.0.4
Using execjs 2.7.0
Using fastercsv 1.5.5
Using filesize 0.1.1
Using geoip 1.6.3
Using rkelly-remix 0.0.7
Using libv8 3.16.14.19
Using metasm 1.0.3
Using mime-types-data 3.2016.0521
Using mini_portile2 2.1.0
Using mojo_magick 0.5.6
Using msgpack 1.1.0
Using rb-readline-r7 0.5.2.0
Using robots 0.10.1
Using parseconfig 1.0.8
Using rack 1.6.5
Using rainbow 2.2.1
Using ref 2.0.0
Using rubyzip 1.2.1
Using tilt 2.0.7
Using tins 1.13.2
Using bundler 1.13.6
Using addressable 2.5.1
Using rqrcode 0.10.1
Using em-websocket 0.5.1
Using uglifier 3.2.0
Using jsobfu 0.4.2
Using mime-types 3.1
Using nokogiri 1.7.1
Using rack-protection 1.5.3
Using thin 1.7.0
Using rexec 1.6.3
Using therubyracer 0.12.3
Using term-ansicolor 1.5.0
Using data_objects 0.10.17
Using dm-core 1.2.1
Using qr4r 0.4.1
Using rex 2.0.10
Using sinatra 1.4.8
Using rubydns 0.7.3
Using do_sqlite3 0.10.17
Using dm-do-adapter 1.2.0
Using dm-migrations 1.2.0
Using dm-serializer 1.2.2
Using msfrpc-client 1.1.0
Using dm-sqlite-adapter 1.2.0
Bundle complete! 26 Gemfile dependencies, 56 gems now installed.
Use bundle show [gemname] to see where a bundled gem is installed.

./beef

/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:94:in rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError) Gem Load Error is: wrong argument type Class (expected Module) Backtrace for gem load error is: /usr/lib/ruby/vendor_ruby/v8/conversion.rb:23:in include'
/usr/lib/ruby/vendor_ruby/v8/conversion.rb:23:in block (2 levels) in <top (required)>' /usr/lib/ruby/vendor_ruby/v8/conversion.rb:22:in class_eval'
/usr/lib/ruby/vendor_ruby/v8/conversion.rb:22:in block in <top (required)>' /usr/lib/ruby/vendor_ruby/v8/conversion.rb:21:in each'
/usr/lib/ruby/vendor_ruby/v8/conversion.rb:21:in <top (required)>' /var/lib/gems/2.3.0/gems/therubyracer-0.12.3/lib/v8.rb:22:in require'
/var/lib/gems/2.3.0/gems/therubyracer-0.12.3/lib/v8.rb:22:in <top (required)>' /var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:108:in require'
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:108:in available?' /var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:63:in each'
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:63:in find' /var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:63:in best_available'
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:57:in autodetect' /var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in module:ExecJS'
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in <top (required)>' /var/lib/gems/2.3.0/gems/uglifier-3.2.0/lib/uglifier.rb:5:in require'
/var/lib/gems/2.3.0/gems/uglifier-3.2.0/lib/uglifier.rb:5:in <top (required)>' /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:91:in require'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:91:in block (2 levels) in require' /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in each'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in block in require' /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in each'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in require' /usr/lib/ruby/vendor_ruby/bundler.rb:106:in require'
/usr/share/beef-xss/core/loader.rb:10:in <top (required)>' /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' ./beef:25:in

'
Bundler Error Backtrace:
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:90:in block (2 levels) in require' from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in each'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in block in require' from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in each'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in require' from /usr/lib/ruby/vendor_ruby/bundler.rb:106:in require'
from /usr/share/beef-xss/core/loader.rb:10:in <top (required)>' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from ./beef:25:in '

@ziflar
Copy link

ziflar commented May 4, 2017

@bcoles
i've edited a script tu install beef-xss on kali rolling from github to run beef from favorite menu like the beef on kali linux.
always i run ./update-beef to update beef-xss from github and it's was good and perfect before.
i've edited on the script all ln -s it's work perfect but
when updating to thie actual beef-xss version i've at a first time a list of missing ruby gems that i emmediatly resolve by editing my script again .
the script stop with error on ./beef
you can try it from my github repository : from here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants