Skip to content

Commit 71b8c97

Browse files
committed
Always print PAYLOAD and LPORT in 'jobs'
1 parent 2e1f1fd commit 71b8c97

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/msf/base/serializer/readable_text.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -638,13 +638,10 @@ def self.dump_sessions_verbose(framework, opts={})
638638
# @param col [Integer] the column wrap width.
639639
# @return [String] the formatted list of running jobs.
640640
def self.dump_jobs(framework, verbose = false, indent = DefaultIndent, col = DefaultColumnWrap)
641-
columns = [ 'Id', 'Name' ]
641+
columns = [ 'Id', 'Name', "Payload", "LPORT" ]
642642

643643
if (verbose)
644-
columns << "Payload"
645-
columns << "LPORT"
646-
columns << "URIPATH"
647-
columns << "Start Time"
644+
columns += [ "URIPATH", "Start Time" ]
648645
end
649646

650647
tbl = Rex::Ui::Text::Table.new(
@@ -653,16 +650,19 @@ def self.dump_jobs(framework, verbose = false, indent = DefaultIndent, col = Def
653650
'Columns' => columns
654651
)
655652

656-
657653
# jobs are stored as a hash with the keys being a numeric job_id.
658654
framework.jobs.keys.sort{|a,b| a.to_i <=> b.to_i }.each { |k|
655+
# Job context is stored as an Array with the 0th element being
656+
# the running module. If that module is an exploit, ctx will also
657+
# contain its payload.
658+
ctx = framework.jobs[k].ctx
659659
row = [ k, framework.jobs[k].name ]
660+
row << (ctx[1].nil? ? (ctx[0].datastore['PAYLOAD'] || "") : ctx[1].refname)
661+
row << (ctx[0].datastore['LPORT'] || "")
662+
660663
if (verbose)
661-
ctx = framework.jobs[k].ctx
662664
uripath = ctx[0].get_resource if ctx[0].respond_to?(:get_resource)
663665
uripath = ctx[0].datastore['URIPATH'] if uripath.nil?
664-
row << (ctx[1].nil? ? (ctx[0].datastore['PAYLOAD'] || "") : ctx[1].refname)
665-
row << (ctx[0].datastore['LPORT'] || "")
666666
row << (uripath || "")
667667
row << (framework.jobs[k].start_time || "")
668668
end

0 commit comments

Comments
 (0)