payloads now display multiple stages

git-svn-id: file:///home/svn/incoming/trunk@3025 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2005-11-12 05:11:56 +00:00
parent 6cd930492f
commit b89a92f28f
3 changed files with 20 additions and 2 deletions

View File

@ -56,12 +56,23 @@ module Payload
if (fmt != 'raw' and opts['NoComment'] != true)
((ou = payload.options.options_used_to_s(payload.datastore)) and ou.length > 0) ? ou += "\n" : ou = ''
buf = Buffer.comment(
"#{payload.refname} - #{len} bytes\n" +
"#{payload.refname} - #{len} bytes#{payload.staged? ? " (stage 1)" : ""}\n" +
"http://www.metasploit.com\n" +
((e.encoder) ? "Encoder: #{e.encoder.refname}\n" : '') +
((e.nop) ? "NOP gen: #{e.nop.refname}\n" : '') +
"#{ou}",
fmt) + buf
# If it's multistage, include the second stage too
if (payload.staged? and payload.stage_payload)
buf +=
"\n" +
Buffer.comment(
"#{payload.refname} - #{payload.stage_payload.length} bytes (stage 2)\n" +
"http://www.metasploit.com\n",
fmt) + Buffer.transform(payload.stage_payload, fmt)
end
end
return buf

View File

@ -95,6 +95,13 @@ class Payload < Msf::Module
return Type::Stage
end
#
# This method returns whether or not this payload uses staging.
#
def staged?
(payload_type == Type::Stager or payload_type == Type::Stage)
end
#
# Returns the payload's size. If the payload is staged, the size of the
# first stage is returned.

View File

@ -84,7 +84,7 @@ class LogDispatcher
def log(sev, src, level, msg, from)
log_sinks_rwlock.synchronize_read {
if ((sink = log_sinks[src]))
next if (log_levels[src] and level > log_levels[src])
next if (log_levels[src] and level >= log_levels[src])
sink.log(sev, src, level, msg, from)
end