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

Improve stability of msfdb initialization on windows environments #18442

Conversation

adfoster-r7
Copy link
Contributor

closes #17237
closes #15980
Relates to #10805

Improve stability of msfdb initialization on windows environments. Previously the msfdb init script would hang indefinitely on Windows environments, as well as there being false negatives on detecting if the database was running or not.

Verification

cmd > msfdb reinit
...
Database initialization successful
  • Verify that msfconsole works and connects to the database, i.e. msfconsole and the creds command
msf6 > creds
Credentials
===========

host  origin  service  public  private  realm  private_type  JtR Format
----  ------  -------  ------  -------  -----  ------------  ----------

msf6 >

@adfoster-r7 adfoster-r7 force-pushed the improve-stability-of-msfdb-initialization-on-windows-environments branch from 26c40d2 to 7235573 Compare October 10, 2023 14:25
@adfoster-r7 adfoster-r7 added the rn-fix release notes fix label Oct 10, 2023
@cgranleese-r7 cgranleese-r7 self-assigned this Oct 13, 2023
@cgranleese-r7
Copy link
Contributor

Everything seems to be working as expected.

Before

image

After

image

msfconsole

image

@cgranleese-r7 cgranleese-r7 merged commit 44e5a93 into rapid7:master Oct 13, 2023
35 checks passed
@cgranleese-r7
Copy link
Contributor

Release Notes

Improves stability of msfdb initialization on windows environments. Previously the msfdb init script would hang indefinitely on Windows environments, as well as there being false negatives on detecting if the database was running or not.

@Dinamitrii
Copy link

AT LAST!Will try on first run on Windows machine!Is it been tested on Windows 11 already?

@adfoster-r7
Copy link
Contributor Author

It should work, but if it doesn't - let us know and we'll try to replicate and fix 👍

Alternatively - it should work as expected on Linux/Kali environments

@pmorgenrood
Copy link

Not working on Windows 11
OS Name: Microsoft Windows 11 Home Single Language
OS Version: 10.0.22621 N/A Build 22621
I tried on existing installation and downloaded the latest installer msi, then manually downloaded and replaced the pg_ctl.rb file then ran .\msfd.bat reinit and it hangs here:

PS C:\metasploit-framework\bin> .\msfd.bat reinit
C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/rex-core-0.1.31/lib/rex/compat.rb:381: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
[*] Initializing msfd...
[*] Running msfd...
[-] Background mode is not available on this platform

After waiting a while, I sent an interrupt using Ctrl+C

C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/rex-socket-0.1.54/lib/rex/socket/tcp_server.rb:46:in `accept': Interrupt
        from C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/rex-socket-0.1.54/lib/rex/socket/tcp_server.rb:46:in `accept'
        from C:/metasploit-framework/embedded/framework/plugins/msfd.rb:97:in `block in run'
        from C:/metasploit-framework/embedded/framework/plugins/msfd.rb:96:in `loop'
        from C:/metasploit-framework/embedded/framework/plugins/msfd.rb:96:in `run'
        from C:/metasploit-framework/bin/../embedded/framework/msfd:100:in `<main>'

Has anyone managed to get this working on Win 11?

@adfoster-r7
Copy link
Contributor Author

@pmorgenrood It looks like you've made a typo, I believe you want to use msfdb not msfd

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

Successfully merging this pull request may close these issues.

using msfdb on windows 11 failed msfdb init hangs when attempting to start database
4 participants