xntrik / beefmetasploitplugin

BeEF Remote Control Metasploit Plugin - see README.beef
http://beefproject.com
13 stars 21 forks source link

[-] Failed to load plugin from /usr/share/metasploit-framework/plugins/beef: cannot load such file -- hpricot #3

Open 8at opened 8 years ago

sherazblank123 commented 7 years ago

same problem

gavz commented 7 years ago

same problem

TN0X commented 7 years ago

after

gem install hpricot gem install json

...copy files & folders from

/var/lib/gems/2.x.x/gems/hpricot-0.8.6/lib/

to

/usr/lib/ruby/vendor_ruby/

start msf and load beef

bcoles commented 6 years ago

A hacky way to resolve this issue is to add hpricot to metasploit-framework.gemspec then bundle install

diff --git a/metasploit-framework.gemspec b/metasploit-framework.gemspec
index 831f6cc..c39a44d 100644
--- a/metasploit-framework.gemspec
+++ b/metasploit-framework.gemspec
@@ -44,6 +44,7 @@ Gem::Specification.new do |spec|
   spec.test_files    = spec.files.grep(%r{^spec/})
   spec.require_paths = ["lib"]

+  spec.add_runtime_dependency 'hpricot'
   # Database support
   spec.add_runtime_dependency 'activerecord', *Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
   # Need 3+ for ActiveSupport::Concern
Ahmedabdsalam commented 5 years ago

@bcoles I did what you said and the resulting (diff: unrecognized option '--git' diff: Try 'diff --help' for more information.) Would you like to explain more how to add hpricot to metasploit-frame.gemspec

bcoles commented 5 years ago

@Ahmedabdsalam It appears you've applied the diff incorrectly. The correct approach is to copy the above diff into a file within the metasploit directory (let's call it hpricot.diff) then apply the diff file. This can be achieved like so:

git apply hpricot.diff

However, there's a few things to note. First, I provided the above diff as an example. Thanks to GitHub's markdown, the colored formatting makes it quite easy to visually inspect the diff and figure out exactly what changes were made. Simply be reading the diff file above it's incredibly obvious that the modified file is metasploit-framework.gemspec and a single new line was added to the file: spec.add_runtime_dependency 'hpricot'.

Secondly, a git diff represents the differences between two states in the repository. If the affected file metasploit-framework.gemspec has been modified since I wrote the diff (it has) then the diff won't apply cleanly.

Third, applying the git diff will only work if your Metasploit installation is using the git repository. Git cannot apply a diff to a git repository if you're not using a git repository.

You can learn more about git diff here.

As such, the best way to resolve your issue is to manually add the following line to metasploit-framework.gemspec:

spec.add_runtime_dependency 'hpricot'

And then run bundle install.

However, it's also worth noting that I haven't tried this since I wrote the comment above several months ago.