File tree Expand file tree Collapse file tree 1 file changed +29
-10
lines changed
modules/auxiliary/scanner/rsync Expand file tree Collapse file tree 1 file changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -142,10 +142,16 @@ def rsync_parse_lines(response_data)
142
142
end
143
143
144
144
def run_host ( ip )
145
- connect
146
- version , motd = rsync_negotiate
147
- unless version
148
- vprint_error ( "#{ peer } - does not appear to be rsync" )
145
+ begin
146
+ connect
147
+ version , motd = rsync_negotiate
148
+ unless version
149
+ vprint_error ( "#{ peer } - does not appear to be rsync" )
150
+ disconnect
151
+ return
152
+ end
153
+ rescue => e
154
+ vprint_error ( "#{ peer } - error while connecting and negotiating: #{ e } " )
149
155
disconnect
150
156
return
151
157
end
@@ -161,8 +167,16 @@ def run_host(ip)
161
167
)
162
168
vprint_good ( "#{ peer } - rsync MOTD: #{ motd } " ) if motd && datastore [ 'SHOW_MOTD' ]
163
169
164
- modules_metadata = rsync_list
165
- disconnect
170
+ modules_metadata = { }
171
+ begin
172
+ modules_metadata = rsync_list
173
+ rescue => e
174
+ vprint_error ( "#{ peer } -- error while listing modules: #{ e } " )
175
+ return
176
+ ensure
177
+ disconnect
178
+ end
179
+
166
180
if modules_metadata . empty?
167
181
print_status ( "#{ peer } - rsync #{ version } : no modules found" )
168
182
else
@@ -173,10 +187,15 @@ def run_host(ip)
173
187
if datastore [ 'TEST_AUTHENTICATION' ]
174
188
table_columns << 'Authentication?'
175
189
modules_metadata . each do |module_metadata |
176
- connect
177
- rsync_negotiate
178
- module_metadata [ :authentication? ] = get_rsync_auth_state ( module_metadata [ :name ] )
179
- disconnect
190
+ begin
191
+ connect
192
+ rsync_negotiate
193
+ module_metadata [ :authentication? ] = get_rsync_auth_state ( module_metadata [ :name ] )
194
+ rescue => e
195
+ vprint_error ( "#{ peer } - error while testing authentication on #{ module_metadata [ :name ] } : #{ e } " )
196
+ ensure
197
+ disconnect
198
+ end
180
199
end
181
200
end
182
201
You can’t perform that action at this time.
0 commit comments