Skip to content

Commit 564a32c

Browse files
committed
Made requested changes
1 parent ff07e5d commit 564a32c

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

modules/auxiliary/scanner/sap/sap_soap_rfc_dbmcli_sxpg_command_exec.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,26 +108,27 @@ def exec_command(ip,data)
108108
'Content-Type' => 'text/xml; charset=UTF-8'
109109
}
110110
}, 45)
111-
if res and res.code != 500 and res.code != 200
112-
print_error("[SAP] #{ip}:#{rport} - something went wrong!")
113-
return
114-
elsif res and res.body =~ /faultstring/
115-
error = res.body.scan(%r{<faultstring>(.*?)</faultstring>}).flatten
116-
0.upto(output.length-1) do |i|
117-
print_error("[SAP] #{ip}:#{rport} - error #{error[i]}")
111+
if res
112+
if res.code != 500 and res.code != 200
113+
print_error("[SAP] #{ip}:#{rport} - something went wrong!")
114+
return
115+
elsif res.body =~ /faultstring/
116+
error = res.body.scan(%r{<faultstring>(.*?)</faultstring>}).flatten
117+
0.upto(output.length-1) do |i|
118+
print_error("[SAP] #{ip}:#{rport} - error #{error[i]}")
119+
end
120+
return
118121
end
119-
return
120-
elsif res
121122
print_status("[SAP] #{ip}:#{rport} - got response")
122123
output = res.body.scan(%r{<MESSAGE>([^<]+)</MESSAGE>}).flatten
123124
result = []
124125
0.upto(output.length-1) do |i|
125126
if output[i] =~ /E[rR][rR]/ || output[i] =~ /---/ || output[i] =~ /for database \(/
126-
#nothing
127+
#nothing
127128
elsif output[i] =~ /unknown host/ || output[i] =~ /; \(see/ || output[i] =~ /returned with/
128-
#nothing
129+
#nothing
129130
elsif output[i] =~ /External program terminated with exit code/
130-
#nothing
131+
#nothing
131132
else
132133
temp = output[i].gsub("&#62",">")
133134
temp_ = temp.gsub("&#34","\"")
@@ -143,18 +144,17 @@ def exec_command(ip,data)
143144
'Indent' => 1,
144145
'Columns' =>["Output"]
145146
)
146-
for i in 0..result.length/2-1
147+
0.upto(result.length/2-1) do |i|
147148
saptbl << [result[i].chomp]
148149
end
149150
print (saptbl.to_s)
150151
return
151152
else
152-
print_error("[SAP] #{ip}:#{rport} - Unknown error")
153-
return
153+
print_error("[SAP] #{ip}:#{rport} - no response")
154154
end
155155
rescue ::Rex::ConnectionError
156156
print_error("[SAP] #{ip}:#{rport} - Unable to connect")
157157
return
158158
end
159159
end
160-
end
160+
end

0 commit comments

Comments
 (0)