Skip to content

Commit d433803

Browse files
authored
Update zabbix_toggleids_sqli.rb
1 parent 38a8d21 commit d433803

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

modules/auxiliary/gather/zabbix_toggleids_sqli.rb

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ def check
6060
end
6161

6262
match = /#{left_marker}(.*)#{right_marker}/.match(res.body)
63-
63+
64+
unless match
65+
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
66+
end
67+
6468
if match[1] == flag
6569
return Msf::Exploit::CheckCode::Vulnerable
6670
end
@@ -87,6 +91,10 @@ def run
8791

8892
match = /#{left_marker}(.*)#{right_marker}/.match(res.body)
8993

94+
unless match
95+
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
96+
end
97+
9098
count = match[1].to_i
9199

92100
dbs = []
@@ -104,7 +112,11 @@ def run
104112
end
105113

106114
match = /#{left_marker}(.*)#{right_marker}/.match(res.body)
107-
115+
116+
unless match
117+
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
118+
end
119+
108120
dbs << match[1]
109121
end
110122

@@ -129,6 +141,10 @@ def run
129141

130142
match = /#{left_marker}(.*)#{right_marker}/.match(res.body)
131143

144+
unless match
145+
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
146+
end
147+
132148
count = match[1].to_i
133149

134150
0.upto(count-1) do |cur|
@@ -146,6 +162,11 @@ def run
146162
end
147163

148164
match = /#{left_marker}(.*)#{right_marker}/.match(res.body)
165+
166+
unless match
167+
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
168+
end
169+
149170
user[col] = match[1]
150171
end
151172
users << user
@@ -169,8 +190,13 @@ def authenticate
169190

170191
cookies = res.get_cookies
171192

172-
res.body =~ /name="sid" value="(.*?)">/
173-
sid = $1
193+
match = /name="sid" value="(.*?)">/.match(res.body)
194+
195+
unless match
196+
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
197+
end
198+
199+
sid = match[1]
174200

175201
if datastore['REQUIREAUTH']
176202

@@ -208,8 +234,13 @@ def authenticate
208234
end
209235

210236
cookies = res.get_cookies
211-
res.body =~ /name="sid" value="(.*?)">/
212-
sid = $1
237+
match = /name="sid" value="(.*?)">/.match(res.body)
238+
239+
unless match
240+
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
241+
end
242+
243+
sid = match[1]
213244
elsif
214245
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
215246
end

0 commit comments

Comments
 (0)