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
4
# Framework web site for more information on licensing and terms of use.
5
- # http://metasploit.com/framework/
5
+ # http://metasploit.com/framework/
6
+ ##
7
+
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 -
11
+ # http://www.onapsis.com/research-free-solutions.php.
12
+ # Mariano Nunez (the author of the Bizploit framework) helped me in my efforts
13
+ # in producing the Metasploit modules and was happy to share his knowledge and
14
+ # experience - a very cool guy.
15
+ #
16
+ # The following guys from ERP-SCAN deserve credit for their contributions -
17
+ # Alexandr Polyakov, Alexey Sintsov, Alexey Tyurin, Dmitry Chastukhin and
18
+ # Dmitry Evdokimov.
19
+ #
20
+ # I'd also like to thank Chris John Riley, Ian de Villiers and Joris van de Vis
21
+ # who have Beta tested the modules and provided excellent feedback. Some people
22
+ # just seem to enjoy hacking SAP :)
6
23
##
7
24
8
25
require 'msf/core'
@@ -24,13 +41,7 @@ def initialize
24
41
[ 'URL' , 'http://help.sap.com/saphelp_nw70ehp3/helpdata/en/48/6c68b01d5a350ce10000000a42189d/content.htm' ] ,
25
42
[ 'URL' , 'http://www.onapsis.com/research-free-solutions.php' ] # Bizsploit Opensource ERP Pentesting Framework
26
43
] ,
27
- 'Author' => [
28
- 'nomnkee' ,
29
- 'Mariano Nunez' , # Wrote Bizploit, helped on this module, very cool guy
30
- 'Chris John Riley' , # Testing
31
- 'Ian de Villiers' , # Testing
32
- 'Joris van de Vis' # Testing
33
- ] ,
44
+ 'Author' => [ 'nomnkee' ] ,
34
45
'License' => BSD_LICENSE
35
46
)
36
47
register_options (
@@ -103,25 +114,30 @@ def run_host(ip)
103
114
case count
104
115
when 1
105
116
if packet_len > 150
106
- sock . recv ( 150 )
107
- packet_len -= 150
108
- source , packet_len = get_data ( 46 , packet_len )
109
- destination , packet_len = get_data ( 46 , packet_len )
110
- service , packet_len = get_data ( 30 , packet_len )
111
- sock . recv ( 2 )
112
- packet_len -= 2
113
- saptbl << [ source , destination , service ]
114
- while packet_len > 0
115
- sock . recv ( 13 )
116
- packet_len -= 13
117
+ if sock . recv ( 150 ) =~ /access denied/
118
+ print_error ( "#{ host_port } - Access denied" )
119
+ sock . recv ( packet_len )
120
+ packet_len = sock . recv ( 4 ) . unpack ( 'H*' ) [ 0 ] . to_i 16
121
+ else
122
+ packet_len -= 150
117
123
source , packet_len = get_data ( 46 , packet_len )
118
124
destination , packet_len = get_data ( 46 , packet_len )
119
125
service , packet_len = get_data ( 30 , packet_len )
120
- term = sock . recv ( 2 )
126
+ sock . recv ( 2 )
121
127
packet_len -= 2
122
128
saptbl << [ source , destination , service ]
129
+ while packet_len > 0
130
+ sock . recv ( 13 )
131
+ packet_len -= 13
132
+ source , packet_len = get_data ( 46 , packet_len )
133
+ destination , packet_len = get_data ( 46 , packet_len )
134
+ service , packet_len = get_data ( 30 , packet_len )
135
+ term = sock . recv ( 2 )
136
+ packet_len -= 2
137
+ saptbl << [ source , destination , service ]
138
+ end
139
+ packet_len = sock . recv ( 4 ) . unpack ( 'H*' ) [ 0 ] . to_i 16
123
140
end
124
- packet_len = sock . recv ( 4 ) . unpack ( 'H*' ) [ 0 ] . to_i 16
125
141
else
126
142
print_error ( "#{ host_port } - No connected clients" )
127
143
sock . recv ( packet_len )
@@ -150,6 +166,7 @@ def run_host(ip)
150
166
break
151
167
end
152
168
end
169
+ puts sock . recv ( 200 )
153
170
disconnect
154
171
# TODO: This data should be saved somewhere. A note on the host would be nice.
155
172
print ( saptbl . to_s )
0 commit comments