Land #7212, Revert back win32/win64 platform string for Windows meterpreter
commit
bf77e14bef
|
@ -325,25 +325,38 @@ class Meterpreter < Rex::Post::Meterpreter::Client
|
|||
def update_session_info
|
||||
username = self.sys.config.getuid
|
||||
sysinfo = self.sys.config.sysinfo
|
||||
tuple = self.platform.split('/')
|
||||
|
||||
self.platform = self.platform.split('/')[0] + '/' +
|
||||
case self.sys.config.sysinfo['OS']
|
||||
when /windows/i
|
||||
Msf::Module::Platform::Windows
|
||||
when /darwin/i
|
||||
Msf::Module::Platform::OSX
|
||||
when /freebsd/i
|
||||
Msf::Module::Platform::FreeBSD
|
||||
when /netbsd/i
|
||||
Msf::Module::Platform::NetBSD
|
||||
when /openbsd/i
|
||||
Msf::Module::Platform::OpenBSD
|
||||
when /sunos/i
|
||||
Msf::Module::Platform::Solaris
|
||||
else
|
||||
Msf::Module::Platform::Linux
|
||||
#
|
||||
# Windows meterpreter currently needs 'win32' or 'win64' to be in the
|
||||
# second half of the platform tuple, in order for various modules and
|
||||
# library code match on that specific string.
|
||||
#
|
||||
if self.platform !~ /win32|win64/
|
||||
|
||||
platform = case self.sys.config.sysinfo['OS']
|
||||
when /windows/i
|
||||
Msf::Module::Platform::Windows
|
||||
when /darwin/i
|
||||
Msf::Module::Platform::OSX
|
||||
when /freebsd/i
|
||||
Msf::Module::Platform::FreeBSD
|
||||
when /netbsd/i
|
||||
Msf::Module::Platform::NetBSD
|
||||
when /openbsd/i
|
||||
Msf::Module::Platform::OpenBSD
|
||||
when /sunos/i
|
||||
Msf::Module::Platform::Solaris
|
||||
else
|
||||
Msf::Module::Platform::Linux
|
||||
end.realname.downcase
|
||||
|
||||
#
|
||||
# This normalizes the platform from 'python/python' to 'python/linux'
|
||||
#
|
||||
self.platform = "#{tuple[0]}/#{platform}"
|
||||
end
|
||||
|
||||
|
||||
safe_info = "#{username} @ #{sysinfo['Computer']}"
|
||||
safe_info.force_encoding("ASCII-8BIT") if safe_info.respond_to?(:force_encoding)
|
||||
|
|
|
@ -39,7 +39,7 @@ class MetasploitModule < Msf::Post
|
|||
|
||||
def run
|
||||
|
||||
tech = datastore['TECHNIQUE'].to_i
|
||||
technique = datastore['TECHNIQUE'].to_i
|
||||
|
||||
unsupported if client.platform !~ /win32|win64/i
|
||||
|
||||
|
@ -48,11 +48,11 @@ class MetasploitModule < Msf::Post
|
|||
return
|
||||
end
|
||||
|
||||
result = client.priv.getsystem( tech )
|
||||
if result and result[0]
|
||||
print_good( "Obtained SYSTEM via technique #{result[1]}" )
|
||||
else
|
||||
print_error( "Failed to obtain SYSTEM access" )
|
||||
begin
|
||||
result = client.priv.getsystem(technique)
|
||||
print_good("Obtained SYSTEM via technique #{result[1]}")
|
||||
rescue Rex::Post::Meterpreter::RequestError => e
|
||||
print_error("Failed to obtain SYSTEM access")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue