How to use the msldap.ldap_objects.aduser.MSADUser_TSV_ATTRS function in msldap

To help you get started, we’ve selected a few msldap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skelsec / kerberoast / kerberoast / kerberoast.py View on Github external
ctr += 1
						f.write('%s@%s\r\n' % (user.sAMAccountName, domain))
			else:
				print('[+] ASREP users')
				async for user, err in client.get_all_knoreq_users():
					if err is not None:
						raise err
					ctr += 1
					print('%s@%s' % (user.sAMAccountName, domain))

			logging.debug('Enumerated %d ASREP user accounts' % ctr)

		if args.type in ['full', 'all']:
			logging.debug('Enumerating ALL user accounts, this will take some time depending on the size of the domain')
			ctr = 0
			attrs = args.attrs if args.attrs is not None else MSADUser_TSV_ATTRS
			if args.out_file:
				with open(os.path.join(basefolder,basefile+'_ldap_users.tsv'), 'w', newline='', encoding ='utf8') as f:
					writer = csv.writer(f, delimiter = '\t')
					writer.writerow(attrs)
					async for user, err in client.get_all_users():
						if err is not None:
							raise err
						ctr += 1
						writer.writerow(user.get_row(attrs))

			else:
				logging.debug('Are you sure about this?')
				print('[+] Full user dump')
				print('\t'.join(attrs))
				async for user, err in client.get_all_users():
					if err is not None: