determine the domain using env vars instead of parsing net.exe output
parent
508574970c
commit
b2ce2ddb05
|
@ -38,15 +38,13 @@ class Metasploit3 < Msf::Post
|
||||||
cur_domain, cur_user = client.sys.config.getuid.split("\\")
|
cur_domain, cur_user = client.sys.config.getuid.split("\\")
|
||||||
ltype = "domain.group.members"
|
ltype = "domain.group.members"
|
||||||
ctype = "text/plain"
|
ctype = "text/plain"
|
||||||
domain = ""
|
|
||||||
|
|
||||||
# Get Data
|
# Get Data
|
||||||
usr_res = run_cmd("net groups \"#{datastore['GROUP']}\" /domain")
|
usr_res = run_cmd("net groups \"#{datastore['GROUP']}\" /domain")
|
||||||
dom_res = run_cmd("net config workstation")
|
|
||||||
|
|
||||||
# Parse Returned data
|
# Parse Returned data
|
||||||
members = get_members(usr_res.split("\n"))
|
members = get_members(usr_res.split("\n"))
|
||||||
domain = get_domain(dom_res.split("\n"))
|
domain = client.sys.config.getenv("USERDOMAIN")
|
||||||
|
|
||||||
# Show results if we have any, Error if we don't
|
# Show results if we have any, Error if we don't
|
||||||
if ! members.empty?
|
if ! members.empty?
|
||||||
|
@ -93,16 +91,6 @@ class Metasploit3 < Msf::Post
|
||||||
return members
|
return members
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_domain(results)
|
|
||||||
domain = ''
|
|
||||||
|
|
||||||
results.each do |line|
|
|
||||||
if line =~ /Workstation domain \s+(.*)/ then domain = $1.strip end
|
|
||||||
end
|
|
||||||
|
|
||||||
return domain
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_member(cur_dom, cur_user, dom, users)
|
def is_member(cur_dom, cur_user, dom, users)
|
||||||
|
|
||||||
member = false
|
member = false
|
||||||
|
@ -115,6 +103,7 @@ class Metasploit3 < Msf::Post
|
||||||
|
|
||||||
return member
|
return member
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_cmd(cmd)
|
def run_cmd(cmd)
|
||||||
process = session.sys.process.execute(cmd, nil, {'Hidden' => true, 'Channelized' => true})
|
process = session.sys.process.execute(cmd, nil, {'Hidden' => true, 'Channelized' => true})
|
||||||
res = ""
|
res = ""
|
||||||
|
|
Loading…
Reference in New Issue