rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
33.73k stars 13.89k forks source link

msfdb on Windows 2019 Server errors #19272

Open mhmcrae opened 2 months ago

mhmcrae commented 2 months ago

Unable to create db on Windows 2019 Server I have tried to run msfdb init and reinit neither one works.

Steps to reproduce

How'd you do it?

  1. PS C:\metasploit-framework\bin> msfdb init
  2. PS C:\metasploit-framework\bin> msfdb reinit

This section should also tell us any relevant information about the environment; for example, if an exploit that used to work is failing, tell us the victim operating system and service versions.

Were you following a specific guide/tutorial or reading documentation?

Following guide at https://github.com/rapid7/metasploit-framework/wiki/msfdb:-Database-Features-&-How-to-Set-up-a-Database-for-Metasploit/1228443d066fa8b20be55c42b1b0540ff3f09278

If yes link the guide/tutorial or documentation you were following here, otherwise you may omit this section.

Expected behavior

What should happen? Database should be created.

Current behavior

What happens instead?
I'm getting the following errors: C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/rex-core-0.1.32/lib/rex/compat.rb:381: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:136:in require': 126: The specified module could not be found. - C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg_ext.so (LoadError) from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:136:inrequire' from C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg.rb:49:in block in <module:PG>' from C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg.rb:32:inrescue in block in ' from C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg.rb:26:in block in <module:PG>' from C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg.rb:42:in' from C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg.rb:6:in <top (required)>' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:141:inrequire' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:141:in rescue in require' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:135:inrequire' from C:/metasploit-framework/bin/../embedded/framework/msfdb:15:in <main>' <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:136:inrequire': 126: The specified module could not be found. - C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg_ext.so (LoadError) from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:136:in require' from C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg.rb:49:inblock in ' from C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/ruby_installer/runtime/dll_directory.rb:81:in initialize' from C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/ruby_installer/runtime/singleton.rb:12:innew' from C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/ruby_installer/runtime/singleton.rb:12:in add_dll_directory' from C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg.rb:28:inblock in ' from C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg.rb:42:in <module:PG>' from C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg.rb:6:in<top (required)>' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:141:in require' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:141:inrescue in require' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:135:in require' from C:/metasploit-framework/bin/../embedded/framework/msfdb:15:in

' <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:136:in require': cannot load such file -- pg (LoadError) from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:136:inrequire' from C:/metasploit-framework/bin/../embedded/framework/msfdb:15:in `
'

Metasploit version

metasploit v6.4.14-dev-e2516bd4946d6cec05e24373bf6b14b6fbb91893 Get this with the version command in msfconsole (or git log -1 --pretty=oneline for a source install).

tekwizz123 commented 1 month ago

@mhmcrae Have you checked to make sure the file C:/metasploit-framework/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.6/lib/pg_ext.so exists? The error is saying that the module could not be found which to me smells of potential file removal due to an AV on the system such as Windows Defender.

I also see you are using the old documentation website, the new one should be at docs.metasploit.com just in case that helps :+1:

github-actions[bot] commented 2 weeks ago

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.