Skip to content

Commit 55e224b

Browse files
committed
Improve auth handling
1 parent fc97266 commit 55e224b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

modules/auxiliary/scanner/rsync/modules_list.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,18 @@ def read_timeout
5858
datastore['READ_TIMEOUT']
5959
end
6060

61-
def get_rsync_auth_state(rmodule)
61+
def get_rsync_auth_status(rmodule)
6262
sock.puts("#{rmodule}\n")
6363
res = sock.get_once(-1, read_timeout)
6464
if res
65-
if res =~ /^#{RSYNC_HEADER} AUTHREQD/
65+
res.strip!
66+
if res =~ /^#{RSYNC_HEADER} AUTHREQD \S+$/
6667
'required'
67-
elsif res =~ /^#{RSYNC_HEADER} OK/
68+
elsif res =~ /^#{RSYNC_HEADER} OK$/
6869
'not required'
6970
else
7071
vprint_error("#{peer} - unexpected response when connecting to #{rmodule}: #{res}")
71-
'unexpected response'
72+
"unexpected response '#{res}'"
7273
end
7374
else
7475
vprint_error("#{peer} - no response when connecting to #{rmodule}")
@@ -185,12 +186,12 @@ def run_host(ip)
185186

186187
table_columns = %w(Name Comment)
187188
if datastore['TEST_AUTHENTICATION']
188-
table_columns << 'Authentication?'
189+
table_columns << 'Authentication'
189190
modules_metadata.each do |module_metadata|
190191
begin
191192
connect
192193
rsync_negotiate
193-
module_metadata[:authentication?] = get_rsync_auth_state(module_metadata[:name])
194+
module_metadata[:authentication] = get_rsync_auth_status(module_metadata[:name])
194195
rescue => e
195196
vprint_error("#{peer} - error while testing authentication on #{module_metadata[:name]}: #{e}")
196197
ensure

0 commit comments

Comments
 (0)