@@ -638,13 +638,10 @@ def self.dump_sessions_verbose(framework, opts={})
638
638
# @param col [Integer] the column wrap width.
639
639
# @return [String] the formatted list of running jobs.
640
640
def self . dump_jobs ( framework , verbose = false , indent = DefaultIndent , col = DefaultColumnWrap )
641
- columns = [ 'Id' , 'Name' ]
641
+ columns = [ 'Id' , 'Name' , "Payload" , "LPORT" ]
642
642
643
643
if ( verbose )
644
- columns << "Payload"
645
- columns << "LPORT"
646
- columns << "URIPATH"
647
- columns << "Start Time"
644
+ columns += [ "URIPATH" , "Start Time" ]
648
645
end
649
646
650
647
tbl = Rex ::Ui ::Text ::Table . new (
@@ -653,16 +650,19 @@ def self.dump_jobs(framework, verbose = false, indent = DefaultIndent, col = Def
653
650
'Columns' => columns
654
651
)
655
652
656
-
657
653
# jobs are stored as a hash with the keys being a numeric job_id.
658
654
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
659
659
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
+
660
663
if ( verbose )
661
- ctx = framework . jobs [ k ] . ctx
662
664
uripath = ctx [ 0 ] . get_resource if ctx [ 0 ] . respond_to? ( :get_resource )
663
665
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' ] || "" )
666
666
row << ( uripath || "" )
667
667
row << ( framework . jobs [ k ] . start_time || "" )
668
668
end
0 commit comments