Skip to content

Running rb module without msfconsole #20267

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

Open
s0i37 opened this issue May 29, 2025 · 1 comment
Open

Running rb module without msfconsole #20267

s0i37 opened this issue May 29, 2025 · 1 comment
Labels
question Questions about Metasploit Usage

Comments

@s0i37
Copy link

s0i37 commented May 29, 2025

Summary

Hello!
Is it possible to run specified module without running the whole metasploit?
Like a RUBYLIB=/usr/share/metasploit-framework/lib irb exploit/path/to/some.rb
In python I can do this via importing from metasploit import module.

Relevant information

I have an automation tool which run a lot of metasploit modules for checking vulnerabilities. And it spend a lot of time and CPU because of loading msfconsole every time.

Thank you for attention!

@s0i37 s0i37 added the question Questions about Metasploit Usage label May 29, 2025
@bcoles
Copy link
Contributor

bcoles commented May 29, 2025

Hello! Is it possible to run specified module without running the whole metasploit? Like a RUBYLIB=/usr/share/metasploit-framework/lib irb exploit/path/to/some.rb In python I can do this via importing from metasploit import module.

There are a very small number of standalone modules which are designed to be run without msfconsole. For example, https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/dos/smb/smb_loris.rb

I have an automation tool which run a lot of metasploit modules for checking vulnerabilities.

The typical approach to automation is to use RPC. Refer to:

And it spend a lot of time and CPU because of loading msfconsole every time.

In the short term, you can speed up your existing automation implementation with the --defer-module-loads flag. Using this flag significantly increases the msfconsole startup time.

It is also worth noting that several patches were applied recently (in the two most recent releases). If you have not yet updated, these patches should cut the msfconsole startup time in half.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions about Metasploit Usage
Projects
None yet
Development

No branches or pull requests

2 participants