0% found this document useful (0 votes)
36 views4 pages

Cortex

This Python script allows sending SMS messages by converting email messages. It takes an email, subject, and message as input. It then uses the phone number to determine the carrier and get the correct email format for sending SMS. It loops through phone numbers, sends the emails, and prints status for each one.

Uploaded by

Jean Felix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views4 pages

Cortex

This Python script allows sending SMS messages by converting email messages. It takes an email, subject, and message as input. It then uses the phone number to determine the carrier and get the correct email format for sending SMS. It loops through phone numbers, sends the emails, and prints status for each one.

Uploaded by

Jean Felix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

#!

/usr/bin/env python3
# -*- coding: utf8 -*-

'''

+-----------------------------------------+
| PROJECT : E-Mail To SMS |
| DESCRIPTION : SMTP Sender To SMS |
| RELEASE : V1 |
| AUTHOR : @F4C3R100 |
+-----------------------------------------+

'''

from ast import expr_context


import os, sys, requests, phonenumbers, smtplib, random
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

class Sender:
def __init__(self, sender, subject, message):
self.sender = sender
self.carriers = {"airfire": "@sms.airfiremobile.com","alltel":
"@message.alltel.com","allied": "@sms.alltelwireless.com","alaska":
"@msg.acsalaska.com","ameritech": "@paging.acswireless.com","assurance":
"@vmobl.com","at&t": "@txt.att.net","bellsouth": "@bellsouth.cl","bluegrass":
"@sms.bluecell.com","bluesky": "@psms.bluesky.as","blueskyfrog":
"@blueskyfrog.com","boostmobile": "@sms.myboostmobile.com","carolinawest":
"@cwwsms.com","cellcom": "@cellcom.quiktxt.com","cellularsouth":
"@csouth1.com","centennial": "@cwemail.com","chariton": "@sms.cvalley.net ","chat":
"@mail.msgsender.com","cincinnati": "@gocbw.com","cingular":
"@cingular.com","cleartalk": "@sms.cleartalk.us","xit": "@sms.xit.net ","comcast":
"@comcastpcs.textmsg.com","consumer": "@mailmymobile.net ","cricket":
"@sms.mycricket.com","cspire": "@cspire1.com","dtc": "@sms.advantagecell.net
","element": "@sms.elementmobile.net ","esendex": "@echoemail.net ","general":
"@mobile.gci.net ","golden": "@gscsms.com","google":
"@txt.voice.google.com","greatcall": "@vtext.com","helio": "@myhelio.com","kajeet":
"@mobile.kajeet.net ","longlines": "@text.longlines.com","metro":
"@mymetropcs.com","nextech": "@sms.nextechwireless.com","nextel":
"@messaging.nextel.com","pageplus": "@vtext.com","pioneer":
"@zsend.com","project_fi": "@msg.fi.google.com","psc": "@sms.pscel.com","rogers":
"@sms.rogers.com","qwest": "@qwestmp.com","solavei": "@tmomail.net ","south":
"@rinasms.com","southernlink": "@page.southernlinc.com","sprint":
"@messaging.sprintpcs.com","straight": "@vtext.com","syringa": "@rinasms.com","t-
mobile": "@tmomail.net ","teleflip": "@teleflip.com","ting":
"@message.ting.com","tracfone": "@mmst5.tracfone.com","telus":
"@msg.telus.com","unicel": "@utext.com","verizon": "@vtext.com","viaero":
"@viaerosms.com","virgin": "@vmobl.com","voyager":
"@text.voyagermobile.com","orange": "@sms.orange.ci"}
self.leads = self.openFile("leads.txt")
self.smtps = self.openFile("smtp.txt")
self.api = self.openFile("api.txt")[0].strip()
self.default_sender = True if not self.sender else self.sender
self.subject = subject
self.message = message
self.main()

def openFile(self, filename):


if os.path.exists(filename):
s = open(filename)
return s.readlines()

def prepareNumber(self, number):


if len(number) == 10:
return "+1"+number
elif len(number) == 12:
tp = phonenumbers.parse(number, "US")
if phonenumbers.is_valid_number(tp):
return number
else:
print("Invalid number bitch!")
return False
else:
return False

def GetCarrier(self, phonenumber):


number = self.prepareNumber(phonenumber)
headers = {'x-rapidapi-host': 'scout.p.rapidapi.com','x-rapidapi-key':
self.api}
params = (('dialcode', phonenumber),('country_code', 'US'),)
response = requests.get('https://scout.p.rapidapi.com/v1/numbers/search',
headers=headers, params=params, timeout=10)
if response.status_code == 200:
try:
carrier = response.json()["operating_company_name"].lower().split("
")
return carrier[0]
except IndexError:
print("Couldn't find carrier")
return False
else:
print("Auth missing")
return False
def GetEmail(self, phonenumber, carrier):
phonenumber = phonenumber.replace("+1","")
for key,value in enumerate(self.carriers):
if carrier in value or carrier == value:
return phonenumber + self.carriers[value]
else:
return False

def SendTo(self, receiver):


cur_smtp = random.choice(self.smtps).strip()
try:
host, port, user, passw = cur_smtp.split("|")
except Exception:
return False
try:
if str(port) == "587":
smtp = smtplib.SMTP(host, port)
elif str(port) == "465":
smtp = smtplib.SMTP_SSL(host, port)
if smtp:
try:
if str(port) == "587":
smtp.starttls()
smtp.ehlo()
try:
smtp.login(user,passw)
try:
msg = MIMEText(self.message)
#msg['Subject'] = self.subject
#msg['From'] = self.default_sender
#msg['To'] = receiver
e = smtp.sendmail(self.default_sender, receiver,
self.message)
smtp.close()
if e == {}:
return True
else:
return False
except smtplib.SMTPRecipientsRefused:
print(f"Invalid receiver : {receiver}")
return False
except:
return False
except smtplib.SMTPAuthenticationError:
print("Invalid Password")
return False
except smtplib.SMTPNotSupportedError:
print("SMTP is not supported by server")
return False
else:
return False
except Exception as E:
print(E)
return False

def main(self):
if self.leads:
print(f"\033[34m[\033[32mi\033[34m] \033[37mSending out to \
033[33m{len(self.leads)} \033[37mLeads.")
for lead in self.leads:
lead = lead.strip()
carrier = self.GetCarrier(lead)
if carrier:
email = self.GetEmail(lead, carrier)
if email:
print(email)
sent = self.SendTo(email)
if sent:
print(f"\033[34m[\033[32m*\033[34m] \033[37mSMS sent to
\033[33m{lead} \033[34m[\033[32m{carrier}\033[34m]")
elif not sent:
print(f"\033[34m[\033[31m!\033[34m] \033[37mSMS not
sent to \033[33m{lead}")
else:
print(f"\033[34m[\033[31m!\033[34m] \033[37mError")
elif not email:
print(f"\033[34m[\033[31m!\033[34m] \033[37mFailed to get
email from \033[33m{lead}")
else:
print(f"\033[34m[\033[31m!\033[34m] \033[37mError")
elif not carrier:
print(f"\033[34m[\033[31m!\033[34m] \033[37mFailed to get
carrier from \033[33m{lead}")
else:
print(f"\033[34m[\033[31m!\033[34m] \033[37mError")

else:
print(f"\033[34m[\033[31m!\033[34m] \033[37mNo leads.txt found in
current directory \033[33m{len(self.leads)} \033[37mLeads.")

def main():
print("")
subject = input(f"\033[34m[\033[32mi\033[34m] \033[37mSubject for SMS sending:
")
message = input(f"\033[34m[\033[32mi\033[34m] \033[37mMessage for SMS sending:
")
sender = input(f"\033[34m[\033[32mi\033[34m] \033[37mDo you want use default
sender \033[34m[\033[32mY\033[34m/\033[31mN\033[34m]: ")
if sender.upper() == "N":
sender = input(f"\033[34m[\033[32mi\033[34m] \033[37mSender for SMS
sending: ")

Sender(sender, subject, message)

if __name__ == "__main__":
main()

You might also like