diff --git a/lib/msf/base/serializer/readable_text.rb b/lib/msf/base/serializer/readable_text.rb index c62db55496..724d8258e4 100644 --- a/lib/msf/base/serializer/readable_text.rb +++ b/lib/msf/base/serializer/readable_text.rb @@ -638,13 +638,10 @@ class ReadableText # @param col [Integer] the column wrap width. # @return [String] the formatted list of running jobs. def self.dump_jobs(framework, verbose = false, indent = DefaultIndent, col = DefaultColumnWrap) - columns = [ 'Id', 'Name' ] + columns = [ 'Id', 'Name', "Payload", "LPORT" ] if (verbose) - columns << "Payload" - columns << "LPORT" - columns << "URIPATH" - columns << "Start Time" + columns += [ "URIPATH", "Start Time" ] end tbl = Rex::Ui::Text::Table.new( @@ -653,16 +650,19 @@ class ReadableText 'Columns' => columns ) - # jobs are stored as a hash with the keys being a numeric job_id. framework.jobs.keys.sort{|a,b| a.to_i <=> b.to_i }.each { |k| + # Job context is stored as an Array with the 0th element being + # the running module. If that module is an exploit, ctx will also + # contain its payload. + ctx = framework.jobs[k].ctx row = [ k, framework.jobs[k].name ] + row << (ctx[1].nil? ? (ctx[0].datastore['PAYLOAD'] || "") : ctx[1].refname) + row << (ctx[0].datastore['LPORT'] || "") + if (verbose) - ctx = framework.jobs[k].ctx uripath = ctx[0].get_resource if ctx[0].respond_to?(:get_resource) uripath = ctx[0].datastore['URIPATH'] if uripath.nil? - row << (ctx[1].nil? ? (ctx[0].datastore['PAYLOAD'] || "") : ctx[1].refname) - row << (ctx[0].datastore['LPORT'] || "") row << (uripath || "") row << (framework.jobs[k].start_time || "") end