Skip to content

Commit c41c7a1

Browse files
committed
Rewrote the conditions of res.
1 parent d01da0c commit c41c7a1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

modules/auxiliary/scanner/http/influxdb_enum.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,34 +45,34 @@ def run
4545
return
4646
end
4747

48-
if res && res.code == 401
49-
print_error("#{peer} - Failed to authenticate. Invalid username/password.")
48+
unless res
49+
print_error("#{peer} - Server did not respond in an expected way.")
5050
return
5151
end
5252

53-
if res && res.code == 200 && res.headers['X-Influxdb-Version'].include?('InfluxDB') && res.body.length > 0
53+
if res.code == 401 && res.body =~ /Invalid username\/password/
54+
print_error("#{peer} - Failed to authenticate. Invalid username/password.")
55+
return
56+
elsif res.code == 200 && res.headers.include?('X-Influxdb-Version') && res.body.length > 0
5457
print_status('Enumerating...')
5558
begin
5659
temp = JSON.parse(res.body)
5760
results = JSON.pretty_generate(temp)
5861
rescue JSON::ParserError
59-
print_error('Unable to parse JSON data for the response.')
62+
print_error('Unable to parse JSON data.')
6063
return
6164
end
62-
6365
print_good("Found:\n\n#{results}\n")
64-
6566
path = store_loot(
6667
'influxdb.enum',
6768
'text/plain',
6869
rhost,
6970
results,
7071
'InfluxDB Enum'
7172
)
72-
7373
print_good("#{peer} - File saved in: #{path}")
7474
else
75-
print_error("#{peer} - Unable to enum, received \"#{res.code}\".")
75+
print_error("#{peer} - Unable to enum, received \"#{res.code}\"")
7676
end
7777
end
7878
end

0 commit comments

Comments
 (0)