diff --git a/modules/auxiliary/admin/mysql/mysql_enum.rb b/modules/auxiliary/admin/mysql/mysql_enum.rb index e002296d8466b..0da6612592706 100644 --- a/modules/auxiliary/admin/mysql/mysql_enum.rb +++ b/modules/auxiliary/admin/mysql/mysql_enum.rb @@ -6,6 +6,7 @@ class MetasploitModule < Msf::Auxiliary include Msf::Auxiliary::Report include Msf::Exploit::Remote::MYSQL + include Msf::OptionalSession def initialize(info = {}) super(update_info(info, @@ -16,6 +17,7 @@ def initialize(info = {}) }, 'Author' => [ 'Carlos Perez ' ], 'License' => MSF_LICENSE, + 'SessionTypes' => %w[MySQL], 'References' => [ [ 'URL', 'https://cisecurity.org/benchmarks.html' ] @@ -53,6 +55,7 @@ def report_cred(opts) def run return if not mysql_login_datastore + print_status("Running MySQL Enumerator...") print_status("Enumerating Parameters") #------------------------------------------------------- diff --git a/modules/auxiliary/admin/mysql/mysql_sql.rb b/modules/auxiliary/admin/mysql/mysql_sql.rb index 335a43d2863f0..4fd161aca90ee 100644 --- a/modules/auxiliary/admin/mysql/mysql_sql.rb +++ b/modules/auxiliary/admin/mysql/mysql_sql.rb @@ -5,6 +5,7 @@ class MetasploitModule < Msf::Auxiliary include Msf::Exploit::Remote::MYSQL + include Msf::OptionalSession def initialize(info = {}) super(update_info(info, @@ -14,7 +15,8 @@ def initialize(info = {}) against a MySQL instance given the appropriate credentials. }, 'Author' => [ 'Bernardo Damele A. G. ' ], - 'License' => MSF_LICENSE + 'License' => MSF_LICENSE, + 'SessionTypes' => %w[MySQL] )) register_options( @@ -33,7 +35,8 @@ def cmd_select(*args) end def run - return if not mysql_login_datastore + return unless mysql_login_datastore + print_status("Sending statement: '#{datastore['SQL']}'...") res = mysql_query(datastore['SQL']) || [] res.each do |row| diff --git a/modules/auxiliary/scanner/mysql/mysql_file_enum.rb b/modules/auxiliary/scanner/mysql/mysql_file_enum.rb index 3f7a8c248b172..379c5aab001d8 100644 --- a/modules/auxiliary/scanner/mysql/mysql_file_enum.rb +++ b/modules/auxiliary/scanner/mysql/mysql_file_enum.rb @@ -9,6 +9,7 @@ class MetasploitModule < Msf::Auxiliary include Msf::Exploit::Remote::MYSQL include Msf::Auxiliary::Report include Msf::Auxiliary::Scanner + include Msf::OptionalSession def initialize super( @@ -22,7 +23,8 @@ def initialize [ 'URL', 'http://pauldotcom.com/2013/01/mysql-file-system-enumeration.html' ], [ 'URL', 'http://www.digininja.org/projects/mysql_file_enum.php' ] ], - 'License' => MSF_LICENSE + 'License' => MSF_LICENSE, + 'SessionTypes' => %w[MySQL] ) register_options([ @@ -42,11 +44,9 @@ def mysql_query_no_handle(sql) end def run_host(ip) - vprint_status("Login...") + vprint_status("Login...") unless session - if (not mysql_login_datastore) - return - end + return unless mysql_login_datastore begin mysql_query_no_handle("USE " + datastore['DATABASE_NAME']) diff --git a/modules/auxiliary/scanner/mysql/mysql_hashdump.rb b/modules/auxiliary/scanner/mysql/mysql_hashdump.rb index b5dae437c8fee..7a00d15c57610 100644 --- a/modules/auxiliary/scanner/mysql/mysql_hashdump.rb +++ b/modules/auxiliary/scanner/mysql/mysql_hashdump.rb @@ -6,8 +6,8 @@ class MetasploitModule < Msf::Auxiliary include Msf::Exploit::Remote::MYSQL include Msf::Auxiliary::Report - include Msf::Auxiliary::Scanner + include Msf::OptionalSession def initialize super( @@ -17,16 +17,16 @@ def initialize hashes from a MySQL server and stores them for later cracking. ), 'Author' => ['theLightCosine'], - 'License' => MSF_LICENSE + 'License' => MSF_LICENSE, + 'SessionTypes' => %w[MySQL] ) end def run_host(ip) - return unless mysql_login_datastore service_data = { - address: ip, + address: rhost, port: rport, service_name: 'mysql', protocol: 'tcp', diff --git a/modules/auxiliary/scanner/mysql/mysql_schemadump.rb b/modules/auxiliary/scanner/mysql/mysql_schemadump.rb index 8362de601a91f..a1dd4721b56c2 100644 --- a/modules/auxiliary/scanner/mysql/mysql_schemadump.rb +++ b/modules/auxiliary/scanner/mysql/mysql_schemadump.rb @@ -8,8 +8,8 @@ class MetasploitModule < Msf::Auxiliary include Msf::Exploit::Remote::MYSQL include Msf::Auxiliary::Report - include Msf::Auxiliary::Scanner + include Msf::OptionalSession def initialize super( @@ -19,7 +19,8 @@ def initialize MySQL DB server. }, 'Author' => ['theLightCosine'], - 'License' => MSF_LICENSE + 'License' => MSF_LICENSE, + 'SessionTypes' => %w[MySQL] ) register_options([ @@ -29,10 +30,8 @@ def initialize end def run_host(ip) + return unless mysql_login_datastore - if (not mysql_login_datastore) - return - end mysql_schema = get_schema mysql_schema.each do |db| report_note( diff --git a/modules/auxiliary/scanner/mysql/mysql_writable_dirs.rb b/modules/auxiliary/scanner/mysql/mysql_writable_dirs.rb index 72f18dbde5336..2863430db3c88 100644 --- a/modules/auxiliary/scanner/mysql/mysql_writable_dirs.rb +++ b/modules/auxiliary/scanner/mysql/mysql_writable_dirs.rb @@ -7,6 +7,7 @@ class MetasploitModule < Msf::Auxiliary include Msf::Exploit::Remote::MYSQL include Msf::Auxiliary::Report include Msf::Auxiliary::Scanner + include Msf::OptionalSession def initialize super( @@ -20,7 +21,8 @@ def initialize 'References' => [ [ 'URL', 'https://dev.mysql.com/doc/refman/5.7/en/select-into.html' ] ], - 'License' => MSF_LICENSE + 'License' => MSF_LICENSE, + 'SessionTypes' => %w[MySQL] ) register_options([