You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/msf/core/post/windows/powershell.rb
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,14 @@ def have_powershell?
34
34
# Returns the .Net version
35
35
#
36
36
defget_dotnet_version
37
-
cmd_out=cmd_exec('wmic /namespace:\\\\root\\cimv2 path win32_product where "name like \'%%.NET%%\'" get version')
38
-
cmd_out.scan(/[\d\.]+/).flatten.first || ''
37
+
casesysinfo['OS']
38
+
when/Windows 8|10/
39
+
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 || ''
41
+
else
42
+
cmd_out=cmd_exec('wmic /namespace:\\\\root\\cimv2 path win32_product where "name like \'%%.NET%%\'" get version')
0 commit comments