-
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
Implement "set PAYLOAD" by index #12126
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -404,22 +404,14 @@ def on_startup(opts = {}) | |
# | ||
def on_variable_set(glob, var, val) | ||
case var.downcase | ||
when 'payload' | ||
if framework && !framework.payloads.valid?(val) | ||
return false | ||
elsif active_module && active_module.type == 'exploit' && !active_module.is_payload_compatible?(val) | ||
return false | ||
elsif active_module | ||
active_module.datastore.clear_non_user_defined | ||
elsif framework | ||
framework.datastore.clear_non_user_defined | ||
end | ||
when 'sessionlogging' | ||
handle_session_logging(val) if glob | ||
when 'consolelogging' | ||
handle_console_logging(val) if glob | ||
when 'loglevel' | ||
handle_loglevel(val) if glob | ||
when 'payload' | ||
handle_payload(val) | ||
when 'ssh_ident' | ||
handle_ssh_ident(val) | ||
end | ||
|
@@ -572,6 +564,23 @@ def handle_loglevel(val) | |
set_log_level(Msf::LogSource, val) | ||
end | ||
|
||
# | ||
# This method handles setting a desired payload | ||
# | ||
# TODO: Move this out of the console driver! | ||
# | ||
def handle_payload(val) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this refactor! 👍 If this also took There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, not sure about this one yet, since I simply moved it out of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should also be noted that So, it has been and still is possible to set a Linux payload on I'd rather do it in a separate PR. |
||
if framework && !framework.payloads.valid?(val) | ||
return false | ||
elsif active_module && (active_module.exploit? || active_module.evasion?) | ||
return false unless active_module.is_payload_compatible?(val) | ||
elsif active_module | ||
active_module.datastore.clear_non_user_defined | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #11529 happened here. |
||
elsif framework | ||
framework.datastore.clear_non_user_defined | ||
end | ||
end | ||
|
||
# | ||
# This method monkeypatches Net::SSH's client identification string | ||
# | ||
|
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.
#11529 should be fixed with
self
.