add GetAttackersBySid

This commit is contained in:
Oran Nadler 2018-05-15 13:07:19 +03:00
parent bad90d35c1
commit d0ce419ae0
1 changed files with 17 additions and 1 deletions

View File

@ -831,6 +831,16 @@ class PassTheHashMap(object):
return set(map(Machine, attackers))
@cache
def GetAttackersBySid(self, sid):
machines = set()
for m in self.machines:
if sid in self.GetCachedSids(m):
machines.add(m)
return machines
@cache
def GetVictimsByAttacker(self, attacker):
if type(attacker) != unicode:
@ -1166,11 +1176,17 @@ def main():
<h3>Secret: '<a href="#{secret}">{secret}</a>'</h3>
""".format(username=pth.GetUsernameBySid(sid), sid=sid, secret=pth.GetSecretBySid(sid), domain=pth.GetSidInfo(sid)["Domain"])
print """<h3>Attackable Machines</h3>"""
print """<h3>Possible Victims Machines</h3>"""
print """<ul>"""
for m in pth.GetVictimsBySid(sid):
print """<li><a href="#{ip}">{ip} ({hostname})</a></li>""".format(ip=m.GetIp(), hostname=m.GetHostName())
print """</ul>"""
print """<h3>Possible Attackers Machines</h3>"""
print """<ul>"""
for m in pth.GetAttackersBySid(sid):
print """<li><a href="#{ip}">{ip} ({hostname})</a></li>""".format(ip=m.GetIp(), hostname=m.GetHostName())
print """</ul>"""
for secret in pth.GetAllSecrets():
print """<a name="{secret}"><h2>Secret '{secret}'</h2></a>""".format(secret=secret)