skip420

fb

Dec 27th, 2020 (edited)
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.45 KB | None | 0 0
  1. #add_this_to_DeadTrapv2_Directory
  2. #osint_Directory
  3. #fb.py
  4.  
  5.  
  6. import os
  7. import requests
  8. from PIL import Image
  9. from bs4 import BeautifulSoup
  10. import sys
  11. import re
  12.  
  13. def image(name, email_or_num, soup, img_link = False):
  14.  
  15.     img_links = soup.findAll('img')
  16.  
  17.     for i in img_links:
  18.  
  19.         if "profile" in i['src']:
  20.             img_link = i['src'][:-2]+"500"
  21.  
  22.         if not os.path.isdir('recent_search'):
  23.             os.mkdir('recent_search')
  24.  
  25.     img_path = "recent_search/" + \
  26.     name.replace(' ', '-')+"__"+email_or_num+"_.jpg"
  27.  
  28.     img_data = requests.get(img_link).content if (img_link != False) else 0
  29.  
  30.     if img_data != 0:
  31.         img = open(img_path, mode="wb")
  32.         img.write(img_data)
  33.         img.close()
  34.         print("Profile image Saved in : ", img_path)
  35.  
  36. def emails(soup):
  37.     try:
  38.         emails = soup.findAll('div', {'class':'bi bj'})
  39.  
  40.         if len(emails) != 0:
  41.  
  42.             print("Found user emails or numbers :")
  43.  
  44.             for i in emails:
  45.  
  46.                 print('\t\t'+i.text)
  47.  
  48.     except Exception as err:
  49.         print(err)
  50.  
  51. def remove_tags(text):
  52.     TAG_RE = re.compile(r'<[^>]+>')
  53.     return TAG_RE.sub('', text)
  54.  
  55. def is_valid(num):
  56.     URL = "https://mbasic.facebook.com/login/identify/?ctx=recover"
  57.     payload = {'email': num, 'did_submit': 'Search'}
  58.     profiles = []
  59.  
  60.     req = requests.post(URL, data=payload)
  61.     if req.status_code == 200:
  62.  
  63.         if True:
  64.             soup = BeautifulSoup(req.content.decode('utf-8'), 'html.parser')
  65.             try:
  66.                 name = soup.findAll('strong')
  67.                 for names in name:
  68.                     profiles.append(str(names))
  69.                 name = remove_tags(",".join(profiles))
  70.             except IndexError:
  71.                 try:
  72.                     name = soup.findAll('div', {'class': 'p v w'})
  73.                     for names in name:
  74.                         profiles.append(str(names))
  75.                     name = remove_tags(",".join(profiles))
  76.                 except:
  77.                     sys.exit()
  78.            
  79.             image(name, num, soup)
  80.  
  81.             print("[+] Found Facebook Users : ", len(profiles))
  82.  
  83.             if len(profiles) != 0:
  84.  
  85.                 print("[+] Found Facebook Usernames:", name)
  86.                 emails(soup)
  87.             else:
  88.                 pass
  89.         else:
  90.             print("[!] No Facebook user is associated with " + num)
  91.     else:
  92.         print("Check your internet Connection")
Add Comment
Please, Sign In to add comment