Skip to content

Commit

Permalink
Show errors on inaccessible payload files
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanusz-r7 committed Sep 29, 2023
1 parent aa2a843 commit b61cd79
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 4 additions & 5 deletions lib/msf/core/payload/stager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,14 @@ def handle_connection(conn, opts={})
end
end

p = generate_stage(opts)

# Encode the stage if stage encoding is enabled
# Generate and encode the stage if stage encoding is enabled
begin
p = generate_stage(opts)
p = encode_stage(p)
rescue ::RuntimeError
rescue ::RuntimeError => e
warning_msg = "Failed to stage"
warning_msg << " (#{conn.peerhost})" if conn.respond_to? :peerhost
warning_msg << ": #{$!}"
warning_msg << ": #{e}"
print_warning warning_msg
if conn.respond_to? :close && !conn.closed?
conn.close
Expand Down
12 changes: 11 additions & 1 deletion lib/msf/ui/console/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,17 @@ def on_startup(opts = {})

run_single("banner") unless opts['DisableBanner']

av_warning_message if framework.eicar_corrupted?
payloads_manifest_errors = ::MetasploitPayloads.manifest_errors

av_warning_message if (framework.eicar_corrupted? || payloads_manifest_errors.any?)

if payloads_manifest_errors.any?
warn_msg = "Metasploit Payloads manifest errors:\n"
payloads_manifest_errors.each do |file|
warn_msg << "\t#{file[:path]} : #{file[:error]}\n"
end
$stderr.print(warn_msg)
end

opts["Plugins"].each do |plug|
run_single("load '#{plug}'")
Expand Down

0 comments on commit b61cd79

Please sign in to comment.