Skip to content

Commit 6af8d3f

Browse files
committed
Land #18431, Fix how port forwards are listed
Merge branch 'land-18431' into upstream-master
2 parents d427d64 + d46e80f commit 6af8d3f

File tree

1 file changed

+8
-7
lines changed
  • lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi

1 file changed

+8
-7
lines changed

lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,16 +431,17 @@ def cmd_portfwd(*args)
431431
cnt = 0
432432

433433
# Enumerate each TCP relay
434-
service.each_tcp_relay { |lhost, lport, rhost, rport, opts|
435-
next if (opts['MeterpreterRelay'] == nil)
436-
437-
direction = 'Forward'
438-
direction = 'Reverse' if opts['Reverse'] == true
434+
service.each_tcp_relay do |lhost, lport, rhost, rport, opts|
435+
next unless opts['MeterpreterRelay']
439436

440-
table << [cnt + 1, "#{netloc(rhost, rport)}", "#{netloc(lhost, lport)}", direction]
437+
if opts['Reverse']
438+
table << [cnt + 1, "#{netloc(rhost, rport)}", "#{netloc(lhost, lport)}", 'Reverse']
439+
else
440+
table << [cnt + 1, "#{netloc(lhost, lport)}", "#{netloc(rhost, rport)}", 'Forward']
441+
end
441442

442443
cnt += 1
443-
}
444+
end
444445

445446
print_line
446447
if cnt > 0

0 commit comments

Comments
 (0)