1- require 'msf/core'
1+ ##
2+ # $Id$
3+ ##
4+
5+ ##
6+ # This file is part of the Metasploit Framework and may be subject to
7+ # redistribution and commercial restrictions. Please see the Metasploit
8+ # Framework web site for more information on licensing and terms of use.
9+ # http://metasploit.com/framework/
10+ ##
211
12+ require 'msf/core'
313
414class Metasploit3 < Msf ::Auxiliary
515
616 include Msf ::Exploit ::Remote ::HttpClient
717 include Msf ::Auxiliary ::WMAPScanUniqueQuery
818 include Msf ::Auxiliary ::Scanner
919
10-
1120 def initialize ( info = { } )
12- super ( update_info ( info ,
21+ super ( update_info ( info ,
1322 'Name' => 'SQLMAP SQL Injection External Module' ,
1423 'Description' => %q{
15- This module launch a sqlmap session.
24+ This module launch a sqlmap session.
1625 sqlmap is an automatic SQL injection tool developed in Python.
1726 Its goal is to detect and take advantage of SQL injection
1827 vulnerabilities on web applications. Once it detects one
@@ -25,48 +34,48 @@ def initialize(info = {})
2534 statement, read specific files on the file system and much
2635 more.
2736 } ,
28- 'Author' => [ 'bernardo.damele [at] gmail.com' , 'daniele.bellucci [at] gmail.com' ] ,
37+ 'Author' => [ 'Bernardo Damele A. G. <bernardo.damele [at]gmail.com> ' ] ,
2938 'License' => BSD_LICENSE ,
30- 'Version' => '$Revision$' ,
39+ 'Version' => '$Revision: 9212 $' ,
3140 'References' =>
3241 [
3342 [ 'URL' , 'http://sqlmap.sourceforge.net' ] ,
3443 ]
3544 ) )
36-
45+
3746 register_options (
3847 [
3948 OptString . new ( 'METHOD' , [ true , "HTTP Method" , 'GET' ] ) ,
4049 OptString . new ( 'PATH' , [ true , "The path/file to test for SQL injection" , 'index.php' ] ) ,
4150 OptString . new ( 'QUERY' , [ false , "HTTP GET query" , 'id=1' ] ) ,
42- OptString . new ( 'BODY ' , [ false , "The data string to be sent through POST" , '' ] ) ,
51+ OptString . new ( 'DATA ' , [ false , "The data string to be sent through POST" , '' ] ) ,
4352 OptString . new ( 'OPTS' , [ false , "The sqlmap options to use" , ' ' ] ) ,
44- OptPath . new ( 'SQLMAP_PATH' , [ true , "The sqlmap >= 0.6.1 full path " , '/sqlmap/sqlmap.py' ] ) ,
53+ OptPath . new ( 'SQLMAP_PATH' , [ true , "The sqlmap >= 0.6.1 full path " , '/sqlmap/sqlmap.py' ] ) ,
4554 OptBool . new ( 'BATCH' , [ true , "Never ask for user input, use the default behaviour" , true ] )
4655 ] , self . class )
4756 end
48-
57+
4958 # Modify to true if you have sqlmap installed.
5059 def wmap_enabled
5160 false
5261 end
5362
5463 # Test a single host
5564 def run_host ( ip )
56-
57- sqlmap = datastore [ 'SQLMAP_PATH' ]
58-
65+
66+ sqlmap = datastore [ 'SQLMAP_PATH' ]
67+
5968 if not sqlmap
6069 print_error ( "The sqlmap script could not be found" )
6170 return
6271 end
6372
64- data = datastore [ 'BODY ' ]
73+ data = datastore [ 'DATA ' ]
6574 method = datastore [ 'METHOD' ] . upcase
6675
6776 sqlmap_url = ( datastore [ 'SSL' ] ? "https" : "http" )
68- sqlmap_url += "://" + self . target_host + ":" + datastore [ 'RPORT' ]
69- sqlmap_url += "/" + datastore [ 'PATH' ]
77+ sqlmap_url += "://" + wmap_target_host + ":" + wmap_target_port
78+ sqlmap_url += "/" + datastore [ 'PATH' ]
7079
7180 if method == "GET"
7281 sqlmap_url += '?' + datastore [ 'QUERY' ]
@@ -93,3 +102,4 @@ def run_host(ip)
93102 end
94103
95104end
105+
0 commit comments