清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
# coding=utf-8
# config 为配置词典
# y 是长度 最终生产出来的验证码是 长度 = Y - title的长度
# x 是循环次数 生成数量
# title 是激活码最前固定字符串 留空代表不使用
import string
import random
import MySQLdb
db = MySQLdb.connect("localhost", "root", "123456", "Python")
cursor = db.cursor()
cursor.execute("DROP TABLE IF EXISTS JHM") # 如果有JHM这个数据库就删除
cursor.execute(
"""CREATE TABLE JHM(id int(11) primary key AUTO_INCREMENT, jhm CHAR(20) NOT NULL , status CHAR(1) NOT NULL)""")
config = {'y': 10, 'x': 20, 'title': "Dota"}
def jhm(num):
b = ''.join(random.sample(string.ascii_letters + string.digits, num))
return b
def sql(w):
try:
cursor.execute(w)
except:
db.rollback()
for z in range(config['x']):
w = "INSERT INTO JHM(jhm,status)VALUES ('%s','%s')" % (
config['title'] + jhm(config['y'] - len(config['title'])), '0')
sql(w)
db.commit()
db.close()