Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/ntlmrelayx.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def start_servers(options, threads):
c.setLootdir(options.lootdir)
c.setOutputFile(options.output_file)
c.setdumpHashes(options.dump_hashes)
c.setLDAPOptions(options.no_dump, options.no_da, options.no_acl, options.no_validate_privs, options.escalate_user, options.add_computer, options.delegate_access, options.dump_laps, options.dump_gmsa, options.dump_adcs, options.sid, options.add_dns_record)
c.setLDAPOptions(options.adwsdomaindump, options.no_dump, options.no_da, options.no_acl, options.no_validate_privs, options.escalate_user, options.add_computer, options.delegate_access, options.dump_laps, options.dump_gmsa, options.dump_adcs, options.sid, options.add_dns_record)
c.setRPCOptions(options.rpc_mode, options.rpc_use_smb, options.auth_smb, options.hashes_smb, options.rpc_smb_port, options.icpr_ca_name)
c.setMSSQLOptions(options.query)
c.setInteractive(options.interactive)
Expand Down Expand Up @@ -388,6 +388,7 @@ def stop_servers(threads):

#LDAP options
ldapoptions = parser.add_argument_group("LDAP client options")
ldapoptions.add_argument('--adwsdomaindump', action='store_true', required=False, help='Instead of using ldapdomaindump use adwsdomaindump for better OPSEC')
ldapoptions.add_argument('--no-dump', action='store_false', required=False, help='Do not attempt to dump LDAP information')
ldapoptions.add_argument('--no-da', action='store_false', required=False, help='Do not attempt to add a Domain Admin')
ldapoptions.add_argument('--no-acl', action='store_false', required=False, help='Disable ACL attacks')
Expand Down
35 changes: 29 additions & 6 deletions impacket/examples/ntlmrelayx/attacks/ldapattack.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,14 +909,37 @@ def run(self):
#print self.client.entries
global dumpedDomain
global dumpedAdcs
# Set up a default config
domainDumpConfig = ldapdomaindump.domainDumpConfig()

# Change the output directory to configured rootdir
domainDumpConfig.basepath = self.config.lootdir
if self.config.adwsdomaindump:
try:
import adwsdomaindump
from ldap3.abstract.entry import Entry
def entry_get(self, attr, default=None):
try:
return self[attr].value
except:
return default

Entry.get = entry_get

domainDumpConfig = adwsdomaindump.domainDumpConfig()
domainDumpConfig.basepath = self.config.lootdir
domainDumper = adwsdomaindump.domainDumper(self.client.server, self.client, domainDumpConfig)

except ModuleNotFoundError:
LOG.error('adwsdomaindump not installed, falling back to ldapdomaindump')
domainDumpConfig = ldapdomaindump.domainDumpConfig()
domainDumpConfig.basepath = self.config.lootdir
domainDumper = ldapdomaindump.domainDumper(self.client.server, self.client, domainDumpConfig)
else:
# Set up a default config
domainDumpConfig = ldapdomaindump.domainDumpConfig()

# Change the output directory to configured rootdir
domainDumpConfig.basepath = self.config.lootdir

# Create new dumper object
domainDumper = ldapdomaindump.domainDumper(self.client.server, self.client, domainDumpConfig)
# Create new dumper object
domainDumper = ldapdomaindump.domainDumper(self.client.server, self.client, domainDumpConfig)

if self.config.interactive:
if self.tcp_shell is not None:
Expand Down
3 changes: 2 additions & 1 deletion impacket/examples/ntlmrelayx/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ def setDomainAccount(self, machineAccount, machineHashes, domainIp):
def setRandomTargets(self, randomtargets):
self.randomtargets = randomtargets

def setLDAPOptions(self, dumpdomain, addda, aclattack, validateprivs, escalateuser, addcomputer, delegateaccess, dumplaps, dumpgmsa, dumpadcs, sid, adddnsrecord):
def setLDAPOptions(self, adwsdomaindump, dumpdomain, addda, aclattack, validateprivs, escalateuser, addcomputer, delegateaccess, dumplaps, dumpgmsa, dumpadcs, sid, adddnsrecord):
self.adwsdomaindump = adwsdomaindump
self.dumpdomain = dumpdomain
self.addda = addda
self.aclattack = aclattack
Expand Down