Skip to content

Commit 766c0cc

Browse files
committed
return nil if no .Net is installed
1 parent 11f94a6 commit 766c0cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/msf/core/post/windows/powershell.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ def get_dotnet_version
3737
case sysinfo['OS']
3838
when /Windows 8|10/
3939
cmd_out = cmd_exec('wmic /namespace:\\\\root\\cimv2 path win32_optionalfeature where "caption like \'.NET Framework%\' and InstallState = 1" get caption')
40-
cmd_out.scan(/(\d\.[\d\.]+)/).flatten.first || ''
4140
else
4241
cmd_out = cmd_exec('wmic /namespace:\\\\root\\cimv2 path win32_product where "name like \'%%.NET%%\'" get version')
43-
cmd_out.scan(/[\d\.]+/).flatten.first || ''
4442
end
43+
44+
cmd_out.scan(/(\d\.[\d\.]+)/).flatten.first
4545
end
4646

4747

0 commit comments

Comments
 (0)