Skip to content

Instantly share code, notes, and snippets.

@zmrubin
Created January 20, 2023 05:31
Show Gist options
  • Save zmrubin/edebaeaf44f39770582519d1ead42bc9 to your computer and use it in GitHub Desktop.
Save zmrubin/edebaeaf44f39770582519d1ead42bc9 to your computer and use it in GitHub Desktop.
from twilio.rest import Client
import threading
from time import sleep
# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'YOUR_ACCOUNT_SID'
auth_token = 'YOUR_AUTH_TOKEN'
YOUR_TWILIO_PHONE_NUMBER = 'enter your twilio number here'
client = Client(account_sid, auth_token)
def textEveryone():
#text all the permutations of the number 512-3*1-2*04
for d5 in range(10):
for d10 in range(10):
ruJackie = f'+1 512-3{d5}1-2{d10}04'
love_letter = "Roses are red, violets are blue, some bro on the internet made a 🤖 to help me find you 💕"
print(ruJackie)
message = client.messages.create( body=love_letter, from_=YOUR_TWILIO_PHONE_NUMBER, to=ruJackie)
#print(message.sid)
def listenForReplies():
msg_sids=[]
while True:
messages = client.messages.list(to=YOUR_TWILIO_PHONE_NUMBER)
for message in messages:
if(not message.sid in msg_sids):
#print("SID: ", message.sid)
print("From: ", message.from_)
print("Body: ", message.body, '\n')
msg_sids.append(message.sid)
sleep(2)
def main():
listener = threading.Thread(target=listenForReplies)
listener.start()
textEveryone()
if __name__ == "__main__":
main()
@zmrubin
Copy link
Author

zmrubin commented Jan 20, 2023

This code will text message the love_letter to every permutation of the phone number +1 512-3 * 1-2 * 04 , then listen for replies and print them to the console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment