Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlite3
- import json
- import requests
- import re
- import smtplib
- import dns.resolver
- domain=input("pls enter domain name")#the domain will synchrone with the other files
- employName=[]
- with open(f"{domain}.txt") as f:
- for x in f:
- res = x[1:].split(",")
- d={}
- job=[]
- for xx in res:
- if(":" in xx):
- d[xx.split(":")[0].replace("'","")]=xx.split(":")[1].replace("'","")
- for j in d.values():
- job.append(j)
- d=d.keys()
- for i in d:
- employName.append(i)
- with open(f"{domain}.text")as g:#open the other file
- file=g.readline()
- # print(file)
- # print(type(file))
- form="'[]"
- file2=""
- for i in file:
- if i in form:
- pass
- else:
- file2=file2+i
- #print(file2)
- file2=file2.split(",")
- emailList=file2
- format=[]
- m=0
- for i in emailList:
- if i[m]!="@":
- m=m+1
- else:
- format.append(i[m::])
- format=list(dict.fromkeys(format))
- #print(format)
- fullName=[]
- j=0
- for i in employName:
- fullName.append(i)
- #print(fullName)
- for i in fullName:
- fullName[j]=i.replace(" ","")#make the name without space
- j+=1
- #print(fullName)
- choose=int(input(f"which format do you want press number with the len\nfrom 0-{(len(format)-1)}\n{format}"))
- choose=format[choose]
- newEmailFake=[]
- for i in fullName:
- newEmailFake.append(f"{i+choose}")
- print(newEmailFake)
- # Address used for SMTP MAIL FROM command
- fromAddress = 'corn@bt.com'
- # Simple Regex for syntax checking
- #regex = '^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$'
- # Email address to verify
- for i in newEmailFake:
- addressToVerify = str(i)
- # # Syntax check
- # #match = re.match(regex, addressToVerify)
- # #if match == None:
- # #print('Bad Syntax')
- # #raise ValueError('Bad Syntax')
- splitAddress = addressToVerify.split('@')
- domain1 = str(splitAddress[1])
- print('Domain:', domain1)
- records = dns.resolver.query(domain1, 'MX')
- print(records)
- mxRecord = records[0].exchange
- print(mxRecord)#output .
- mxRecord = str(mxRecord)
- print(mxRecord)# output .
- # SMTP lib setup (use debug level for full output)
- server = smtplib.SMTP()
- print(server)
- server.set_debuglevel(0)
- print(server)
- server.connect(mxRecord)
- print(server.connect(mxRecord))
- server.helo(server.local_hostname) ### server.local_hostname(Get local server hostname)
- print(server.helo(server.local_hostname))
- server.mail(fromAddress)
- # print(server.mail(fromAddress))
- #
- # code, message = server.rcpt(str(addressToVerify))
- # server.quit()
- #
- # #print(code)
- # #print(message)
- #
- # # Assume SMTP response 250 is success
- # if code == 250:
- # print('Success')
- # else:
- # print('Bad')
- #
- #
- #
- #
- #
- #
- #
- # #
- # # #if there is no file in this name its will create" If you call "sqlite3.connect('company.db')" again, it will open the previously created database"
- # # connection=sqlite3.connect("my_repo.db")#create database same as "create data base command"
- # #
- # # cursor=connection.cursor()
- # # #
- # # #cursor.execute('''drop table fake_list''')#for remove table
- # # # cursor in SQL and databases is a control structure to
- # # # traverse over the records in a database. So it's used for the fetching of the results
- # #
- # # #the variable incluse the syntax of the sql
- # # sqlCommand="""
- # # create table fake_list (
- # # fullname VARCHAR(50),
- # # job VARCHAR(100),
- # # email VARCHAR(50));"""
- # # cursor.execute(sqlCommand)
- # # for (i,b,t) in zip(fullName,newEmailFake,job):
- # # sqlCommand=f'''INSERT INTO fake_list (fullname,email,job) values ("{i}","{b}","{t}");'''
- # # cursor.execute(sqlCommand)
- # # save=int(input("do yo want to save the change?\n press 1 if yes "))
- # # if save==1:
- # # connection.commit()#save the change
- # # connection.close()#close the connection
- # #
- # # else:
- # # pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement