Skip to content

Commit 75270af

Browse files
OJBrent Cook
authored andcommitted
Tweaking of the pivot list output
1 parent 8b8e5e4 commit 75270af

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

lib/rex/post/meterpreter/client.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ def initialize(sock, opts={})
8989
#
9090
def cleanup_meterpreter
9191
if self.pivot_session
92-
self.pivot_session.remove_pivot(self.session_guid)
92+
self.pivot_session.remove_pivot_session(self.session_guid)
9393
end
9494

95-
self.pivots.keys.each do |k|
96-
pivot = self.pivots[k]
95+
self.pivot_sessions.keys.each do |k|
96+
pivot = self.pivot_sessions[k]
9797
pivot.pivoted_session.kill('Pivot closed')
9898
pivot.pivoted_session.shutdown_passive_dispatcher
9999
end

lib/rex/post/meterpreter/pivot.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ class PivotListener
1212

1313
attr_accessor :session_class
1414

15-
attr_accessor :display_name
15+
attr_accessor :url
1616

17-
def initialize(session_class, display_name)
17+
attr_accessor :stage
18+
19+
def initialize(session_class, url, stage)
1820
self.id = [SecureRandom.uuid.gsub(/-/, '')].pack('H*')
1921
self.session_class = session_class
20-
self.display_name = display_name
22+
self.url = url
23+
self.stage = stage
2124
end
2225

2326
def to_row
24-
[self.id.unpack('H*')[0], display_name]
27+
[self.id.unpack('H*')[0], url, stage]
2528
end
2629
end
2730

@@ -114,8 +117,9 @@ def Pivot.create_named_pipe_listener(client, opts={})
114117
stage_opts[:transport_config] = [stager.transport_config_reverse_named_pipe(stage_opts)]
115118
stage = stager.stage_payload(stage_opts)
116119

117-
display_name = "pipe://#{opts[:pipe_host]}/#{opts[:pipe_name]} (#{opts[:arch]}/#{opts[:platform]})"
118-
pivot_listener = PivotListener.new(::Msf::Sessions::Meterpreter_x86_Win, display_name)
120+
url = "pipe://#{opts[:pipe_host]}/#{opts[:pipe_name]}"
121+
stage = "#{opts[:arch]}/#{opts[:platform]}"
122+
pivot_listener = PivotListener.new(::Msf::Sessions::Meterpreter_x86_Win, url, stage)
119123

120124
request.add_tlv(TLV_TYPE_PIVOT_STAGE_DATA, stage)
121125
request.add_tlv(TLV_TYPE_PIVOT_STAGE_DATA_SIZE, stage.length)

lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,13 @@ def cmd_pivot(*args)
205205
tbl = Rex::Text::Table.new(
206206
'Header' => 'Currently active pivot listeners',
207207
'Indent' => 4,
208-
'Columns' => ['Id', 'Detail'])
208+
'Columns' => ['Id', 'URL', 'Stage'])
209209

210210
client.pivot_listeners.each do |k, v|
211211
tbl << v.to_row
212212
end
213-
print_line("\n#{tbl}\n")
213+
print_line
214+
print_line(tbl.to_s)
214215
when 'add'
215216
unless opts[:type]
216217
print_error('Pivot type must be specified (-t)')

0 commit comments

Comments
 (0)