Files
Pennyw0rth-NetExec/cme/modules/MachineAccountQuota.py
T
mpgn 091915b990 Fix and add a lot, check commit message
Update LDAP proto:
	- can fetch a LDAP domain from an account from another domain (trust relation between forest)
	- fix sizeLimit to unlimited on LDAP queries
	- fix little mistake in LDAP modules

Update SMB proto:
	- fix users function when DC is vulnerable to NULL SESSION
	- add SAMRPC function to fetch users on the domain
	- add option --computers to fetch all computers

Update CLI
	- add function export, but it's not tested
2021-06-24 14:38:24 -04:00

35 lines
1.0 KiB
Python

from impacket.ldap import ldapasn1 as ldapasn1_impacket
class CMEModule:
'''
Module by Shutdown and Podalirius
Initial module:
https://github.com/ShutdownRepo/CrackMapExec-MachineAccountQuota
Authors:
Shutdown: @_nwodtuhs
Podalirius: @podalirius_
'''
def options(self, context, module_options):
pass
name = 'MAQ'
description = 'Retrieves the MachineAccountQuota domain-level attribute'
supported_protocols = ['ldap']
opsec_safe = True
multiple_hosts = False
def on_login(self, context, connection):
result = []
context.log.info('Getting the MachineAccountQuota')
searchFilter = '(objectClass=*)'
attributes = ['ms-DS-MachineAccountQuota']
result = connection.search(searchFilter, attributes, 1)
for item in result:
if isinstance(item, ldapasn1_impacket.SearchResultEntry) is not True:
continue
context.log.highlight("MachineAccountQuota: %d" % item['attributes'][0]['vals'][0])