Newbie - proper way to add msf/core ruby libraries?

Every time I try to run a ruby exploit from the exploitdb, I get a ruby error that looks like:

cannot load such file -- msf/core (LoadError)

I realize this means it’s looking for libraries it can’t find because the path is incorrect and I even figured out how to get it to go find the right directory by changing the require line, but then I immediately get another error of the same type from a different script the original one called. So I feel like there is a better way to get the scripts to work in my environment like setting a global environment variable or something. My env is Kali Linux btw. I’m very familiar with programming in Python and other languages as well as linux systems administration, so I understnad the concepts, I just don’t know exactly what the right way to do this in Ruby is and apparently my google fu is not as good as I thought…

Any hints would be greatly appreciated. Thanks!

SQ

I feel like I’m getting close, but I really have no clue any help would be awesome here. What I have done now:

  • I copied /usr/share/metasploit/lib/* to /usr/lib/ruby/2.5.0/ which worked well for getting past the msf/core dependency.
  • I did "sudo gem install " for like 10 or so gems that reported as being required.
  • Finally got an error that wasn’t a missing library, and now I’m stuck again. The new error is:

'rescue in optionally': uninitialized constant Metasploit::Framework::Require::Bundler (NameError)

Again I’m smart enough to know what this means, but not how to fix it. It seems to me like it’s looking for a class “Bundler” which it’s not finding. The bundler gem is definitely installed, so I’m stumped again.

I feel like I’m doing too much work here. It seems like there must be something simple I’m missing. Any hints would be amazing. Thanks.