diff --git a/lib/msf/core/module/platform.rb b/lib/msf/core/module/platform.rb index eb5de28c00fc7..1bf758cc5bb06 100644 --- a/lib/msf/core/module/platform.rb +++ b/lib/msf/core/module/platform.rb @@ -383,7 +383,7 @@ class Ruby < Msf::Module::Platform # class Linux < Msf::Module::Platform Rank = 100 - Alias = "linux" + Aliases = [ 'linux', 'debian-linux-gnu', 'linux2.6' ] end # diff --git a/lib/rex/proto/mysql/client.rb b/lib/rex/proto/mysql/client.rb index 31ac3311e927b..3f8ce267814c0 100644 --- a/lib/rex/proto/mysql/client.rb +++ b/lib/rex/proto/mysql/client.rb @@ -28,6 +28,29 @@ def current_database # Current database is stored as an array under the type 1 key. session_track.fetch(1, ['']).first end + + # @return [Hash] Server version variables: + # * :arch [String] The server architecture. + # * :platform [String] The server platform. + def query_server_vars + result = {} + + server_vars = query("show variables where variable_name in ('version_compile_machine', 'version_compile_os')").entries + server_vars.each do |server_var| + name, value = server_var + + case name + when 'version_compile_machine' + result[:arch] = value + when 'version_compile_os' + result[:platform] = value + else + next + end + end + + result + end end end end diff --git a/modules/auxiliary/scanner/mysql/mysql_login.rb b/modules/auxiliary/scanner/mysql/mysql_login.rb index aeaaba020c783..3f4570be9c09d 100644 --- a/modules/auxiliary/scanner/mysql/mysql_login.rb +++ b/modules/auxiliary/scanner/mysql/mysql_login.rb @@ -211,6 +211,10 @@ def session_setup(result, client) 'PASSWORD' => result.credential.private } + server_vars = my_session.client.query_server_vars + my_session.arch = server_vars[:arch] + my_session.platform = server_vars[:platform] + start_session(self, nil, merging, false, my_session.rstream, my_session) end end