Update #get_dotnet_path
parent
6d88c26474
commit
a798581fa3
|
@ -88,10 +88,17 @@ class Metasploit4 < Msf::Exploit::Local
|
||||||
def get_dotnet_path(windir)
|
def get_dotnet_path(windir)
|
||||||
base_path = "#{windir}\\Microsoft.NET\\Framework#{payload.arch.first == 'x86' ? '' : '64'}"
|
base_path = "#{windir}\\Microsoft.NET\\Framework#{payload.arch.first == 'x86' ? '' : '64'}"
|
||||||
paths = dir(base_path).select {|p| p[0] == 'v'}
|
paths = dir(base_path).select {|p| p[0] == 'v'}
|
||||||
version = paths.last
|
dotnet_path = nil
|
||||||
dotnet_path = "#{base_path}\\#{version}"
|
|
||||||
|
|
||||||
unless dotnet_path && directory?(dotnet_path)
|
paths.reverse.each do |p|
|
||||||
|
path = "#{base_path}\\#{p}"
|
||||||
|
if directory?(path) && file?("#{path}\\InstallUtil.exe")
|
||||||
|
dotnet_path = path
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unless dotnet_path
|
||||||
fail_with(Failure::NotVulnerable, '.NET is not present on the target.')
|
fail_with(Failure::NotVulnerable, '.NET is not present on the target.')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue