Skip to content

Commit e365138

Browse files
committed
update and display correct rport
1 parent 48765fb commit e365138

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

modules/auxiliary/scanner/smb/pipe_auditor.rb

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def run_host(ip)
4141
if session
4242
print_status("Using existing session #{session.sid}")
4343
client = session.client
44-
datastore['RPORT'] = session.port
44+
@rport = datastore['RPORT'] = session.port
4545
self.simple = ::Rex::Proto::SMB::SimpleClient.new(client.dispatcher.tcp_socket, client: client)
4646
self.simple.connect("\\\\#{session.address}\\IPC$")
4747
pipes += check_pipes
@@ -66,14 +66,25 @@ def run_host(ip)
6666
smb_login
6767
pipes += check_pipes
6868
disconnect
69-
break
69+
report_pipes(pipes)
7070
rescue Rex::Proto::SMB::Exceptions::SimpleClientError, Rex::ConnectionError => e
7171
vprint_error("SMB client Error with RPORT=#{@rport} SMBDirect=#{@smb_direct}: #{e.to_s}")
7272
end
7373

7474
end
7575
end
7676

77+
end
78+
79+
def check_pipes
80+
pipes = []
81+
check_named_pipes.each do |pipe_name, _|
82+
pipes.push(pipe_name)
83+
end
84+
pipes
85+
end
86+
87+
def report_pipes(pipes)
7788
if(pipes.length > 0)
7889
print_good("Pipes: #{pipes.join(", ")}")
7990
# Add Report
@@ -88,11 +99,4 @@ def run_host(ip)
8899
end
89100
end
90101

91-
def check_pipes
92-
pipes = []
93-
check_named_pipes.each do |pipe_name, _|
94-
pipes.push(pipe_name)
95-
end
96-
pipes
97-
end
98102
end

0 commit comments

Comments
 (0)