Skip to content

Instantly share code, notes, and snippets.

@philihp
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philihp/11333192 to your computer and use it in GitHub Desktop.
Save philihp/11333192 to your computer and use it in GitHub Desktop.
Queries Google Voice's web service for all possible phone numbers
#!/usr/bin/python
import sys
import urllib2
import json
opener = urllib2.build_opener()
opener.addheaders.append(('Cookie', ...put your browser session cookies here... ))
for n in xrange(2000,9999):
npad = "{0:04d}".format(n)
#print "Searching", npad
f = opener.open('https://www.google.com/voice/setup/search/?ac='+npad+'&start=0&country=US')
data =json.loads(f.read())
f.close()
num = data.get('JSON').get('num_matches')
for x in xrange(0,int(num),5):
f = opener.open('https://www.google.com/voice/setup/search/?ac='+npad+'&start='+str(x)+'&country=US')
data = json.loads(f.read())
f.close()
numbers = data.get('JSON').get('vanity_info').keys()
for number in numbers:
number = number[2:]
#if number == number[::-1]:
# print number
print number
sys.stdout.flush()
if len(numbers)!=5:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment