-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Add option to reload all libs when calling run
or check
on a module
#18381
Add option to reload all libs when calling run
or check
on a module
#18381
Conversation
1499e4c
to
034334f
Compare
@@ -74,6 +74,7 @@ def cmd_run_tabs(str, words) | |||
'-n' => [ framework.nops.map { |refname, mod| refname } ], | |||
'-o' => [ true ], | |||
'-p' => [ framework.payloads.map { |refname, mod| refname } ], | |||
'-r' => [ nil ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not action this just yet, but maybe we could bikeshed on whether reload -a
makes sense or not versus reload -r
- aligning with the existing convention f reload_lib -a
in terms of muscle memory
But I guess it's not got the issue with reload -a
potentially indicating to the user that it will reload all modules (which we already have reload_all
for) 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @smcintyre-r7 Any preferences here? 👀
034334f
to
126c198
Compare
@@ -243,6 +247,12 @@ def check_simple(instance=nil) | |||
# Reloads the active module | |||
# | |||
def cmd_reload(*args) | |||
if args.include?('-r') || args.include?('--reload-libs') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update the help menu
msf6 auxiliary(scanner/postgres/postgres_login) > reload -h
Usage: reload [-k]
Reloads the current module.
OPTIONS:
-h Help banner.
-k Stop the current job before reloading.
Run through all the permutations and everything seems to be working as expected 👍 <ruby>
modules = [
"auxiliary/scanner/http/title",
"evasion/windows/syscall_inject",
"exploit/multi/http/gitlab_exif_rce",
"payload/windows/meterpreter/reverse_https_proxy",
"payload/cmd/unix/reverse_php_ssl",
"post/windows/gather/memory_dump",
]
def run_command_with_log(command)
puts "> #{command}"
run_single(command)
end
modules.each do |mod|
puts "Running with mod #{mod}"
puts '-' * 20
run_command_with_log "use #{mod}"
run_command_with_log "reload -r"
run_command_with_log "reload"
run_command_with_log "check"
run_command_with_log "check -r"
run_command_with_log "recheck"
run_command_with_log "recheck -r"
run_command_with_log "run"
run_command_with_log "run -r"
run_command_with_log "rerun"
run_command_with_log "rerun -r"
puts ""
end
</ruby> Expected output
|
Release NotesAdds new options |
This PR adds in a new
-r
and--reload-libs
flag that allows for reloading all libraries before runningcheck
,recheck
,to_handler
,reload
,run
andrerun
. The libraries are reloaded before other argument parsing takes place.Example
Verification
msfconsole
use
a module such asexploit/windows/local/cve_2023_28252_clfs_driver
check -r
reloads all libraries but not the modulerecheck -r
reloads the module and all librariesrun -r
reloads all libraries but not the modulererun -r
reloads the module and all librariesto_handler -r
reloads all libraries and correctly starts a payload handlerreload -r
reloads all libraries and the current modulereload
reloads only the current module-r
command works forexploit
,post
,auxiliary
andevasion
modules-r, --reload-libs
flag shows up when you call-h
forcheck
andrun
commands-r, --reload-libs
command gets tab-completed