Merge branch 'master' into international_support

1.6
sixdub 2015-08-24 22:56:58 -04:00
commit d1ce277330
23 changed files with 165 additions and 43 deletions

View File

@ -1,3 +1,12 @@
8/24/2015
---------
-Added credentials/mimikatz/dcsync for remote DC credential extraction
-Added situational_awareness/network/get_domaintrusts
-Added /sids argument for credentials/mimikatz/golden_ticket
-Added credential parsing for dcsync output
-updated links for PowerTools
-Fixed bug in credential parsing with ":" inside of the password,username, or domain
8/20/2015
---------
-Continued porting native shell commands to WMI replacents in agent core

View File

@ -244,11 +244,12 @@ def parse_mimikatz(data):
for line in lines2:
try:
if "Username" in line:
username = line.split(":")[1].strip()
username = line.split(":",1)[1].strip()
elif "Domain" in line:
domain = line.split(":")[1].strip()
domain = line.split(":",1)[1].strip()
elif "NTLM" in line or "Password" in line:
password = line.split(":")[1].strip()
print line.split(":")
password = line.split(":",1)[1].strip()
except:
pass
@ -271,32 +272,56 @@ def parse_mimikatz(data):
if not (credType == "plaintext" and username.endswith("$")):
creds.append((credType, domain, username, password, hostName, sid))
# check if we have lsadump output to check for krbtgt
# happens on domain controller hashdumps
for x in xrange(8,13):
if lines[x].startswith("Domain :"):
if len(creds) == 0:
# check if we have lsadump output to check for krbtgt
# happens on domain controller hashdumps
for x in xrange(8,13):
if lines[x].startswith("Domain :"):
domain, sid, krbtgtHash = "", "", ""
domain, sid, krbtgtHash = "", "", ""
try:
domainParts = lines[x].split(":")[1]
domain = domainParts.split("/")[0].strip()
sid = domainParts.split("/")[1].strip()
try:
domainParts = lines[x].split(":")[1]
domain = domainParts.split("/")[0].strip()
sid = domainParts.split("/")[1].strip()
# substitute the FQDN in if it matches
if hostDomain.startswith(domain.lower()):
domain = hostDomain
sid = domainSid
# substitute the FQDN in if it matches
if hostDomain.startswith(domain.lower()):
domain = hostDomain
sid = domainSid
for x in xrange(0, len(lines)):
if lines[x].startswith("User : krbtgt"):
krbtgtHash = lines[x+2].split(":")[1].strip()
break
for x in xrange(0, len(lines)):
if lines[x].startswith("User : krbtgt"):
krbtgtHash = lines[x+2].split(":")[1].strip()
break
if krbtgtHash != "":
creds.append(("hash", domain, "krbtgt", krbtgtHash, hostName, sid))
except Exception as e:
pass
if krbtgtHash != "":
creds.append(("hash", domain, "krbtgt", krbtgtHash, hostName, sid))
except Exception as e:
pass
if len(creds) == 0:
# check if we get lsadump::dcsync output
if '** SAM ACCOUNT **' in lines:
domain, user, userHash, dcName, sid = "", "", "", "", ""
for line in lines:
try:
if line.strip().endswith("will be the domain"):
domain = line.split("'")[1]
elif line.strip().endswith("will be the DC server"):
dcName = line.split("'")[1].split(".")[0]
elif line.strip().startswith("SAM Username"):
user = line.split(":")[1].strip()
elif line.strip().startswith("Object Security ID"):
parts = line.split(":")[1].strip().split("-")
sid = "-".join(parts[0:-1])
elif line.strip().startswith("Hash NTLM:"):
userHash = line.split(":")[1].strip()
except:
pass
if domain != "" and userHash != "":
creds.append(("hash", domain, user, userHash, dcName, sid))
return uniquify_tuples(creds)

View File

@ -22,7 +22,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/blob/master/PowerView/powerview.ps1'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}

View File

@ -23,7 +23,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/blob/master/PowerView/powerview.ps1'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}

View File

@ -19,7 +19,7 @@ class Module:
'OutputExtension' : None,
'NeedsAdmin' : True,
'NeedsAdmin' : False,
'OpsecSafe' : True,

View File

@ -58,6 +58,11 @@ class Module:
'Required' : False,
'Value' : ''
},
'sids' : {
'Description' : 'External SIDs to add as sidhistory to the ticket.',
'Required' : False,
'Value' : ''
},
'id' : {
'Description' : 'id to impersonate, defaults to 500.',
'Required' : False,

View File

@ -22,7 +22,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerUp'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerUp'
]
}

View File

@ -22,7 +22,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerUp'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerUp'
]
}

View File

@ -23,7 +23,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerUp'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerUp'
]
}

View File

@ -23,7 +23,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerUp'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerUp'
]
}

View File

@ -22,7 +22,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerUp'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerUp'
]
}

View File

@ -23,7 +23,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerUp'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerUp'
]
}

View File

@ -25,7 +25,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerUp'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerUp'
]
}

View File

@ -23,7 +23,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerView'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}

View File

@ -22,7 +22,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerView'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}

View File

@ -23,7 +23,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerView'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}

View File

@ -0,0 +1,83 @@
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-NetDomainTrusts',
'Author': ['@harmj0y'],
'Description': ('Return all domain trusts for the current domain or '
'a specified domain. Part of PowerView.'),
'Background' : True,
'OutputExtension' : None,
'NeedsAdmin' : False,
'OpsecSafe' : True,
'MinPSVersion' : '2',
'Comments': [
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}
# any options needed by the module, settable during runtime
self.options = {
# format:
# value_name : {description, required, default_value}
'Agent' : {
'Description' : 'Agent to run module on.',
'Required' : True,
'Value' : ''
},
'Domain' : {
'Description' : 'Specific domain to query for trusts, defaults to current.',
'Required' : False,
'Value' : ''
},
'LDAP' : {
'Description' : 'Switch. Use LDAP for domain queries (less accurate).',
'Required' : False,
'Value' : ''
}
}
# save off a copy of the mainMenu object to access external functionality
# like listeners/agent handlers/etc.
self.mainMenu = mainMenu
for param in params:
# parameter format is [Name, Value]
option, value = param
if option in self.options:
self.options[option]['Value'] = value
def generate(self):
# read in the common module source code
moduleSource = self.mainMenu.installPath + "/data/module_source/situational_awareness/network/Invoke-MapDomainTrusts.ps1"
try:
f = open(moduleSource, 'r')
except:
print helpers.color("[!] Could not read module source path at: " + str(moduleSource))
return ""
moduleCode = f.read()
f.close()
script = moduleCode
if self.options['LDAP']['Value'].lower() == "true":
script += "Get-NetDomainTrustsLDAP | Out-String | %{$_ + \"`n\"};"
else:
script += "Get-NetDomainTrusts | Out-String | %{$_ + \"`n\"};"
return script

View File

@ -22,7 +22,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerView'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}

View File

@ -22,7 +22,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerView'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}

View File

@ -23,7 +23,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerView',
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView',
'https://github.com/mubix/netview'
]
}

View File

@ -22,7 +22,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerView'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}

View File

@ -24,7 +24,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerView'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}

View File

@ -23,7 +23,7 @@ class Module:
'MinPSVersion' : '2',
'Comments': [
'https://github.com/Veil-Framework/PowerTools/tree/master/PowerView'
'https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView'
]
}