def brutefore_passwords(ip, url, credentials, service):
auth_requests = []<EOL>for credential in credentials:<EOL><INDENT>split = credential.strip().split('<STR_LIT::>')<EOL>username = split[<NUM_LIT:0>]<EOL>password = '<STR_LIT>'<EOL>if len(split) > <NUM_LIT:1>:<EOL><INDENT>password = split[<NUM_LIT:1>]<EOL><DEDENT>auth_requests.append(grequests.get(url, auth=(username, password)))<EOL><DEDENT>results = grequests.map(auth_requests)<EOL>for result in results:<EOL><INDENT>if result and result.status_code == <NUM_LIT:200>:<EOL><INDENT>creds = result.request.headers['<STR_LIT>'].split('<STR_LIT:U+0020>')[<NUM_LIT:1>]<EOL>creds = base64.b64decode(creds).decode('<STR_LIT:utf-8>')<EOL>creds = creds.split('<STR_LIT::>')<EOL>print_success("<STR_LIT>".format(<EOL>creds[<NUM_LIT:0>], creds[<NUM_LIT:1>], url))<EOL>credential = Credential(secret=creds[<NUM_LIT:1>], username=creds[<NUM_LIT:0>], type='<STR_LIT>', access_level='<STR_LIT>', service_id=service.id, host_ip=ip, description='<STR_LIT>')<EOL>credential.save()<EOL><DEDENT><DEDENT>
Bruteforce function, will try all the credentials at the same time, splits the given credentials at a ':'.