Bundle install puts broken msf* executables into the bin path #4602

Closed
hdm opened this Issue Jan 17, 2015 · 61 comments

Comments

Projects
None yet
@hdm
Contributor

hdm commented Jan 17, 2015

The metasploit-framework.gemspec currently specifies a bin directory and a list of executables. After running "bundle install", these executables are placed into the gem bin directory. Running these executables does not work. This is breaking the common practice of symlinking the metasploit git directory msf* binaries to /usr/local/bin, as the gem bin directory is searched first.

An easy fix is to change the gemspec to remove the executable files. A better fix might be to make these executables work even when transplanted into the bin directory.

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Jan 17, 2015

Contributor

An example of what happens after a bundle install:

$ bundle install
...
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

root@box:~/msf# ln -sf /root/msf/msf* /usr/local/bin
root@box:~/msf# which msfconsole
/usr/local/rvm/gems/ruby-1.9.3-p547/bin/msfconsole

root@box:~/msf# msfconsole
/usr/local/rvm/rubies/ruby-1.9.3-p547/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:298:in `to_specs': Could not find 'metasploit-framework' (>= 0) among 104 total gem(s) (Gem::LoadError)
    from /usr/local/rvm/rubies/ruby-1.9.3-p547/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:309:in `to_spec'
    from /usr/local/rvm/rubies/ruby-1.9.3-p547/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /usr/local/rvm/gems/ruby-1.9.3-p547/bin/msfconsole:22:in `<main>'

root@box:~/msf# /usr/local/bin/msfconsole

       =[ metasploit v4.10.1-dev [core:4.10.1.pre.dev api:1.0.0]]
+ -- --=[ 1334 exploits - 731 auxiliary - 214 post        ]
+ -- --=[ 340 payloads - 35 encoders - 8 nops             ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]
Contributor

hdm commented Jan 17, 2015

An example of what happens after a bundle install:

$ bundle install
...
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

root@box:~/msf# ln -sf /root/msf/msf* /usr/local/bin
root@box:~/msf# which msfconsole
/usr/local/rvm/gems/ruby-1.9.3-p547/bin/msfconsole

root@box:~/msf# msfconsole
/usr/local/rvm/rubies/ruby-1.9.3-p547/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:298:in `to_specs': Could not find 'metasploit-framework' (>= 0) among 104 total gem(s) (Gem::LoadError)
    from /usr/local/rvm/rubies/ruby-1.9.3-p547/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:309:in `to_spec'
    from /usr/local/rvm/rubies/ruby-1.9.3-p547/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /usr/local/rvm/gems/ruby-1.9.3-p547/bin/msfconsole:22:in `<main>'

root@box:~/msf# /usr/local/bin/msfconsole

       =[ metasploit v4.10.1-dev [core:4.10.1.pre.dev api:1.0.0]]
+ -- --=[ 1334 exploits - 731 auxiliary - 214 post        ]
+ -- --=[ 340 payloads - 35 encoders - 8 nops             ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

@hdm hdm added the bug label Jan 17, 2015

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Jan 17, 2015

Contributor

Note that the above behavior is consistent regardless of whether you are in the source directory or not.

Contributor

hdm commented Jan 17, 2015

Note that the above behavior is consistent regardless of whether you are in the source directory or not.

@hdm

This comment has been minimized.

Show comment
Hide comment
Contributor

hdm commented Jan 17, 2015

@todb-r7 todb-r7 added the library label Jan 20, 2015

@todb-r7

This comment has been minimized.

Show comment
Hide comment
@todb-r7

todb-r7 Jan 20, 2015

Contributor

I've read this a couple times and I'm not really following what the expectation is? What used to happen? Has this been a problem since metasploit-framework.gemspec was introduced back August?

Contributor

todb-r7 commented Jan 20, 2015

I've read this a couple times and I'm not really following what the expectation is? What used to happen? Has this been a problem since metasploit-framework.gemspec was introduced back August?

@todb-r7

This comment has been minimized.

Show comment
Hide comment
@todb-r7

todb-r7 Jan 20, 2015

Contributor

iow I'm trying to figure out the common practice here. On source checkouts I always ./msfconsole -L and never rely on a symlink, but maybe I'm the alien here.

Contributor

todb-r7 commented Jan 20, 2015

iow I'm trying to figure out the common practice here. On source checkouts I always ./msfconsole -L and never rely on a symlink, but maybe I'm the alien here.

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Jan 20, 2015

Contributor

If you bundle install, copies of msf* get placed into your path that do not work. Fixing this is easy, just remove the executable list from the metasploit-framework.gemspec. As they are currently written, these will not work when executed in the gem bin directory.

Contributor

hdm commented Jan 20, 2015

If you bundle install, copies of msf* get placed into your path that do not work. Fixing this is easy, just remove the executable list from the metasploit-framework.gemspec. As they are currently written, these will not work when executed in the gem bin directory.

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Jan 20, 2015

Contributor

The reason this is annoying; the RVM PATH is searched before the location where symlinks are normally installed (/usr/bin, etc). If you do the right thing and symlink your git cloned metasploit directory, msfconsole will still run the broken copy in the gem bin directory first.

Contributor

hdm commented Jan 20, 2015

The reason this is annoying; the RVM PATH is searched before the location where symlinks are normally installed (/usr/bin, etc). If you do the right thing and symlink your git cloned metasploit directory, msfconsole will still run the broken copy in the gem bin directory first.

@jhart-r7

This comment has been minimized.

Show comment
Hide comment
@jhart-r7

jhart-r7 Jan 22, 2015

Contributor

FWIW, this isn't isolated to just RVM. I use rbenv and can somewhat reproduce @hmoore-r7's findings:

$  locate bin/msfconsole
/home/jhart/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/bin/msfconsole
/home/jhart/.rbenv/versions/1.9.3-p550/lib/ruby/gems/1.9.1/bin/msfconsole
/home/jhart/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/bin/msfconsole
/home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msfconsole
[ jhart@jhart-laptop (01/22/15 14:17:01) ~/labs/git/metasploit-framework  ]                                                                                                                             
$  /home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msfconsole
/home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'metasploit-framework' (>= 0) among 250 total gem(s) (Gem::LoadError)
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msfconsole:22:in `<main>'
[ jhart@jhart-laptop (01/22/15 14:17:09) ~/labs/git/metasploit-framework  <err: 1> ]                                                                                                                    
$  bundle exec /home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msfconsole
[*] Starting the Metasploit Framework console.../
...
<works>
Contributor

jhart-r7 commented Jan 22, 2015

FWIW, this isn't isolated to just RVM. I use rbenv and can somewhat reproduce @hmoore-r7's findings:

$  locate bin/msfconsole
/home/jhart/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/bin/msfconsole
/home/jhart/.rbenv/versions/1.9.3-p550/lib/ruby/gems/1.9.1/bin/msfconsole
/home/jhart/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/bin/msfconsole
/home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msfconsole
[ jhart@jhart-laptop (01/22/15 14:17:01) ~/labs/git/metasploit-framework  ]                                                                                                                             
$  /home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msfconsole
/home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'metasploit-framework' (>= 0) among 250 total gem(s) (Gem::LoadError)
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msfconsole:22:in `<main>'
[ jhart@jhart-laptop (01/22/15 14:17:09) ~/labs/git/metasploit-framework  <err: 1> ]                                                                                                                    
$  bundle exec /home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msfconsole
[*] Starting the Metasploit Framework console.../
...
<works>
@todb-r7

This comment has been minimized.

Show comment
Hide comment
@todb-r7

todb-r7 Jan 23, 2015

Contributor

Ok, so these don't work at all then, and in that case it seems to make sense to drop those bin entries completely as @hmoore-r7 indicates.

Does some packaging rely on these bins? Just want to know if something needs them in the wrong place.

Contributor

todb-r7 commented Jan 23, 2015

Ok, so these don't work at all then, and in that case it seems to make sense to drop those bin entries completely as @hmoore-r7 indicates.

Does some packaging rely on these bins? Just want to know if something needs them in the wrong place.

@todb-r7

This comment has been minimized.

Show comment
Hide comment
Contributor

todb-r7 commented Jan 23, 2015

@jhart-r7

This comment has been minimized.

Show comment
Hide comment
@jhart-r7

jhart-r7 Jan 24, 2015

Contributor

Correct -- none of these work without a `bundle exec``:

$  for f in /home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msf*; do
$f
done
/home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'metasploit-framework' (>= 0) among 253 total gem(s) (Gem::LoadError)
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msfvenom:22:in `<main>'
..
<repeat> for each msf* executable in there

But, if I redo that but with a bundle exec $f -h, I see the help for all of them.

Contributor

jhart-r7 commented Jan 24, 2015

Correct -- none of these work without a `bundle exec``:

$  for f in /home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msf*; do
$f
done
/home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'metasploit-framework' (>= 0) among 253 total gem(s) (Gem::LoadError)
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /home/jhart/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bin/msfvenom:22:in `<main>'
..
<repeat> for each msf* executable in there

But, if I redo that but with a bundle exec $f -h, I see the help for all of them.

@bturner-r7

This comment has been minimized.

Show comment
Hide comment
@bturner-r7

bturner-r7 Jan 25, 2015

Contributor

Well just to add some more complications. It works for me:

bturner:~/rapid7/metasploit-framework (master u=)$ rvm current
ruby-2.1.5@metasploit-framework
bturner:~/rapid7/metasploit-framework (master u=)$ which msfconsole
/Users/bturner/.rvm/gems/ruby-2.1.5@metasploit-framework/bin/msfconsole
bturner:~/rapid7/metasploit-framework (master u=)$ msfconsole
[*] Starting the Metasploit Framework console...-
  +-------------------------------------------------------+
  |  METASPLOIT by Rapid7                                 |
  +---------------------------+---------------------------+
  |      __________________   |                           |
  |  ==c(______(o(______(_()  | |""""""""""""|======[***  |
  |             )=\           | |  EXPLOIT   \            |
  |            // \\          | |_____________\_______    |
  |           //   \\         | |==[msf >]============\   |
  |          //     \\        | |______________________\  |
  |         // RECON \\       | \(@)(@)(@)(@)(@)(@)(@)/   |
  |        //         \\      |  *********************    |
  +---------------------------+---------------------------+
  |      o O o                |        \'\/\/\/'/         |
  |              o O          |         )======(          |
  |                 o         |       .'  LOOT  '.        |
  | |^^^^^^^^^^^^^^|l___      |      /    _||__   \       |
  | |    PAYLOAD     |""\___, |     /    (_||_     \      |
  | |________________|__|)__| |    |     __||_)     |     |
  | |(@)(@)"""**|(@)(@)**|(@) |    "       ||       "     |
  |  = = = = = = = = = = = =  |     '--------------'      |
  +---------------------------+---------------------------+


       =[ metasploit v4.11.0-dev [core:4.11.0.pre.dev api:1.0.0]]
+ -- --=[ 1391 exploits - 786 auxiliary - 224 post        ]
+ -- --=[ 356 payloads - 37 encoders - 8 nops             ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

msf >
Contributor

bturner-r7 commented Jan 25, 2015

Well just to add some more complications. It works for me:

bturner:~/rapid7/metasploit-framework (master u=)$ rvm current
ruby-2.1.5@metasploit-framework
bturner:~/rapid7/metasploit-framework (master u=)$ which msfconsole
/Users/bturner/.rvm/gems/ruby-2.1.5@metasploit-framework/bin/msfconsole
bturner:~/rapid7/metasploit-framework (master u=)$ msfconsole
[*] Starting the Metasploit Framework console...-
  +-------------------------------------------------------+
  |  METASPLOIT by Rapid7                                 |
  +---------------------------+---------------------------+
  |      __________________   |                           |
  |  ==c(______(o(______(_()  | |""""""""""""|======[***  |
  |             )=\           | |  EXPLOIT   \            |
  |            // \\          | |_____________\_______    |
  |           //   \\         | |==[msf >]============\   |
  |          //     \\        | |______________________\  |
  |         // RECON \\       | \(@)(@)(@)(@)(@)(@)(@)/   |
  |        //         \\      |  *********************    |
  +---------------------------+---------------------------+
  |      o O o                |        \'\/\/\/'/         |
  |              o O          |         )======(          |
  |                 o         |       .'  LOOT  '.        |
  | |^^^^^^^^^^^^^^|l___      |      /    _||__   \       |
  | |    PAYLOAD     |""\___, |     /    (_||_     \      |
  | |________________|__|)__| |    |     __||_)     |     |
  | |(@)(@)"""**|(@)(@)**|(@) |    "       ||       "     |
  |  = = = = = = = = = = = =  |     '--------------'      |
  +---------------------------+---------------------------+


       =[ metasploit v4.11.0-dev [core:4.11.0.pre.dev api:1.0.0]]
+ -- --=[ 1391 exploits - 786 auxiliary - 224 post        ]
+ -- --=[ 356 payloads - 37 encoders - 8 nops             ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

msf >
@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator Jan 25, 2015

Contributor

Are you running it not from inside the metasploit-framework folder? seems you are, navigate outside of it say to your home folder and run the symlink from there

On Jan 24, 2015, at 8:21 PM, Brandon Turner notifications@github.com wrote:

Well just to add some more complications. It works for me:

bturner:/rapid7/metasploit-framework (master u=)$ rvm current
ruby-2.1.5@metasploit-framework
bturner:
/rapid7/metasploit-framework (master u=)$ which msfconsole
/Users/bturner/.rvm/gems/ruby-2.1.5@metasploit-framework/bin/msfconsole
bturner:~/rapid7/metasploit-framework (master u=)$ msfconsole
[] Starting the Metasploit Framework console...-
+-------------------------------------------------------+
| METASPLOIT by Rapid7 |
+---------------------------+---------------------------+
| __________________ | |
| ==c(
(o((() | |""""""""""""|======[** |
| )=\ | | EXPLOIT \ |
| // \ | |
___________ |
| // \ | |==[msf >]============\ |
| // \ | |_______________\ |
| // RECON \ | (@)(@)(@)(@)(@)(@)(@)/ |
| // \ | ********************* |
+---------------------------+---------------------------+
| o O o | '///'/ |
| o O | )======( |
| o | .' LOOT '. |
| |^^^^^^^^^^^^^^|l
| / ||_ \ |
| | PAYLOAD |""
**, | / (
||
\ |
| |______________||)**| | | __||
) | |
| |(@)(@)"""|(@)(@)|(@) | " || " |
| = = = = = = = = = = = = | '--------------' |
+---------------------------+---------------------------+

   =[ metasploit v4.11.0-dev [core:4.11.0.pre.dev api:1.0.0]]
  • -- --=[ 1391 exploits - 786 auxiliary - 224 post ]
  • -- --=[ 356 payloads - 37 encoders - 8 nops ]
  • -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

msf >

Reply to this email directly or view it on GitHub #4602 (comment).

Contributor

darkoperator commented Jan 25, 2015

Are you running it not from inside the metasploit-framework folder? seems you are, navigate outside of it say to your home folder and run the symlink from there

On Jan 24, 2015, at 8:21 PM, Brandon Turner notifications@github.com wrote:

Well just to add some more complications. It works for me:

bturner:/rapid7/metasploit-framework (master u=)$ rvm current
ruby-2.1.5@metasploit-framework
bturner:
/rapid7/metasploit-framework (master u=)$ which msfconsole
/Users/bturner/.rvm/gems/ruby-2.1.5@metasploit-framework/bin/msfconsole
bturner:~/rapid7/metasploit-framework (master u=)$ msfconsole
[] Starting the Metasploit Framework console...-
+-------------------------------------------------------+
| METASPLOIT by Rapid7 |
+---------------------------+---------------------------+
| __________________ | |
| ==c(
(o((() | |""""""""""""|======[** |
| )=\ | | EXPLOIT \ |
| // \ | |
___________ |
| // \ | |==[msf >]============\ |
| // \ | |_______________\ |
| // RECON \ | (@)(@)(@)(@)(@)(@)(@)/ |
| // \ | ********************* |
+---------------------------+---------------------------+
| o O o | '///'/ |
| o O | )======( |
| o | .' LOOT '. |
| |^^^^^^^^^^^^^^|l
| / ||_ \ |
| | PAYLOAD |""
**, | / (
||
\ |
| |______________||)**| | | __||
) | |
| |(@)(@)"""|(@)(@)|(@) | " || " |
| = = = = = = = = = = = = | '--------------' |
+---------------------------+---------------------------+

   =[ metasploit v4.11.0-dev [core:4.11.0.pre.dev api:1.0.0]]
  • -- --=[ 1391 exploits - 786 auxiliary - 224 post ]
  • -- --=[ 356 payloads - 37 encoders - 8 nops ]
  • -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

msf >

Reply to this email directly or view it on GitHub #4602 (comment).

@bturner-r7

This comment has been minimized.

Show comment
Hide comment
@bturner-r7

bturner-r7 Jan 25, 2015

Contributor

Navigating outside of my metasploit-framework causes my RVM gemset to change, and thus removes the rvm copies of these binaries from my path (technically changes my path to not included these bins). So for me, from my home directory I get "command not found" - which is ok for me since I use RVM gemsets.

Contributor

bturner-r7 commented Jan 25, 2015

Navigating outside of my metasploit-framework causes my RVM gemset to change, and thus removes the rvm copies of these binaries from my path (technically changes my path to not included these bins). So for me, from my home directory I get "command not found" - which is ok for me since I use RVM gemsets.

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator Jan 25, 2015

Contributor

So it would support the issue of failing to run using symlinks since you would run it more than likely from outside the metasploit-framework folder :)

On Jan 24, 2015, at 8:53 PM, Brandon Turner notifications@github.com wrote:

Navigating outside of my metasploit-framework causes my RVM gemset to change, and thus removes the rvm copies of these binaries from my path (technically changes my path to not included these bins). So for me, from my home directory I get "command not found" - which is ok for me since I use RVM gemsets.


Reply to this email directly or view it on GitHub.

Contributor

darkoperator commented Jan 25, 2015

So it would support the issue of failing to run using symlinks since you would run it more than likely from outside the metasploit-framework folder :)

On Jan 24, 2015, at 8:53 PM, Brandon Turner notifications@github.com wrote:

Navigating outside of my metasploit-framework causes my RVM gemset to change, and thus removes the rvm copies of these binaries from my path (technically changes my path to not included these bins). So for me, from my home directory I get "command not found" - which is ok for me since I use RVM gemsets.


Reply to this email directly or view it on GitHub.

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Feb 1, 2015

Contributor

Can we open a PR to remove these from the gem bin path please?

Contributor

hdm commented Feb 1, 2015

Can we open a PR to remove these from the gem bin path please?

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator Feb 7, 2015

Contributor

Never built a Gem and have no clue how to make the changes but if someone can point me to the file and setting I can do a pull request this afternoon on it so as to get the ball rolling :)

On Feb 1, 2015, at 12:59 AM, HD Moore notifications@github.com wrote:

Can we open a PR to remove these from the gem bin path please?


Reply to this email directly or view it on GitHub.

Contributor

darkoperator commented Feb 7, 2015

Never built a Gem and have no clue how to make the changes but if someone can point me to the file and setting I can do a pull request this afternoon on it so as to get the ball rolling :)

On Feb 1, 2015, at 12:59 AM, HD Moore notifications@github.com wrote:

Can we open a PR to remove these from the gem bin path please?


Reply to this email directly or view it on GitHub.

hdm pushed a commit to hdm/metasploit-framework that referenced this issue Feb 7, 2015

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Feb 7, 2015

Contributor

Added a PR for this: #4729

Contributor

hdm commented Feb 7, 2015

Added a PR for this: #4729

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Feb 7, 2015

Contributor

After the merge, you may still need to remove the msf* utils from your gem bin directory.

Contributor

hdm commented Feb 7, 2015

After the merge, you may still need to remove the msf* utils from your gem bin directory.

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator Feb 7, 2015

Contributor

Cool, as always you rock

On Feb 7, 2015, at 12:51 PM, HD Moore notifications@github.com wrote:

After the merge, you may still need to remove the msf* utils from your gem bin directory.


Reply to this email directly or view it on GitHub.

Contributor

darkoperator commented Feb 7, 2015

Cool, as always you rock

On Feb 7, 2015, at 12:51 PM, HD Moore notifications@github.com wrote:

After the merge, you may still need to remove the msf* utils from your gem bin directory.


Reply to this email directly or view it on GitHub.

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Feb 7, 2015

Contributor

Looks like the fix is breaking our test cases, since they assume the executables will be in the path. Will need someone from the dev team to take a look, its not obvious why it fails on travis and not locally.

Contributor

hdm commented Feb 7, 2015

Looks like the fix is breaking our test cases, since they assume the executables will be in the path. Will need someone from the dev team to take a look, its not obvious why it fails on travis and not locally.

@trosen-r7

This comment has been minimized.

Show comment
Hide comment
@trosen-r7

trosen-r7 Feb 9, 2015

Contributor

@hmoore-r7 Just FYI I am on this w/ @jlee-r7 this AM, looking for a fix that brings harmony to all sides. 😺

Contributor

trosen-r7 commented Feb 9, 2015

@hmoore-r7 Just FYI I am on this w/ @jlee-r7 this AM, looking for a fix that brings harmony to all sides. 😺

@limhoff-r7

This comment has been minimized.

Show comment
Hide comment
@limhoff-r7

limhoff-r7 Feb 9, 2015

Contributor

Based on https://github.com/sstephenson/rbenv/wiki/Understanding-binstubs#bundler-generated-binstubs, you can do:

all metasploit-framework dependencies binstubs

cd ~/msf
bundle install --binstubs
ln -sf /root/msf/bin/msf* /usr/local/bin

to add the bins from all gems in the bundle to the ~/msf/bin directory. These binstubs will differ from the default ones that bundle install is generated because the default ones are the ones made by gem install and so are only gem aware and not Gemfile aware.

gem install binstub generated by bundle install

#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'metasploit-framework' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
    version = $1
    ARGV.shift
  end
end

gem 'metasploit-framework', version
load Gem.bin_path('metasploit-framework', 'msfconsole', version)

binstub generated by bundle install --binstubs

#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'msfconsole' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('metasploit-framework', 'msfconsole')

metasploit-framework only binstubs

If you only want the binstubs from metasploit-framework you can do

cd ~/msf
bundle install
bundle binstubs metasploit-framework
ln -sf /root/msf/bin/msf* /usr/local/bin
Contributor

limhoff-r7 commented Feb 9, 2015

Based on https://github.com/sstephenson/rbenv/wiki/Understanding-binstubs#bundler-generated-binstubs, you can do:

all metasploit-framework dependencies binstubs

cd ~/msf
bundle install --binstubs
ln -sf /root/msf/bin/msf* /usr/local/bin

to add the bins from all gems in the bundle to the ~/msf/bin directory. These binstubs will differ from the default ones that bundle install is generated because the default ones are the ones made by gem install and so are only gem aware and not Gemfile aware.

gem install binstub generated by bundle install

#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'metasploit-framework' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
    version = $1
    ARGV.shift
  end
end

gem 'metasploit-framework', version
load Gem.bin_path('metasploit-framework', 'msfconsole', version)

binstub generated by bundle install --binstubs

#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'msfconsole' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('metasploit-framework', 'msfconsole')

metasploit-framework only binstubs

If you only want the binstubs from metasploit-framework you can do

cd ~/msf
bundle install
bundle binstubs metasploit-framework
ln -sf /root/msf/bin/msf* /usr/local/bin
@jlee-r7

This comment has been minimized.

Show comment
Hide comment
@jlee-r7

jlee-r7 Feb 9, 2015

Contributor

@limhoff-r7 I don't think that solves the problem since the gem install generated stubs will still be first in $PATH because rvm prepends gem bins directories.

Contributor

jlee-r7 commented Feb 9, 2015

@limhoff-r7 I don't think that solves the problem since the gem install generated stubs will still be first in $PATH because rvm prepends gem bins directories.

@jlee-r7

This comment has been minimized.

Show comment
Hide comment
@jlee-r7

jlee-r7 Feb 9, 2015

Contributor

This works for me:

bundle install
bundle binstubs metasploit-framework --path=$(dirname $(which msfconsole)) --force
Contributor

jlee-r7 commented Feb 9, 2015

This works for me:

bundle install
bundle binstubs metasploit-framework --path=$(dirname $(which msfconsole)) --force
@jlee-r7

This comment has been minimized.

Show comment
Hide comment
@jlee-r7

jlee-r7 Feb 9, 2015

Contributor

Alternatively,

alias msfconsole=(cd /path/to/metasploit-framework; msfconsole)
Contributor

jlee-r7 commented Feb 9, 2015

Alternatively,

alias msfconsole=(cd /path/to/metasploit-framework; msfconsole)
@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Feb 9, 2015

Contributor

The main downside of Dir.chdir or bash aliases is that relative file paths to msfconsole arguments will break. For example:

msfconsole -r hacktheplanet.rc
Contributor

hdm commented Feb 9, 2015

The main downside of Dir.chdir or bash aliases is that relative file paths to msfconsole arguments will break. For example:

msfconsole -r hacktheplanet.rc
@jlee-r7

This comment has been minimized.

Show comment
Hide comment
@jlee-r7

jlee-r7 Feb 9, 2015

Contributor

the bin stubs are an artifact of gem install

Contributor

jlee-r7 commented Feb 9, 2015

the bin stubs are an artifact of gem install

@jlee-r7

This comment has been minimized.

Show comment
Hide comment
@jlee-r7

jlee-r7 Feb 9, 2015

Contributor

which is called by bundle install

Contributor

jlee-r7 commented Feb 9, 2015

which is called by bundle install

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Feb 9, 2015

Contributor

These are generated because the gemspec lists them as executables. Is there any reason we are doing this, given that they dont work by default today? It seems like the correct fix is to stop putting them in the gem bin path in the first place (comment out the executables session, like the PR does). The issue I ran into with the PR is that our cucumber tests assume they will be in the path.

Contributor

hdm commented Feb 9, 2015

These are generated because the gemspec lists them as executables. Is there any reason we are doing this, given that they dont work by default today? It seems like the correct fix is to stop putting them in the gem bin path in the first place (comment out the executables session, like the PR does). The issue I ran into with the PR is that our cucumber tests assume they will be in the path.

@todb-r7 todb-r7 added the delayed label Feb 11, 2015

@todb-r7 todb-r7 assigned cdoughty-r7 and unassigned todb-r7 Feb 11, 2015

@todb-r7

This comment has been minimized.

Show comment
Hide comment
@todb-r7

todb-r7 Feb 11, 2015

Contributor

Experimentation with this by @bturner-r7 and @cdoughty-r7 seems to have caused issues with Windows deployments. They are still experimenting with the causes and workarounds.

I'll assign this to @cdoughty-r7 for future updates -- and have marked this as delayed. Feel free to assign back if there's reason to move forward here.

Contributor

todb-r7 commented Feb 11, 2015

Experimentation with this by @bturner-r7 and @cdoughty-r7 seems to have caused issues with Windows deployments. They are still experimenting with the causes and workarounds.

I'll assign this to @cdoughty-r7 for future updates -- and have marked this as delayed. Feel free to assign back if there's reason to move forward here.

@todb-r7

This comment has been minimized.

Show comment
Hide comment
@todb-r7

todb-r7 Feb 18, 2015

Contributor

Given the deps on Metasploit QE (see PR #4729), labeling this with jira so I don't forget about it.

Contributor

todb-r7 commented Feb 18, 2015

Given the deps on Metasploit QE (see PR #4729), labeling this with jira so I don't forget about it.

@todb-r7 todb-r7 added the jira label Feb 18, 2015

@todb-r7

This comment has been minimized.

Show comment
Hide comment
@todb-r7

todb-r7 Feb 24, 2015

Contributor

Removing the jira label since this does not seem to be QE's bag after all.

Contributor

todb-r7 commented Feb 24, 2015

Removing the jira label since this does not seem to be QE's bag after all.

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Feb 25, 2015

Contributor

Closed the PR. There are a few paths forward, but someone else will need to pick this up:
Either:

  • Remove the bins from the gemspec (since metasploit-framework as gem doesn't want nor need these) and fix the corresponding cucumber tests to pass OR...
  • Find a way to tweak the boot scripts so that the default binstubs works OR...
  • Add the binstubs workaround to msfupdate and public documentation

This issue primarily affects git users, reassigning to @todb-r7 for now to triage.

Contributor

hdm commented Feb 25, 2015

Closed the PR. There are a few paths forward, but someone else will need to pick this up:
Either:

  • Remove the bins from the gemspec (since metasploit-framework as gem doesn't want nor need these) and fix the corresponding cucumber tests to pass OR...
  • Find a way to tweak the boot scripts so that the default binstubs works OR...
  • Add the binstubs workaround to msfupdate and public documentation

This issue primarily affects git users, reassigning to @todb-r7 for now to triage.

@hdm hdm assigned todb-r7 and unassigned cdoughty-r7 Feb 25, 2015

@EastL

This comment has been minimized.

Show comment
Hide comment
@EastL

EastL Mar 12, 2015

I got this ERROR......

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb 

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from extconf.rb:4:in `

'

Gem files will remain installed in /tmp/bundler20150312-17392-1f9lupc/ffi-1.9.3/gems/ffi-1.9.3 for inspection.
Results logged to /tmp/bundler20150312-17392-1f9lupc/ffi-1.9.3/gems/ffi-1.9.3/ext/ffi_c/gem_make.out
An error occurred while installing ffi (1.9.3), and Bundler cannot continue.
Make sure that gem install ffi -v '1.9.3' succeeds before bundling.

And I do this command gem install ffi -v '1.9.3' , I got :

eric@eric-X200MA:~/Devlopment/metasploit-framework$ gem install ffi -v '1.9.3'Building native extensions. This could take a while...
Successfully installed ffi-1.9.3
Parsing documentation for ffi-1.9.3
Done installing documentation for ffi after 7 seconds
1 gem installed

what should i do.........

EastL commented Mar 12, 2015

I got this ERROR......

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb 

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from extconf.rb:4:in `

'

Gem files will remain installed in /tmp/bundler20150312-17392-1f9lupc/ffi-1.9.3/gems/ffi-1.9.3 for inspection.
Results logged to /tmp/bundler20150312-17392-1f9lupc/ffi-1.9.3/gems/ffi-1.9.3/ext/ffi_c/gem_make.out
An error occurred while installing ffi (1.9.3), and Bundler cannot continue.
Make sure that gem install ffi -v '1.9.3' succeeds before bundling.

And I do this command gem install ffi -v '1.9.3' , I got :

eric@eric-X200MA:~/Devlopment/metasploit-framework$ gem install ffi -v '1.9.3'Building native extensions. This could take a while...
Successfully installed ffi-1.9.3
Parsing documentation for ffi-1.9.3
Done installing documentation for ffi after 7 seconds
1 gem installed

what should i do.........

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Mar 12, 2015

Contributor

@EastL The issue you mentioned is unrelated to this ticket. First you would need the ruby-dev package in order to get mkmf, but note that we now require ruby 2.1.5 or newer, so please switch to RVM instead of system ruby. See https://github.com/rapid7/metasploit-framework/wiki/Setting-Up-a-Metasploit-Development-Environment for more information

Contributor

hdm commented Mar 12, 2015

@EastL The issue you mentioned is unrelated to this ticket. First you would need the ruby-dev package in order to get mkmf, but note that we now require ruby 2.1.5 or newer, so please switch to RVM instead of system ruby. See https://github.com/rapid7/metasploit-framework/wiki/Setting-Up-a-Metasploit-Development-Environment for more information

@EastL

This comment has been minimized.

Show comment
Hide comment
@EastL

EastL Mar 13, 2015

OK, thamk you!

2015-03-12 23:44 GMT+08:00 HD Moore notifications@github.com:

@EastL https://github.com/EastL The issue you mentioned is unrelated to
this ticket. First you would need the ruby-dev package in order to get
mkmf, but note that we now require ruby 2.1.5 or newer, so please switch to
RVM instead of system ruby. See
https://github.com/rapid7/metasploit-framework/wiki/Setting-Up-a-Metasploit-Development-Environment
for more information


Reply to this email directly or view it on GitHub
#4602 (comment)
.

EastL commented Mar 13, 2015

OK, thamk you!

2015-03-12 23:44 GMT+08:00 HD Moore notifications@github.com:

@EastL https://github.com/EastL The issue you mentioned is unrelated to
this ticket. First you would need the ruby-dev package in order to get
mkmf, but note that we now require ruby 2.1.5 or newer, so please switch to
RVM instead of system ruby. See
https://github.com/rapid7/metasploit-framework/wiki/Setting-Up-a-Metasploit-Development-Environment
for more information


Reply to this email directly or view it on GitHub
#4602 (comment)
.

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator Apr 11, 2015

Contributor

I know it is only a couple of months but any update on when this will be fixed?

Contributor

darkoperator commented Apr 11, 2015

I know it is only a couple of months but any update on when this will be fixed?

@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Apr 12, 2015

Contributor

This workaround may solve it for now (as part of your scripts):

bundle install
bundle binstubs metasploit-framework --path=$(dirname $(which msfconsole)) --force
Contributor

hdm commented Apr 12, 2015

This workaround may solve it for now (as part of your scripts):

bundle install
bundle binstubs metasploit-framework --path=$(dirname $(which msfconsole)) --force
@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Apr 12, 2015

Contributor

Alternatively, just delete the binstubs

Contributor

hdm commented Apr 12, 2015

Alternatively, just delete the binstubs

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator Apr 12, 2015

Contributor

tried that but something else is missing somewhere. Linking to the binstub did work

Infidel01:~ carlos$ ln -s /Users/carlos/.rvm/gems/ruby-2.1.5/bin/msfconsole /usr/local/bin/msfconsole
Infidel01:~ carlos$ msfconsole 
[*] Starting the Metasploit Framework console...\

wonder if that would be a safe alternative

Contributor

darkoperator commented Apr 12, 2015

tried that but something else is missing somewhere. Linking to the binstub did work

Infidel01:~ carlos$ ln -s /Users/carlos/.rvm/gems/ruby-2.1.5/bin/msfconsole /usr/local/bin/msfconsole
Infidel01:~ carlos$ msfconsole 
[*] Starting the Metasploit Framework console...\

wonder if that would be a safe alternative

bcook-r7 added a commit to busterb/metasploit-framework that referenced this issue Apr 30, 2015

@bcook-r7

This comment has been minimized.

Show comment
Hide comment
@bcook-r7

bcook-r7 Apr 30, 2015

Contributor

I refreshed the original PR with the fix for cucumber, will sort through the rest of the issues with Brandon on Monday.

Contributor

bcook-r7 commented Apr 30, 2015

I refreshed the original PR with the fix for cucumber, will sort through the rest of the issues with Brandon on Monday.

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator May 20, 2015

Contributor

yep removing the bins from the bundle install should find this problem. Here I removed them by hand as as you can see it works now with symlinks with no problems.

carlos@ubuntu:~$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.7
  - RUBY VERSION: 2.1.6 (2015-04-13 patchlevel 336) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework
  - RUBY EXECUTABLE: /home/carlos/.rvm/rubies/ruby-2.1.6/bin/ruby
  - EXECUTABLE DIRECTORY: /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin
  - SPEC CACHE DIRECTORY: /home/carlos/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/carlos/.rvm/rubies/ruby-2.1.6/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework
     - /home/carlos/.rvm/gems/ruby-2.1.6@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin
     - /home/carlos/.rvm/gems/ruby-2.1.6@global/bin
     - /home/carlos/.rvm/rubies/ruby-2.1.6/bin
     - /home/carlos/.rvm/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
carlos@ubuntu:~$ ls /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin
autospec  coderay   htmldiff  mdm_console  msfconsole  msfencode    msfpescan  msfrpcd    nokogiri  rails         recog_match   rspec                  sprockets  yard
bundle    cucumber  jsobfu    msfbinscan   msfd        msfmachscan  msfrop     msfupdate  pry       rake          recog_verify  ruby_executable_hooks  thor       yardoc
bundler   erubis    ldiff     msfcli       msfelfscan  msfpayload   msfrpc     msfvenom   rackup    recog_export  redcarpet     setup                  tilt       yri
carlos@ubuntu:~$ rm /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin/msf*
carlos@ubuntu:~$ whereis msfconsole
msfconsole: /usr/local/bin/msfconsole
carlos@ubuntu:~$ msfconsole 
[*] Starting the Metasploit Framework console.../
                          ########                  #
                      #################            #
                   ######################         #
                  #########################      #
                ############################
               ##############################
               ###############################
              ###############################
              ##############################
                              #    ########   #
                 ##        ###        ####   ##
                                      ###   ###
                                    ####   ###
               ####          ##########   ####
               #######################   ####
                 ####################   ####
                  ##################  ####
                    ############      ##
                       ########        ###
                      #########        #####
                    ############      ######
                   ########      #########
                     #####       ########
                       ###       #########
                      ######    ############
                     #######################
                     #   #   ###  #   #   ##
                     ########################
                      ##     ##   ##     ##
                            http://metasploit.pro


       =[ metasploit v4.11.0-dev [core:4.11.0.pre.dev api:1.0.0]]
+ -- --=[ 1454 exploits - 832 auxiliary - 229 post        ]
+ -- --=[ 376 payloads - 37 encoders - 8 nops             ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

msf > 

any update on when would this fix be pushed out?

Contributor

darkoperator commented May 20, 2015

yep removing the bins from the bundle install should find this problem. Here I removed them by hand as as you can see it works now with symlinks with no problems.

carlos@ubuntu:~$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.7
  - RUBY VERSION: 2.1.6 (2015-04-13 patchlevel 336) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework
  - RUBY EXECUTABLE: /home/carlos/.rvm/rubies/ruby-2.1.6/bin/ruby
  - EXECUTABLE DIRECTORY: /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin
  - SPEC CACHE DIRECTORY: /home/carlos/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/carlos/.rvm/rubies/ruby-2.1.6/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework
     - /home/carlos/.rvm/gems/ruby-2.1.6@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin
     - /home/carlos/.rvm/gems/ruby-2.1.6@global/bin
     - /home/carlos/.rvm/rubies/ruby-2.1.6/bin
     - /home/carlos/.rvm/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
carlos@ubuntu:~$ ls /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin
autospec  coderay   htmldiff  mdm_console  msfconsole  msfencode    msfpescan  msfrpcd    nokogiri  rails         recog_match   rspec                  sprockets  yard
bundle    cucumber  jsobfu    msfbinscan   msfd        msfmachscan  msfrop     msfupdate  pry       rake          recog_verify  ruby_executable_hooks  thor       yardoc
bundler   erubis    ldiff     msfcli       msfelfscan  msfpayload   msfrpc     msfvenom   rackup    recog_export  redcarpet     setup                  tilt       yri
carlos@ubuntu:~$ rm /home/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin/msf*
carlos@ubuntu:~$ whereis msfconsole
msfconsole: /usr/local/bin/msfconsole
carlos@ubuntu:~$ msfconsole 
[*] Starting the Metasploit Framework console.../
                          ########                  #
                      #################            #
                   ######################         #
                  #########################      #
                ############################
               ##############################
               ###############################
              ###############################
              ##############################
                              #    ########   #
                 ##        ###        ####   ##
                                      ###   ###
                                    ####   ###
               ####          ##########   ####
               #######################   ####
                 ####################   ####
                  ##################  ####
                    ############      ##
                       ########        ###
                      #########        #####
                    ############      ######
                   ########      #########
                     #####       ########
                       ###       #########
                      ######    ############
                     #######################
                     #   #   ###  #   #   ##
                     ########################
                      ##     ##   ##     ##
                            http://metasploit.pro


       =[ metasploit v4.11.0-dev [core:4.11.0.pre.dev api:1.0.0]]
+ -- --=[ 1454 exploits - 832 auxiliary - 229 post        ]
+ -- --=[ 376 payloads - 37 encoders - 8 nops             ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

msf > 

any update on when would this fix be pushed out?

@bcook-r7

This comment has been minimized.

Show comment
Hide comment
@bcook-r7

bcook-r7 May 20, 2015

Contributor

Well, it caused a regression with the pro/community installer causing the Windows console tools to stop working. Still waiting on a fix for that; I've closed the PR for now.

Contributor

bcook-r7 commented May 20, 2015

Well, it caused a regression with the pro/community installer causing the Windows console tools to stop working. Still waiting on a fix for that; I've closed the PR for now.

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator May 20, 2015

Contributor

that sucks, but understand the problem. Wonder if there is something I could add to ~/.gemrc to change the path order to fix it in the meen time.

Contributor

darkoperator commented May 20, 2015

that sucks, but understand the problem. Wonder if there is something I could add to ~/.gemrc to change the path order to fix it in the meen time.

@bcook-r7

This comment has been minimized.

Show comment
Hide comment
@bcook-r7

bcook-r7 May 20, 2015

Contributor

Locally, I simply have /usr/local/bin set earlier in the search path than the gem bin path in my .profile.

Contributor

bcook-r7 commented May 20, 2015

Locally, I simply have /usr/local/bin set earlier in the search path than the gem bin path in my .profile.

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator May 20, 2015

Contributor

in my case tried .bashrc, .profile and no luck still the gem shims get placed ahead even if I add export PATH="/usr/local/bin:$PATH" to the last line

Contributor

darkoperator commented May 20, 2015

in my case tried .bashrc, .profile and no luck still the gem shims get placed ahead even if I add export PATH="/usr/local/bin:$PATH" to the last line

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator May 20, 2015

Contributor

ok on Ubuntu it is .bash_profile :)

Contributor

darkoperator commented May 20, 2015

ok on Ubuntu it is .bash_profile :)

@busterb

This comment has been minimized.

Show comment
Hide comment
@busterb

busterb May 21, 2015

Contributor

Don't worry, I won't judge :)

Contributor

busterb commented May 21, 2015

Don't worry, I won't judge :)

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator May 21, 2015

Contributor

nevermind even on OS X it blows up after I close and open a new terminal. It hates that the gem path is no the first one

nfidel01:~ carlos$ msfvenom 
Ignoring bcrypt-3.1.10 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.10
Could not find minitest-4.7.5 in any of the sources
Run `bundle install` to install missing gems.
Infidel01:~ carlos$ rvm gemset use metasploit-framewrok
Warning! PATH is not properly set up, '/Users/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin' is not available,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.1.6@metasploit-framework'.
Gemset 'metasploit-framewrok' does not exist, 'rvm ruby-2.1.6 do rvm gemset create metasploit-framewrok' first, or append '--create'.
Infidel01:~ carlos$ rvm use ruby-2.1.6@metasploit-framework
Warning! PATH is not properly set up, '/Users/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin' is not available,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.1.6@metasploit-framework'.
Using /Users/carlos/.rvm/gems/ruby-2.1.6 with gemset metasploit-framework
Infidel01:~ carlos$ msfvenom 
No options
Usage: /usr/local/bin/msfvenom [options] <var=val>

Options:
    -p, --payload       <payload>    Payload to use. Specify a '-' or stdin to use custom payloads
        --payload-options            List the payload's standard options
    -l, --list          [type]       List a module type. Options are: payloads, encoders, nops, all
    -n, --nopsled       <length>     Prepend a nopsled of [length] size on to the payload
    -f, --format        <format>     Output format (use --help-formats for a list)
        --help-formats               List available formats
    -e, --encoder       <encoder>    The encoder to use
    -a, --arch          <arch>       The architecture to use
        --platform      <platform>   The platform of the payload
    -s, --space         <length>     The maximum size of the resulting payload
        --encoder-space <length>     The maximum size of the encoded payload (defaults to the -s value)
    -b, --bad-chars     <list>       The list of characters to avoid example: '\x00\xff'
    -i, --iterations    <count>      The number of times to encode the payload
    -c, --add-code      <path>       Specify an additional win32 shellcode file to include
    -x, --template      <path>       Specify a custom executable file to use as a template
    -k, --keep                       Preserve the template behavior and inject the payload as a new thread
    -o, --out           <path>       Save the payload
    -v, --var-name      <name>       Specify a custom variable name to use for certain output formats
    -h, --help                       Show this message
Infidel01:~ carlos$ 
Contributor

darkoperator commented May 21, 2015

nevermind even on OS X it blows up after I close and open a new terminal. It hates that the gem path is no the first one

nfidel01:~ carlos$ msfvenom 
Ignoring bcrypt-3.1.10 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.10
Could not find minitest-4.7.5 in any of the sources
Run `bundle install` to install missing gems.
Infidel01:~ carlos$ rvm gemset use metasploit-framewrok
Warning! PATH is not properly set up, '/Users/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin' is not available,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.1.6@metasploit-framework'.
Gemset 'metasploit-framewrok' does not exist, 'rvm ruby-2.1.6 do rvm gemset create metasploit-framewrok' first, or append '--create'.
Infidel01:~ carlos$ rvm use ruby-2.1.6@metasploit-framework
Warning! PATH is not properly set up, '/Users/carlos/.rvm/gems/ruby-2.1.6@metasploit-framework/bin' is not available,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.1.6@metasploit-framework'.
Using /Users/carlos/.rvm/gems/ruby-2.1.6 with gemset metasploit-framework
Infidel01:~ carlos$ msfvenom 
No options
Usage: /usr/local/bin/msfvenom [options] <var=val>

Options:
    -p, --payload       <payload>    Payload to use. Specify a '-' or stdin to use custom payloads
        --payload-options            List the payload's standard options
    -l, --list          [type]       List a module type. Options are: payloads, encoders, nops, all
    -n, --nopsled       <length>     Prepend a nopsled of [length] size on to the payload
    -f, --format        <format>     Output format (use --help-formats for a list)
        --help-formats               List available formats
    -e, --encoder       <encoder>    The encoder to use
    -a, --arch          <arch>       The architecture to use
        --platform      <platform>   The platform of the payload
    -s, --space         <length>     The maximum size of the resulting payload
        --encoder-space <length>     The maximum size of the encoded payload (defaults to the -s value)
    -b, --bad-chars     <list>       The list of characters to avoid example: '\x00\xff'
    -i, --iterations    <count>      The number of times to encode the payload
    -c, --add-code      <path>       Specify an additional win32 shellcode file to include
    -x, --template      <path>       Specify a custom executable file to use as a template
    -k, --keep                       Preserve the template behavior and inject the payload as a new thread
    -o, --out           <path>       Save the payload
    -v, --var-name      <name>       Specify a custom variable name to use for certain output formats
    -h, --help                       Show this message
Infidel01:~ carlos$ 
@hdm

This comment has been minimized.

Show comment
Hide comment
@hdm

hdm Sep 3, 2015

Contributor

@bcook is this still an issue?

Contributor

hdm commented Sep 3, 2015

@bcook is this still an issue?

@jlmurray

This comment has been minimized.

Show comment
Hide comment
@jlmurray

jlmurray Nov 6, 2015

Not sure if this is the same problem, but I was trying to set up the development environment on a Kali Linux VirtualBox image and got a similar error about "incompatible library version". None of the above fixes worked for me, but I noticed that if I tried to run the msfconsole from a different directory I got an error about rake not being found. So I ran bundle install outside my metasploit-framework directory with:

bundle install --path metasploit-framework/ --gemfile metasploit-framework/Gemfile

and now it works.

jlmurray commented Nov 6, 2015

Not sure if this is the same problem, but I was trying to set up the development environment on a Kali Linux VirtualBox image and got a similar error about "incompatible library version". None of the above fixes worked for me, but I noticed that if I tried to run the msfconsole from a different directory I got an error about rake not being found. So I ran bundle install outside my metasploit-framework directory with:

bundle install --path metasploit-framework/ --gemfile metasploit-framework/Gemfile

and now it works.

@edwinomario

This comment has been minimized.

Show comment
Hide comment
@edwinomario

edwinomario Dec 27, 2015

I used
sudo bundle install

and it worked great.

I used
sudo bundle install

and it worked great.

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator Dec 27, 2015

Contributor

The bug is with RVM, one of this days it will be fixed :P

Sent from my iPhone

On Dec 27, 2015, at 9:57 AM, edwinomario notifications@github.com wrote:

I used
sudo bundle install

and it worked great.


Reply to this email directly or view it on GitHub.

Contributor

darkoperator commented Dec 27, 2015

The bug is with RVM, one of this days it will be fixed :P

Sent from my iPhone

On Dec 27, 2015, at 9:57 AM, edwinomario notifications@github.com wrote:

I used
sudo bundle install

and it worked great.


Reply to this email directly or view it on GitHub.

@bcook-r7

This comment has been minimized.

Show comment
Hide comment
@bcook-r7

bcook-r7 Dec 28, 2015

Contributor

It should hopefully be fixed soon; we've been working on weaning the pro builds off requiring the binstubs in framework. @darkbushido should have more info.

Contributor

bcook-r7 commented Dec 28, 2015

It should hopefully be fixed soon; we've been working on weaning the pro builds off requiring the binstubs in framework. @darkbushido should have more info.

@darkbushido

This comment has been minimized.

Show comment
Hide comment
@darkbushido

darkbushido Dec 28, 2015

Contributor

We arent getting rid of binstubs since we need them in pro. but they are not going to be turned on by default. The planned changes are over here.

1e7ea18
d0f8506

we will only create the binstubs if CREATE_BINSTUBS env is set and we set it in travis. if your running cucumber locally you will need to run bundle install CREATE_BINSTUBS=true

Contributor

darkbushido commented Dec 28, 2015

We arent getting rid of binstubs since we need them in pro. but they are not going to be turned on by default. The planned changes are over here.

1e7ea18
d0f8506

we will only create the binstubs if CREATE_BINSTUBS env is set and we set it in travis. if your running cucumber locally you will need to run bundle install CREATE_BINSTUBS=true

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Dec 31, 2015

I'm trying to setup a dev environment using Kali 2.0 64-bit, and I'm having an incompatible library version error when I get to the ./msfconsole part. None of the above fixes work. Is this due to RVM as per @darkoperator ?

ghost commented Dec 31, 2015

I'm trying to setup a dev environment using Kali 2.0 64-bit, and I'm having an incompatible library version error when I get to the ./msfconsole part. None of the above fixes work. Is this due to RVM as per @darkoperator ?

@bcook-r7

This comment has been minimized.

Show comment
Hide comment
@bcook-r7

bcook-r7 Jan 6, 2016

Contributor

As of #6410, binstubs are no longer installed by default. This should no longer be an issue.

Contributor

bcook-r7 commented Jan 6, 2016

As of #6410, binstubs are no longer installed by default. This should no longer be an issue.

@bcook-r7 bcook-r7 closed this Jan 6, 2016

@void-in

This comment has been minimized.

Show comment
Hide comment
@void-in

void-in Jan 7, 2016

Contributor

@darkoperator Today is one of those days! Thanks to the efforts of @bcook-r7

Contributor

void-in commented Jan 7, 2016

@darkoperator Today is one of those days! Thanks to the efforts of @bcook-r7

@darkoperator

This comment has been minimized.

Show comment
Hide comment
@darkoperator

darkoperator Jan 7, 2016

Contributor

cool! happy to see it was fixed.

On Jan 7, 2016, at 2:01 AM, Waqas Ali notifications@github.com wrote:

@darkoperator https://github.com/darkoperator Today is one of those days! Thanks to the efforts of @bcook-r7 https://github.com/bcook-r7

Reply to this email directly or view it on GitHub #4602 (comment).

Contributor

darkoperator commented Jan 7, 2016

cool! happy to see it was fixed.

On Jan 7, 2016, at 2:01 AM, Waqas Ali notifications@github.com wrote:

@darkoperator https://github.com/darkoperator Today is one of those days! Thanks to the efforts of @bcook-r7 https://github.com/bcook-r7

Reply to this email directly or view it on GitHub #4602 (comment).

@bcook-r7

This comment has been minimized.

Show comment
Hide comment
@bcook-r7

bcook-r7 Jan 7, 2016

Contributor

Note: you make still need to clean up old binstubs in rvm, since upgrading the metasploit-framework gem doesn't seem to delete the old binstubs automatically. I've been reinstalling my gemsets to make sure they're purged, but it can be as simple as manually deleting them:

bcook@toaster:~$ which msfconsole
/home/bcook/.rvm/gems/ruby-2.1.7/bin/msfconsole
bcook@toaster:~$ rm -fr /home/bcook/.rvm/gems/ruby-2.1.7/bin/msf*
bcook@toaster:~$ which msfconsole 
/usr/bin/msfconsole
bcook@toaster:~$ msfconsole 

IIIIII    dTb.dTb        _.---._
  II     4'  v  'B   .'"".'/|\`.""'.
  II     6.     .P  :  .' / | \ `.  :
  II     'T;. .;P'  '.'  /  |  \  `.'
  II      'T; ;P'    `. /   |   \ .'
IIIIII     'YvP'       `-.__|__.-'

I love shells --egypt

Thanks all!

Contributor

bcook-r7 commented Jan 7, 2016

Note: you make still need to clean up old binstubs in rvm, since upgrading the metasploit-framework gem doesn't seem to delete the old binstubs automatically. I've been reinstalling my gemsets to make sure they're purged, but it can be as simple as manually deleting them:

bcook@toaster:~$ which msfconsole
/home/bcook/.rvm/gems/ruby-2.1.7/bin/msfconsole
bcook@toaster:~$ rm -fr /home/bcook/.rvm/gems/ruby-2.1.7/bin/msf*
bcook@toaster:~$ which msfconsole 
/usr/bin/msfconsole
bcook@toaster:~$ msfconsole 

IIIIII    dTb.dTb        _.---._
  II     4'  v  'B   .'"".'/|\`.""'.
  II     6.     .P  :  .' / | \ `.  :
  II     'T;. .;P'  '.'  /  |  \  `.'
  II      'T; ;P'    `. /   |   \ .'
IIIIII     'YvP'       `-.__|__.-'

I love shells --egypt

Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment