made requested changes

unstable
nmonkee 2012-11-14 22:13:06 +00:00
parent c13f8d8eba
commit 833af3a347
1 changed files with 11 additions and 12 deletions

View File

@ -6,13 +6,13 @@
## ##
## ##
# This module is based on, inspired by, or is a port of a plugin available in # This module is based on, inspired by, or is a port of a plugin available in
# the Onapsis Bizploit Opensource ERP Penetration Testing framework - # the Onapsis Bizploit Opensource ERP Penetration Testing framework -
# http://www.onapsis.com/research-free-solutions.php. # http://www.onapsis.com/research-free-solutions.php.
# Mariano Nuñez (the author of the Bizploit framework) helped me in my efforts # Mariano Nunez (the author of the Bizploit framework) helped me in my efforts
# in producing the Metasploit modules and was happy to share his knowledge and # in producing the Metasploit modules and was happy to share his knowledge and
# experience - a very cool guy. I'd also like to thank Chris John Riley, # experience - a very cool guy. I'd also like to thank Chris John Riley,
# Ian de Villiers and Joris van de Vis who have Beta tested the modules and # Ian de Villiers and Joris van de Vis who have Beta tested the modules and
# provided excellent feedback. Some people just seem to enjoy hacking SAP :) # provided excellent feedback. Some people just seem to enjoy hacking SAP :)
## ##
@ -28,8 +28,8 @@ class Metasploit4 < Msf::Auxiliary
super( super(
'Name' => 'SAP RFC TH_SAPREL', 'Name' => 'SAP RFC TH_SAPREL',
'Version' => '$Revision$', 'Version' => '$Revision$',
'Description' => %q{ This module makes use of the TH_SAPREL RFC (via SOAP) to return the SAP software, OS and DB versions.}, 'Description' => %q{ This module makes use of the TH_SAPREL RFC (via SOAP) to return the SAP software, OS and DB versions.},
'References' => [[ 'URL', 'http://labs.mwrinfosecurity.com' ]], 'References' => [[ 'URL', 'http://labs.mwrinfosecurity.com/tools/2012/04/27/sap-metasploit-modules/' ]],
'Author' => [ 'Agnivesh Sathasivam','nmonkee' ], 'Author' => [ 'Agnivesh Sathasivam','nmonkee' ],
'License' => BSD_LICENSE 'License' => BSD_LICENSE
) )
@ -37,10 +37,10 @@ class Metasploit4 < Msf::Auxiliary
[ [
OptString.new('CLIENT', [true, 'Client', nil]), OptString.new('CLIENT', [true, 'Client', nil]),
OptString.new('USERNAME', [true, 'Username', nil]), OptString.new('USERNAME', [true, 'Username', nil]),
OptString.new('PASSWORD', [true, 'Password', nil]), OptString.new('PASSWORD', [true, 'Password', nil])
], self.class) ], self.class)
end end
def run_host(ip) def run_host(ip)
data = '<?xml version="1.0" encoding="utf-8" ?>' data = '<?xml version="1.0" encoding="utf-8" ?>'
data << '<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' data << '<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'
@ -61,12 +61,11 @@ class Metasploit4 < Msf::Auxiliary
'SOAPAction' => 'urn:sap-com:document:sap:rfc:functions', 'SOAPAction' => 'urn:sap-com:document:sap:rfc:functions',
'Cookie' => 'sap-usercontext=sap-language=EN&sap-client=' + datastore['CLIENT'], 'Cookie' => 'sap-usercontext=sap-language=EN&sap-client=' + datastore['CLIENT'],
'Authorization' => 'Basic ' + user_pass, 'Authorization' => 'Basic ' + user_pass,
'Content-Type' => 'text/xml; charset=UTF-8', 'Content-Type' => 'text/xml; charset=UTF-8'
} }
}, 45) }, 45)
if res and res.code == 500 if res and res.code == 500
response = res.body response = res.body
#error.push(response.scan(%r{<faultstring>(.*?)</faultstring>}))
error.push(response.scan(%r{<message>(.*?)</message>})) error.push(response.scan(%r{<message>(.*?)</message>}))
success = false success = false
elsif res and res.code == 200 elsif res and res.code == 200
@ -93,7 +92,7 @@ class Metasploit4 < Msf::Auxiliary
saptbl << [ "SAP Version", kern_rel ] saptbl << [ "SAP Version", kern_rel ]
print(saptbl.to_s) print(saptbl.to_s)
else else
print_error("[SAP] #{ip}:#{rport} - error message: " + res.code.to_s + " " + res.message) print_error("[SAP] #{ip}:#{rport} - error message: " + res.code.to_s + " " + res.message) if res
end end
rescue ::Rex::ConnectionError rescue ::Rex::ConnectionError
print_error("#[SAP] #{ip}:#{rport} - Unable to connect") print_error("#[SAP] #{ip}:#{rport} - Unable to connect")