Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 26, 2011, 10:09 AM   #1
eshroom
macrumors 6502
 
Join Date: Oct 2006
Search Google Voice and compile list of all available numbers!

Here is a simple Perl script enabling you to search through Google and compile a list of numbers (obviously all numbers would take a while, so perhaps choose an area code). Just run through perl in terminal.

Perhaps someone could do me a favour and compile a list in the 646 area code database, or 415. I am not in the US and it is difficult to do through a VPN (most don't allow automated processes).

Here's the full version of the script, edited ever so slightly from Will Entriken's creation:

1. Login to Google Voice

2. Find numbers


# prepare
mkdir GOOGLEVOICE; cd GOOGLEVOICE

# login
curl https://www.google.com/accounts/ClientLogin \
-d Email=YOUREMAIL@gmail.com \
-d Passwd=YOURPASSWORD \
-d source=privacylog \
-d service=grandcentral > token

AUTH=$(sed -n '/Au/s/A/a/p' token)
HEADER="Authorization: GoogleLogin $AUTH"
URL="https://www.google.com/voice/?setup=1#setup/"

# which area codes does Google Voice support?
curl --header "$HEADER" "${URL}?ac=[201-999]&start=0" | grep -ho "+1[0-9]\{10\}" | sort -u >> areacodes
cat areacodes | sed 's/..\(...\)......./\1/' | sort -u
# answer: 201 202 203 205 207 208 209 210 213 214 215 216 218 219 224 225 229 231 234 240 248 251 252 253 254 256 260 262 267 269 270 276 281 301 302 303 304 305 307 312 313 314 315 316 317 318 319 320 321 323 325 330 331 334 336 337 339 347 352 361 385 386 401 402 404 405 406 407 408 409 410 412 413 414 415 419 423 424 425 430 432 434 435 440 443 469 478 480 484 501 502 503 504 505 507 508 509 510 512 513 515 516 518 520 530 540 541 551 559 561 562 563 567 570 571 573 574 575 585 586 601 602 605 607 608 609 612 614 615 616 617 619 623 626 630 631 636 646 650 651 657 660 661 662 678 682 701 702 703 704 706 707 708 713 714 715 716 717 719 720 724 727 731 732 734 740 747 754 757 760 762 763 765 769 772 773 774 775 779 781 785 786 801 802 803 804 805 806 810 812 813 814 815 816 817 818 828 830 831 832 843 845 847 848 850 856 857 858 859 860 862 863 864 865 870 872 901 903 904 906 908 909 910 913 914 915 916 917 918 919 920 925 928 931 936 937 941 949 951 952 954 956 970 971 972 973 978 980 985 989

# add a full number from each area code you want to NUMBERS - I'm interested in 707 or 404 or 646 or 215 or 415
printf "+17070000000\n+14040000000\n" > numbers

# now we use a BFS on each digit to find all numbers
# continue at your own peril!


sed -n 's/+1\(...\).*/\1/p' numbers | sort -u |
(while read LINE; do curl --header "$HEADER" "${URL}?ac=${LINE:0:3}&q=$LINE[0-9]&start=0"; done) | grep -ho "+1[0-9]\{10\}" | sort -u >> numbers

sed -n 's/+1\(....\).*/\1/p' numbers | sort -u |
(while read LINE; do curl --header "$HEADER" "${URL}?ac=${LINE:0:3}&q=$LINE[0-9]&start=0"; done) | grep -ho "+1[0-9]\{10\}" | sort -u >> numbers

sed -n 's/+1\(.....\).*/\1/p' numbers | sort -u |
(while read LINE; do curl --header "$HEADER" "${URL}?ac=${LINE:0:3}&q=$LINE[0-9]&start=0"; done) | grep -ho "+1[0-9]\{10\}" | sort -u >> numbers

sed -n 's/+1\(......\).*/\1/p' numbers | sort -u |
(while read LINE; do curl --header "$HEADER" "${URL}?ac=${LINE:0:3}&q=$LINE[0-9]&start=0"; done) | grep -ho "+1[0-9]\{10\}" | sort -u >> numbers

sed -n 's/+1\(.......\).*/\1/p' numbers | sort -u |
(while read LINE; do curl --header "$HEADER" "${URL}?ac=${LINE:0:3}&q=$LINE[0-9]&start=0"; done) | grep -ho "+1[0-9]\{10\}" | sort -u >> numbers

sed -n 's/+1\(........\).*/\1/p' numbers | sort -u |
(while read LINE; do curl --header "$HEADER" "${URL}?ac=${LINE:0:3}&q=$LINE[0-9]&start=0"; done) | grep -ho "+1[0-9]\{10\}" | sort -u >> numbers

sed -n 's/+1\(.........\).*/\1/p' numbers | sort -u |
(while read LINE; do curl --header "$HEADER" "${URL}?ac=${LINE:0:3}&q=$LINE[0-9]&start=0"; done) | grep -ho "+1[0-9]\{10\}" | sort -u >> numbers

sed -n 's/+1\(.........\).*/\1/p' numbers | sort -u |
(while read LINE; do curl --header "$HEADER" "${URL}?ac=${LINE:0:3}&q=$LINE[0-9]&start=0"; done) | grep -ho "+1[0-9]\{10\}" | sort -u >> numbers

3. Harvest out your winnings*
sort -u numbers > sorted; mv sorted numbers


There's a second part that has code necessary to decipher the numbers and pick good combinations. Of course, it is up to you to decide what number layout you are after, so they may not be useful.

Thanks

Last edited by eshroom; Jan 26, 2011 at 05:32 PM.
eshroom is offline   0 Reply With Quote
Old Jan 26, 2011, 11:39 AM   #2
chown33
macrumors 603
 
Join Date: Aug 2009
You could probably sign up for Amazon Web Services, enable the EC2 service, then create an instance running at one of the two US locations. Then ssh in and run your script from the EC2 instance.

Practically any of the Linux EC2 images would work, since 'perl' is commonly installed by default. If the script runs in less than 1 hour of wall-clock time, it'd probably cost you under 10 cents (US currency).

I have used a simple EC2 instance to get URLs from other servers outside of EC2. That part works fine.

I say "probably" only because I'm unsure of what billing requirements would be needed for non-US customers. I'm also not entirely sure what range of IP address the EC2 instance will have, or whether EC2 is blocked by GV. I see no reason for those obstacles, but it would be a good idea to test it with something like 'curl' or 'wget' and hit http://www.whatismyip.com/ .
chown33 is offline   0 Reply With Quote
Old Jan 26, 2011, 05:35 PM   #3
eshroom
Thread Starter
macrumors 6502
 
Join Date: Oct 2006
Quote:
Originally Posted by chown33 View Post
You could probably sign up for Amazon Web Services, enable the EC2 service, then create an instance running at one of the two US locations. Then ssh in and run your script from the EC2 instance.

Practically any of the Linux EC2 images would work, since 'perl' is commonly installed by default. If the script runs in less than 1 hour of wall-clock time, it'd probably cost you under 10 cents (US currency).

I have used a simple EC2 instance to get URLs from other servers outside of EC2. That part works fine.

I say "probably" only because I'm unsure of what billing requirements would be needed for non-US customers. I'm also not entirely sure what range of IP address the EC2 instance will have, or whether EC2 is blocked by GV. I see no reason for those obstacles, but it would be a good idea to test it with something like 'curl' or 'wget' and hit http://www.whatismyip.com/ .
Thanks, but I wouldn't know where to start. Also, I only need this one thing done. For all my other needs a VPN will suffice.
eshroom is offline   0 Reply With Quote
Old Jun 2, 2012, 01:57 PM   #4
awesomerobot
macrumors newbie
 
Join Date: Oct 2007
I hate commenting on a year+ old thread, but this would be really useful to use.

this wasn't working out of the box for me, but worked when I changed the login bit to this:

curl https://www.google.com/accounts/ClientLogin \
--data-urlencode Email=YOUREMAIL@gmail.com --data-urlencode Passwd=YOURPASSWORD \
-d accountType=GOOGLE \
-d source=Google-cURL-Example \
-d service=grandcentral > token

Last edited by awesomerobot; Jun 2, 2012 at 02:23 PM.
awesomerobot is offline   0 Reply With Quote
Old Sep 3, 2012, 10:10 PM   #5
junjettrasmonte
macrumors newbie
 
Join Date: Sep 2012
PHP Version

Here's a PHP script I made derived from this post. I'm sharing this as my way of saying thank you.

to run the script below you need to supply the ac and s parameters like so

http://localhost/gv.php?ac=121$s=0
s should be looped and incremented by 5 each time since google will give you 5 numbers each page.

Also keep in mind that this will only work with a US based IP. If you're outside US, then you can use a proxy to spoof your IP. I use http://www.hotspotshield.com/

------------
<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://www.google.com/accounts/ClientLogin");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$data = array(
'accountType' => 'GOOGLE',
'Email' => 'username@gmail.com',
'Passwd' => 'password',
'source'=>'PHI-cUrl-Example',
'service'=>'grandcentral'
);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$msg = curl_exec($ch);

$cookies = split("\n",$msg);
//print_r($cookies);

$ch = curl_init("https://www.google.com/voice/b/0/setup/searchnew/?ac=".$_GET['ac']."&start=". $_GET['s']);

$header[] = 'Authorization: GoogleLogin ' . $cookies[2];

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);

$msg = curl_exec($ch);
curl_close($ch);

$arr_data = json_decode($msg);
echo "matches found = " . $arr_data->JSON->num_matches . "<br />";
foreach($arr_data->JSON->vanity_info as $numbers=>$whatever){
echo $numbers . "<br/>";
}

?>
------------
junjettrasmonte is offline   0 Reply With Quote
Old Dec 15, 2012, 10:32 AM   #6
fulldecent
macrumors newbie
 
Join Date: Sep 2009
Hello, I am the original author, Will Entriken.

Thank you for your feedback, I use this to improve the script.

Last edited by dejo; Dec 15, 2012 at 01:51 PM. Reason: Removed self-promotion.
fulldecent is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Google Voice Search max pl iOS 7 2 Oct 13, 2013 05:10 PM
Siri vs Google voice search iOSOS iOS 6 20 Nov 9, 2012 11:33 AM
Enhanced JellyBean Google Voice Search (40+ Questions that will blow you away) aohus Apple, Industry and Internet Discussion 209 Jul 7, 2012 12:57 AM
Siri vs. Google Now Voice Search (40+ questions) pk7 iPhone 1 Jul 5, 2012 12:51 PM
New Google voice search on Android beats Siri in every test neiltc13 Apple, Industry and Internet Discussion 3 Jun 28, 2012 03:59 PM

Forum Jump

All times are GMT -5. The time now is 01:41 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC