Skip to content

Instantly share code, notes, and snippets.

@yaodong
Created January 12, 2017 18:01
Show Gist options
  • Save yaodong/7079c777d08fe9634c2ecb33cbed30ef to your computer and use it in GitHub Desktop.
Save yaodong/7079c777d08fe9634c2ecb33cbed30ef to your computer and use it in GitHub Desktop.
google user name tester
from time import sleep
import subprocess, json
import string
username_prefix = "prefix1234"
cmd = """curl 'https://accounts.google.com/InputValidator?resource=SignUp&service=mail' -H 'Referer: https://accounts.google.com/SignUp?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ltmpl=default' -H 'Origin: https://accounts.google.com' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36' -H 'Content-type: application/json' --data-binary '{"input01":{"Input":"GmailAddress","GmailAddress":"__name__","FirstName":"","LastName":""},"Locale":"en"}' --compressed"""
for i in range(10, 100):
real_name = '%s%s' % (username_prefix, i)
real_cmd = cmd.replace('__name__', real_name)
p = subprocess.Popen(real_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out = p.stdout.read()
data = out.decode('utf-8')
if "Try another" in data:
print("%s: Taken" % real_name)
else:
with open("uname_%s.txt" % username_prefix, "a") as myfile:
myfile.write("%s\n" % real_name)
print("%s: OK <---" % real_name)
sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment