Skip to content

Commit 62be877

Browse files
committed
fixed run_cmd()
1 parent c70f1e3 commit 62be877

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

modules/post/windows/gather/local_admin_search_enum.rb

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77

88
require 'msf/core'
99
require 'rex'
10+
require 'msf/core/post/common'
1011

1112
class Metasploit3 < Msf::Post
1213

1314
include Msf::Post::Windows::Priv
1415
include Msf::Auxiliary::Report
1516
include Msf::Auxiliary::Scanner
17+
include Msf::Post::Common
1618

1719
def initialize(info={})
1820
super(
@@ -64,7 +66,7 @@ def run
6466
if (sysinfo['OS'] =~ /Build [6-9]\d\d\d/)
6567
cmd << " /R"
6668
end
67-
res = run_cmd(cmd)
69+
res = cmd_exec("cmd.exe","/c #{cmd}")
6870

6971
# Check if RSOP data exists, if not disable group check
7072
unless res =~ /does not have RSOP data./
@@ -205,22 +207,6 @@ def connect(host)
205207
end
206208
end
207209
208-
# From enum_domain_group_users.rb by Carlos Perez and Stephen Haywood
209-
# Run command, return results
210-
def run_cmd(cmd)
211-
process = session.sys.process.execute(cmd, nil, {'Hidden' => true, 'Channelized' => true})
212-
res = ""
213-
214-
while (d = process.channel.read)
215-
break if d == ""
216-
res << d
217-
end
218-
219-
process.channel.close
220-
process.close
221-
return res
222-
end
223-
224210
# Write to notes database
225211
def db_note(host, data, type)
226212
if db

0 commit comments

Comments
 (0)