File tree Expand file tree Collapse file tree
modules/auxiliary/scanner/couchdb Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,24 +71,29 @@ def get_version
7171 return false
7272 end
7373
74- if res && res . code == 401
74+ if res . code == 401
7575 print_bad ( "#{ peer } - Authentication required." )
7676 return false
7777 end
7878
79- if res && res . code == 200
80- res_json = res . get_json_document
79+ unless res . code == 200
80+ vprint_bad ( "#{ peer } - Unexpected HTTP status #{ res . code } , does not appear to be CouchDB." )
81+ return false
82+ end
8183
82- if res_json . empty?
83- vprint_bad ( "#{ peer } - Cannot parse the response, seems like it's not CouchDB." )
84- return false
85- end
84+ res_json = res . get_json_document
8685
87- @version = res_json [ 'version' ] if res_json [ 'version' ]
88- return true
86+ unless res_json . is_a? ( Hash ) && res_json . key? ( 'couchdb' )
87+ vprint_bad ( "#{ peer } - Response does not appear to be from CouchDB." )
88+ return false
89+ end
90+
91+ @version = res_json [ 'version' ]
92+ unless @version
93+ vprint_warning ( "#{ peer } - CouchDB detected but version not found in response." )
94+ return false
8995 end
9096
91- vprint_warning ( "#{ peer } - Version not found" )
9297 true
9398 end
9499
You can’t perform that action at this time.
0 commit comments