Skip to content

Commit e08c4a8

Browse files
committed
Remove .Net check
cmd_exec doesn't seem to be the best way to go because there is some issue grabbing the output sometimes.
1 parent 3851db7 commit e08c4a8

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -30,43 +30,6 @@ def have_powershell?
3030
return false
3131
end
3232

33-
#
34-
# Returns the .Net version
35-
#
36-
def get_dotnet_version
37-
case sysinfo['OS']
38-
when /Windows 8|10/
39-
cmd = 'wmic /namespace:\\\\root\\cimv2 path win32_optionalfeature where "caption like \'.NET Framework%\' and InstallState = 1" get caption'
40-
else
41-
cmd = 'wmic /namespace:\\\\root\\cimv2 path win32_product where "name like \'%%.NET%%\'" get version'
42-
end
43-
44-
if have_powershell?
45-
process, pid, c = execute_script(cmd)
46-
cmd_out = ''
47-
while (d = process.channel.read)
48-
if d == ""
49-
if (Time.now.to_i - start < time_out) && (cmd_out == '')
50-
sleep 0.1
51-
else
52-
break
53-
end
54-
else
55-
cmd_out << d
56-
end
57-
end
58-
else
59-
begin
60-
cmd_out = cmd_exec(cmd)
61-
rescue Rex::TimeoutError
62-
return nil
63-
end
64-
end
65-
66-
cmd_out.scan(/(\d\.[\d\.]+)/).flatten.first
67-
end
68-
69-
7033
#
7134
# Returns the Powershell version
7235
#

0 commit comments

Comments
 (0)