forked from p15670423/monkey
add cahce
This commit is contained in:
parent
e557f78ae3
commit
826df43708
|
@ -173,23 +173,40 @@ class Machine(object):
|
||||||
|
|
||||||
@cache
|
@cache
|
||||||
def GetUsernameBySid(self, sid):
|
def GetUsernameBySid(self, sid):
|
||||||
|
info = self.GetSidInfo(sid)
|
||||||
|
|
||||||
|
if not info:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return info["Domain"] + "\\" + info["Username"]
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def GetSidInfo(self, sid):
|
||||||
doc = self.latest_system_info
|
doc = self.latest_system_info
|
||||||
|
|
||||||
for user in doc["data"]["Win32_UserAccount"]:
|
for user in doc["data"]["Win32_UserAccount"]:
|
||||||
if eval(user["SID"]) != sid:
|
if eval(user["SID"]) != sid:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return eval(user["Name"])
|
return { "Domain": eval(user["Domain"]),
|
||||||
|
"Username": eval(user["Name"]),
|
||||||
|
"Disabled": user["Disabled"] == "true",
|
||||||
|
"PasswordRequired": user["PasswordRequired"] == "true",
|
||||||
|
"PasswordExpires": user["PasswordExpires"] == "true", }
|
||||||
|
|
||||||
if not self.IsDomainController():
|
if not self.IsDomainController():
|
||||||
for dc in self.GetDomainControllers():
|
for dc in self.GetDomainControllers():
|
||||||
username = dc.GetUsernameBySid(sid)
|
domain = dc.GetSidInfo(sid)
|
||||||
|
|
||||||
if username != None:
|
if domain != None:
|
||||||
return username
|
return domain
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def GetInstalledServices(self):
|
||||||
|
"IIS-WebServer"
|
||||||
|
|
||||||
@cache
|
@cache
|
||||||
def GetUsernamesBySecret(self, secret):
|
def GetUsernamesBySecret(self, secret):
|
||||||
sam = self.GetLocalSecrets()
|
sam = self.GetLocalSecrets()
|
||||||
|
@ -622,6 +639,16 @@ class PassTheHashMap(object):
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def GetSidInfo(self, sid):
|
||||||
|
for m in self.machines:
|
||||||
|
info = m.GetSidInfo(sid)
|
||||||
|
|
||||||
|
if info:
|
||||||
|
return info
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
@cache
|
@cache
|
||||||
def GetSidsBySecret(self, secret):
|
def GetSidsBySecret(self, secret):
|
||||||
SIDs = set()
|
SIDs = set()
|
||||||
|
@ -868,8 +895,9 @@ def main():
|
||||||
for sid in pth.GetAllSids():
|
for sid in pth.GetAllSids():
|
||||||
print """<a name="{sid}"><h2>SID '{sid}'</h2></a>
|
print """<a name="{sid}"><h2>SID '{sid}'</h2></a>
|
||||||
<h3>Username: '<a href="#{username}">{username}</a>'</h3>
|
<h3>Username: '<a href="#{username}">{username}</a>'</h3>
|
||||||
|
<h3>Domain: {domain}</h3>
|
||||||
<h3>Secret: '<a href="#{secret}">{secret}</a>'</h3>
|
<h3>Secret: '<a href="#{secret}">{secret}</a>'</h3>
|
||||||
""".format(username=pth.GetUsernameBySid(sid), sid=sid, secret=pth.GetSecretBySid(sid))
|
""".format(username=pth.GetUsernameBySid(sid), sid=sid, secret=pth.GetSecretBySid(sid), domain=pth.GetSidInfo(sid)["Domain"])
|
||||||
|
|
||||||
print """<h3>Attackable Machines</h3>"""
|
print """<h3>Attackable Machines</h3>"""
|
||||||
print """<ul>"""
|
print """<ul>"""
|
||||||
|
|
Loading…
Reference in New Issue