Skip to content

Instantly share code, notes, and snippets.

@invisiblek
Last active August 3, 2016 17:54
Show Gist options
  • Save invisiblek/264449b50ac57428a16644493bf10674 to your computer and use it in GitHub Desktop.
Save invisiblek/264449b50ac57428a16644493bf10674 to your computer and use it in GitHub Desktop.
import string
import random
import mechanize
import requests
import imaplib
import email
import re
import time
from faker import Factory
NUM_ACCOUNTS = 20
def processMailbox(M):
M.select()
typ, data = M.search(None, 'UnSeen', 'FROM', '[email protected]')
mails = data[0].split()
#print "There are %i accounts to verify!" % len(mails)
for num in mails:
typ, data = M.fetch(num, '(RFC822)')
msg = email.message_from_string(data[0][1])
if msg.is_multipart():
for payload in msg.get_payload():
manipulatePayload(payload)
break
else:
manipulatePayload(msg)
def manipulatePayload(payload):
m=re.search('https://club\.pokemon\.com/us/.*', str(payload.get_payload(None,True)))
newURL = m.group(0).rstrip(".")
#print("Sending confirmation request to " + newURL)
tried = 0
br = mechanize.Browser()
while tried <= 3:
try:
br.open(newURL)
#print 'Confirmation Successful!'
break
except:
tried += 1
def generateStr(numChars):
return ''.join(random.choice(string.ascii_lowercase + string.digits) for x in range(numChars))
def verifyAccounts():
M = imaplib.IMAP4_SSL('imap.gmail.com')
try:
M.login('[email protected]', "mypasssword")
except imaplib.IMAP4.error:
print("LOGIN FAILED")
rv, mailboxes = M.list()
if rv == 'OK' :
#print("Selecting Mailbox Inbox")
processMailbox(M)
M.close()
M.logout()
def createAccount(fake):
myPassword = generateStr(10)
myAccount = 'PokeMapper' + generateStr(5)
print 'Creating Account for ' + myAccount + ' with password ' + myPassword
br = mechanize.Browser()
tried = 0
while tried < 5:
try:
br.open("https://club.pokemon.com/us/pokemon-trainer-club/parents/sign-up")
#print 'Signup Opened'
break
except:
tried += 1
form = br.select_form("verify-age")
dob = br.form.find_control("dob")
country = br.form.find_control("country")
dob.value = "1990-05-15"
tried = 0
while tried < 5:
try:
#print 'Attempting to submit DOB'
br.submit()
#print 'DOB submitted'
break;
except:
tried += 1
form = br.select_form("create-account")
two_word_name = "false"
while(two_word_name == "false"):
fake_name = fake.name()
try:
first_name, last_name = fake_name.split()
two_word_name = "true"
except:
two_word_name = "false"
#print first_name, last_name
myEmail = "whatever+" + generateStr(5) + "@gmail.com"
username = br.form.find_control("username")
password = br.form.find_control("password")
confirm_password = br.form.find_control("confirm_password")
email = br.form.find_control("email")
confirm_email = br.form.find_control("confirm_email")
terms = br.form.find_control("terms")
username.value = myAccount
password.value = myPassword
confirm_password.value = myPassword
email.value = myEmail
confirm_email.value = myEmail
terms.items[0].selected = True
while tried < 5:
#print 'Attempting to create account with email ' + myEmail
try:
br.submit()
br.close()
#print 'Successfully created account with email ' + myEmail
with open("accounts.csv", "a") as account_file:
account_file.write("%s,%s,%s\n" % (myAccount, myPassword, myEmail))
break
except:
tried += 1
for i in range(NUM_ACCOUNTS):
createAccount(Factory.create())
verifyAccounts()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment