Beispiel #1
0
def verifyweb():
    iplist = iptable.iplist()
    webs = iptable.somelist("res/web.txt")
    webok = []
    for web in webs:
        l = re.findall(
            r'\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b',
            getIP(web))
        if l:
            if l[0] in iplist:
                webok.append(web)
                print 'join  ' + web
    with open('res/web.txt', 'w') as f:
        f.write('\n'.join(webok))
Beispiel #2
0
def opendkim():
	web = iptable.somelist("res/web.txt")
	os.system('echo '' > /etc/opendkim/KeyTable')
	os.system('echo '' > /etc/opendkim/SigningTable')
	os.system('echo localhost > /etc/opendkim/TrustedHosts')
	for w in web :
			os.system("mkdir  /etc/opendkim/keys/"+w)
			os.system('opendkim-genkey --domain='+w+'  --directory=/etc/opendkim/keys/'+w+'/')
			os.system('echo "default._domainkey.'+w+' '+w+':default:/etc/opendkim/keys/'+w+'/default.private" >> /etc/opendkim/KeyTable')
			os.system('echo "*@'+w+' default._domainkey.'+w+'" >> /etc/opendkim/SigningTable')
			os.system('echo "'+w+'" >> /etc/opendkim/TrustedHosts')
			print(w+'创建密匙成功!')

	os.system('chown opendkim:opendkim -R /etc/opendkim/')
	os.system('chmod -R 700 /etc/opendkim')
	os.system('systemctl restart opendkim.service')
	os.system('systemctl restart postfix.service')
Beispiel #3
0
def sendemail():
    os.system('rm -rf /var/log/maillog')
    os.system('chmod 777 -R /var/log')
    os.system('service rsyslog restart')
    user_emails = iptable.somelist("res/useremail.txt")
    all_num = len(user_emails)
    time_now = time.time()
    ip_list_num = len(iptable.iplist())
    donum = 0
    for useremail in user_emails:
        iptable_reset = int(open("res/static/iptable_reset.txt", "r").read())
        if iptable_reset % ip_list_num == 0:
            iptable.iptable()
            iptable_reset = 0
        donum = mail(useremail, donum, user_emails.index(useremail), all_num,
                     time_now)
        iptable_reset = iptable_reset + 1
        with open('res/static/iptable_reset.txt', 'w') as f:
            f.write(str(iptable_reset))
        time.sleep(random.randint(12, 21))
Beispiel #4
0
def dnspod(typename):
	l=raw_input("\n\033[1;32;40m请输入dnspod api账号密码 格式 xxxxxx,xxxxxxxxxxx :")
	if l=='':
		print '请输入 api账号密码!'
		exit()
	ip = iptable.iplist()
	web = iptable.somelist("res/web.txt")
	ip_list=ip+ip+ip+ip
	count=0		
	for w in web :	
			www=w
			#print(w+ip_list[web.index(w)])
			if typename=='添加全部域名解析':
					count+=1
					req_data = {'login_token':l,'format':'json','domain':w}
					requrl = "https://dnsapi.cn/Domain.Create"
					try:
						r = json.loads(requests.post(requrl, data=req_data).text)
						dkim_origin=open('/etc/opendkim/keys/'+www+'/default.txt',"r").read()
						dkim=iptable.clear(re.findall(re.compile(r'[(](.*)[)]', re.S), dkim_origin)[0])
						print (www+'添加域名 ->'+r['status']['message'])
						if 'exists' not in r['status']['message']:
							req_data=	[
										{'login_token':l,'format':'json','domain':w,'sub_domain':'@','record_line':'默认','record_type':'A','value':ip_list[web.index(w)]},
										{'login_token':l,'format':'json','domain':w,'sub_domain':'mail','record_line':'默认','record_type':'A','value':ip_list[web.index(w)]},
										{'login_token':l,'format':'json','domain':w,'sub_domain':'*','record_line':'默认','record_type':'CNAME','value':'mail.'+w},
										{'login_token':l,'format':'json','domain':w,'sub_domain':'@','record_line':'默认','record_type':'MX','value':'mail.'+w},
										{'login_token':l,'format':'json','domain':w,'sub_domain':'default._domainkey','record_line':'默认','record_type':'TXT','value':dkim}
										]
							requrl = "https://dnsapi.cn/Record.Create"
							for req_data_one in req_data:
									r = json.loads(requests.post(requrl, data=req_data_one).text)
									print (www+'添加'+req_data_one['record_type']+'记录 ->'+r['status']['message'])
					except :
	  					  print r['status']['message']
			elif typename=='删除全部域名解析':
					count+=1
					req_data = {'login_token':l,'format':'json','domain':w}
					requrl = "https://dnsapi.cn/Domain.Remove"
					r = json.loads(requests.post(requrl, data=req_data).text)
					print (www+'删除'+' ->'+r['status']['message'])
Beispiel #5
0
def msq_insert(email='', table=''):
    db = MySQLdb.connect(db_config()['host'],
                         db_config()['username'],
                         db_config()['passwords'],
                         db_config()['db_name'],
                         charset='utf8')
    cursor = db.cursor()
    table = check_table(table)
    if email == 'all':
        useremail = ''
        for x in iptable.somelist("res/apiuseremail.txt"):
            useremail = useremail + '("' + x + '")' + ','
    else:
        useremail = '("' + email + '")'
    sql = 'insert into ' + table + '(useremail) values' + useremail[:-1]
    try:
        # 执行SQL语句
        cursor.execute(sql)
        # 提交到数据库执行
        db.commit()
    except:
        # 发生错误时回滚
        db.rollback()
Beispiel #6
0
def verify_istrue(email, email_path):
    email_list = []
    email_obj = []
    email_ok = []
    final_res = {}
    #firstverify(email,email_path)
    email_obj = iptable.somelist(email_path)
    all_num = len(email_obj)
    s = connect_email()
    for need_verify in email_obj:
        totol = email_obj.index(need_verify)
        send_from = login_email(s).docmd('RCPT TO:<%s>' % need_verify)
        if send_from[0] == 250 or send_from[0] == 451:
            final_res[need_verify] = 'True'  # 存在
            record_process = '正在检查 第' + str(totol) + ' 个用户邮箱  剩余 ' + str(
                all_num - totol) + '  尝试成功! sendto ' + need_verify + '\n'
            print '正在检查 第' + str(totol) + ' 个用户邮箱  剩余 ' + str(
                all_num -
                totol) + ' 个' + need_verify + '结果:' + final_res[need_verify]
            with open('res/static/progress.txt', 'a+') as f:
                f.write(record_process)
            with open('res/gress.txt', 'a+') as f:
                f.write(need_verify + '\n')
    s.close()
Beispiel #7
0
def verifyemail():
    useremails = iptable.somelist('res/useremail.txt')
    final_list = verify_istrue(useremails, 'res/useremail.txt')
Beispiel #8
0
def senderemail():
    web = random.choice(iptable.somelist("res/web.txt"))
    name = iptable.clear(random.choice(
        iptable.somelist("res/static/name.txt")))
    sender = name + '@' + web
    return sender