@@ -379,10 +379,18 @@ def cmd_get_timeouts(*args)
379
379
end
380
380
381
381
def print_timeouts ( timeouts )
382
- print_line ( "Session Expiry : @ #{ ( Time . now + timeouts [ :session_exp ] ) . strftime ( '%Y-%m-%d %H:%M:%S' ) } " )
383
- print_line ( "Comm Timeout : #{ timeouts [ :comm_timeout ] } seconds" )
384
- print_line ( "Retry Total Time: #{ timeouts [ :retry_total ] } seconds" )
385
- print_line ( "Retry Wait Time : #{ timeouts [ :retry_wait ] } seconds" )
382
+ if timeouts [ :session_exp ]
383
+ print_line ( "Session Expiry : @ #{ ( Time . now + timeouts [ :session_exp ] ) . strftime ( '%Y-%m-%d %H:%M:%S' ) } " )
384
+ end
385
+ if timeouts [ :comm_timeout ]
386
+ print_line ( "Comm Timeout : #{ timeouts [ :comm_timeout ] } seconds" )
387
+ end
388
+ if timeouts [ :retry_total ]
389
+ print_line ( "Retry Total Time: #{ timeouts [ :retry_total ] } seconds" )
390
+ end
391
+ if timeouts [ :retry_wait ]
392
+ print_line ( "Retry Wait Time : #{ timeouts [ :retry_wait ] } seconds" )
393
+ end
386
394
end
387
395
388
396
#
@@ -500,14 +508,16 @@ def cmd_ssl_verify(*args)
500
508
'-ex' => [ true , 'Expiration timout (seconds) (default: same as current session)' ] ,
501
509
'-rt' => [ true , 'Retry total time (seconds) (default: same as current session)' ] ,
502
510
'-rw' => [ true , 'Retry wait time (seconds) (default: same as current session)' ] ,
511
+ '-v' => [ false , 'Show the verbose format of the transport list' ] ,
503
512
'-h' => [ false , 'Help menu' ] )
504
513
505
514
#
506
515
# Display help for transport management.
507
516
#
508
517
def cmd_transport_help
509
- print_line ( 'Usage: transport <change|add|next|prev> [options]' )
518
+ print_line ( 'Usage: transport <list| change|add|next|prev> [options]' )
510
519
print_line
520
+ print_line ( ' list: list the currently active transports.' )
511
521
print_line ( ' add: add a new transport to the transport list.' )
512
522
print_line ( ' change: same as add, but changes directly to the added entry.' )
513
523
print_line ( ' next: jump to the next transport in the list (no options).' )
@@ -525,7 +535,7 @@ def cmd_transport(*args)
525
535
end
526
536
527
537
command = args . shift
528
- unless [ 'add' , 'change' , 'prev' , 'next' ] . include? ( command )
538
+ unless [ 'list' , ' add', 'change' , 'prev' , 'next' ] . include? ( command )
529
539
cmd_transport_help
530
540
return
531
541
end
@@ -544,7 +554,8 @@ def cmd_transport(*args)
544
554
:session_exp => nil ,
545
555
:retry_total => nil ,
546
556
:retry_wait => nil ,
547
- :cert => nil
557
+ :cert => nil ,
558
+ :verbose => false
548
559
}
549
560
550
561
@@transport_opts . parse ( args ) do |opt , idx , val |
@@ -575,6 +586,8 @@ def cmd_transport(*args)
575
586
opts [ :lport ] = val . to_i if val
576
587
when '-l'
577
588
opts [ :lhost ] = val
589
+ when '-v'
590
+ opts [ :verbose ] = true
578
591
when '-t'
579
592
unless client . core . valid_transport? ( val )
580
593
cmd_transport_help
@@ -585,6 +598,51 @@ def cmd_transport(*args)
585
598
end
586
599
587
600
case command
601
+ when 'list'
602
+ result = client . core . transport_list
603
+ # this will output the session timeout first
604
+ print_timeouts ( result )
605
+
606
+ columns = [
607
+ 'Curr' ,
608
+ 'URL' ,
609
+ 'Comms T/O' ,
610
+ 'Retry Total' ,
611
+ 'Retry Wait'
612
+ ]
613
+
614
+ if opts [ :verbose ]
615
+ columns << 'User Agent'
616
+ columns << 'Proxy Host'
617
+ columns << 'Proxy User'
618
+ columns << 'Proxy Pass'
619
+ columns << 'Cert Hash'
620
+ end
621
+
622
+ # next draw up a table of transport entries
623
+ tbl = Rex ::Ui ::Text ::Table . new (
624
+ 'Indent' => 4 ,
625
+ 'Columns' => columns )
626
+
627
+ first = true
628
+ result [ :transports ] . each do |t |
629
+ entry = [ first ? '*' : '' , t [ :url ] , t [ :comm_timeout ] ,
630
+ t [ :retry_total ] , t [ :retry_wait ] ]
631
+
632
+ first = false
633
+
634
+ if opts [ :verbose ]
635
+ entry << t [ :ua ]
636
+ entry << t [ :proxy_host ]
637
+ entry << t [ :proxy_user ]
638
+ entry << t [ :proxy_pass ]
639
+ entry << ( t [ :cert_hash ] || '' ) . unpack ( "H*" ) [ 0 ]
640
+ end
641
+
642
+ tbl << entry
643
+ end
644
+
645
+ print ( "\n " + tbl . to_s + "\n " )
588
646
when 'next'
589
647
print_status ( "Changing to next transport ..." )
590
648
if client . core . transport_next
0 commit comments