From a252dbc5d7424e74657cbc4da8d067adc093e891 Mon Sep 17 00:00:00 2001 From: nmonkee Date: Wed, 14 Nov 2012 23:25:25 +0000 Subject: [PATCH] made requested changes --- .../scanner/sap/sap_soap_rfc_ping.rb | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/modules/auxiliary/scanner/sap/sap_soap_rfc_ping.rb b/modules/auxiliary/scanner/sap/sap_soap_rfc_ping.rb index b0dbdb3594..4232892729 100755 --- a/modules/auxiliary/scanner/sap/sap_soap_rfc_ping.rb +++ b/modules/auxiliary/scanner/sap/sap_soap_rfc_ping.rb @@ -1,18 +1,18 @@ ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit -# web site for more information on licensing and terms of use. -# http://metasploit.com/ +# Framework web site for more information on licensing and terms of use. +# http://metasploit.com/framework/ ## ## -# This module is based on, inspired by, or is a port of a plugin available in -# the Onapsis Bizploit Opensource ERP Penetration Testing framework - +# This module is based on, inspired by, or is a port of a plugin available in +# the Onapsis Bizploit Opensource ERP Penetration Testing framework - # 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 -# 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 +# 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 # provided excellent feedback. Some people just seem to enjoy hacking SAP :) ## @@ -23,31 +23,30 @@ class Metasploit4 < Msf::Auxiliary include Msf::Exploit::Remote::HttpClient include Msf::Auxiliary::Report include Msf::Auxiliary::Scanner - + def initialize super( 'Name' => 'SAP SOAP RFC_PING', - 'Version' => '$Revision$', - 'Description' => %q{ + 'Description' => %q{ Calls the RFC_PING RFC module via SOAP to test the availability of the function. The function simply tests connectivity to remote RFC destinations. }, - 'References' => [[ 'URL', 'http://labs.mwrinfosecurity.com' ]], + 'References' => [[ 'URL', 'http://labs.mwrinfosecurity.com/tools/2012/04/27/sap-metasploit-modules/' ]], 'Author' => [ 'Agnivesh Sathasivam','nmonkee' ], 'License' => BSD_LICENSE ) - + register_options( [ OptString.new('CLIENT', [true, 'Client', nil]), OptString.new('USERNAME', [true, 'Username ', 'SAP*']), - OptString.new('PASSWORD', [true, 'Password ', '06071992']), + OptString.new('PASSWORD', [true, 'Password ', '06071992']) ], self.class) register_autofilter_ports([ 8000 ]) end def run_host(ip) - client = datastore['CLIENT'] + client = datastore['CLIENT'] data = '' data << '' data << '' @@ -68,25 +67,24 @@ class Metasploit4 < Msf::Auxiliary 'SOAPAction' => 'urn:sap-com:document:sap:rfc:functions', 'Cookie' => 'sap-usercontext=sap-language=EN&sap-client=' + client, 'Authorization' => 'Basic ' + user_pass, - 'Content-Type' => 'text/xml; charset=UTF-8', + 'Content-Type' => 'text/xml; charset=UTF-8' } }, 45) - if (res and res.code != 500 and res.code != 200) - # to do - implement error handlers for each status code, 404, 301, etc. - if res.body =~ /

Logon failed<\/h1>/ + if res and res.code != 500 and res.code != 200 + if res and res.body =~ /

Logon failed<\/h1>/ print_error("[SAP] #{ip}:#{rport} - login failed!") else print_error("[SAP] #{ip}:#{rport} - something went wrong!") end return - elsif res.body =~ /Response/ + elsif res and res.body =~ /Response/ print_status("[SAP] #{ip}:#{rport} - RFC service is alive") else print_status("[SAP] #{ip}:#{rport} - RFC service is not alive") end - rescue ::Rex::ConnectionError - print_error("[SAP] #{ip}:#{rport} - Unable to connect") - return - end + rescue ::Rex::ConnectionError + print_error("[SAP] #{ip}:#{rport} - Unable to connect") + return end end +end