Advertisement
Guest User

adopteunmecBot 4UMB0T

a guest
Sep 9th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.85 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. '''
  4. 4UMB0T: adopteunmec bot
  5. Free for all. Made for educational purposes only
  6.  
  7. With YOUR VALID account, visit profiles for you
  8. required args : -town
  9.                 -nb of iteration. 1= 24 profiles to visit
  10. optional args : -age
  11. This is a PYTHON3 script
  12. Required pip3 modules
  13. beautifulsoup4,bs4,certifi,chardet,idna,pkg-resources,requests,urllib3
  14.  
  15. Files:
  16. aum-blacklist.txt = blacklist file that contains profile's ID not to visit.
  17. aum-data.json = DB that contains data/timestamp of profiles visited
  18.  
  19. Enjoy
  20. '''
  21.  
  22. from bs4 import BeautifulSoup
  23. import requests, time, sys, getpass, json, calendar, os.path
  24. import random, argparse, re
  25. from random import uniform
  26. '''
  27. User/Password : if you want, set them here. Otherwise they will be prompted later
  28. '''
  29. #user = ""
  30. #pwd = ""
  31.  
  32. url_base = "https://www.%61do%70te%75%6Eme%63.com" #url a littlebit obfuscated :-)
  33. url_auth = "/auth/login"
  34. url_myprofil = "/profile/me"
  35. url_profil = "/profile"
  36. url_search = "/g%6Fg%6Fle"
  37. donotvisitbefore = 21600
  38. total = 0
  39. ignored_profiles = 0
  40. age = None
  41.  
  42. def setUserAgent():
  43.     myAgents = [
  44.     "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36",
  45.     "Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16",
  46.     "Mozilla/5.0 (Linux; Android 5.1.1; SM-G928X Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36",
  47.     "Mozilla/5.0 (Linux; Android 7.0; Pixel C Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36",
  48.     "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a3pre) Gecko/20070330",
  49.     "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/6.0)",
  50.     "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"
  51.     ]
  52.     return(random.choice(myAgents))
  53.  
  54. def saveToJSON():
  55.     with open('./aum-data.json', 'w') as outfile:
  56.         json.dump(contacts, outfile)
  57.  
  58. def isIDKnown(id, contacts):
  59.     ''' Looking for 'id' into DB '''
  60.     for contact in contacts:
  61.         if contact['id'] == id:
  62.             return True
  63.  
  64. def isInBlackList(id):
  65.     ''' Looking for 'id' into BlackList '''
  66.     myBlackList = []
  67.     if os.path.isfile("./aum-blacklist.txt"):
  68.         with open('./aum-blacklist.txt') as fd:
  69.             for line in fd:
  70.                 line = line.strip()
  71.                 myBlackList.append(line)
  72.             if str(id) in myBlackList:
  73.                 return True
  74.  
  75.  
  76. def timeToVisitProfile(id, contacts):
  77.     ''' Looking if enough seconds have elapsed since the last visit '''
  78.     last_visit = 0
  79.     now  = calendar.timegm(time.gmtime())
  80.     for contact in contacts:
  81.         if contact['id'] == id:
  82.             last_visit = contact['last_visit']
  83.     if (now - last_visit >= donotvisitbefore):
  84.         return True
  85.  
  86. def updateLastVisit(id, contacts):
  87.     ''' updating DB with 'last visit' timestamp '''
  88.     now  = calendar.timegm(time.gmtime())
  89.     for contact in contacts:
  90.         if contact['id'] == id:
  91.             contact['last_visit'] = now
  92.  
  93. def getDatas(session, town, url):
  94.     ''' Call URL to retrieve raw datas '''
  95.     session.headers.update({'referer':url_base+url_search+'?q=en+ligne+' + town})
  96.     session.headers.update({'X-Requested-With':'XMLHttpRequest'})
  97.     response=session.get(url, cookies=session.cookies)
  98.     return json.loads(response.content.decode('utf-8'))
  99.  
  100. def visitProfiles(dataset, db):
  101.     ''' Parse the dataset and, if possible, visit each profile '''
  102.     global vp
  103.     global ip
  104.     if 'members' in dataset:
  105.         temp={}
  106.         index=0
  107.         for i in dataset['members']:
  108.             temp.update({index: i})
  109.             index += 1
  110.         dataset = temp
  111.     for key, value in dataset.items():
  112.         if 'pseudo' in value:
  113.             id = value['id']
  114.             name = value['pseudo']
  115.             pflage = value['age']
  116.  
  117.             if (age and not (int(age[0]) <= pflage <= int(age[1]))):
  118.                 print("-IGNORING profile \'" + name + "\' : not in AGE range")
  119.                 ip += 1
  120.                 continue
  121.             if isInBlackList(id):
  122.                 print("-IGNORING profile \'" + name + "\' : present in BLACKLIST")
  123.                 ip += 1
  124.                 continue
  125.             if not isIDKnown(id, db['people']):
  126.                 duree = uniform(4,6)
  127.                 print("+Profile \'" + name + "\' unknown : visit in " + str(round(duree,2)) + " seconds")
  128.                 time.sleep(duree)
  129.                 session.get(url_base+url_profil+"/"+id, cookies=session.cookies)
  130.                 vp += 1
  131.                 ''' New profile. Save it into DB '''
  132.                 db['people'].append({
  133.                     'pseudo' : name,
  134.                     'id' : id,
  135.                     'url' : url_base + "/profile/"+id,
  136.                     'last_visit' : calendar.timegm(time.gmtime())
  137.                     })
  138.                 saveToJSON()
  139.                 continue
  140.             elif isIDKnown(id, db['people']):
  141.                 ''' DB known profile. Check if visit is possible '''
  142.                 if timeToVisitProfile(id, db['people']):
  143.                     duree = uniform(4,6)
  144.                     print("+Profile \'" + name + "\' KNOWN : visit possible into " + str(round(duree,2)) + " seconds", end="")
  145.                     time.sleep(duree)
  146.                     session.get(url_base+url_profil+"/"+id, cookies=session.cookies)
  147.                     print("....DONE!")
  148.                     vp += 1
  149.                     updateLastVisit(id, db['people'])
  150.                     saveToJSON()
  151.                     continue
  152.                 else:
  153.                     print("-IGNORE profile \'" + name + "\' : Last visit too close.")
  154.                     ip += 1
  155.         else:
  156.             continue
  157.  
  158.  
  159. ''' Main loop '''
  160. ap = argparse.ArgumentParser()
  161. ap.add_argument("-t", "--town", required=True, help="name of town")
  162. ap.add_argument("-i", "--iter", required=True, help="nb. of iteration [0=24*1 profiles, 1=24*2 profiles, etc]")
  163. ap.add_argument("-a", "--age", required=False, help="Age (ex:30, or 30-35")
  164. args = vars(ap.parse_args())
  165. town = args["town"]
  166. iteration = int(args["iter"])
  167. if age:
  168.     age = args["age"].split("-")
  169.     if len(age) == 1:
  170.         age.append(age[0])
  171.  
  172. print("====== AUM bot =======")
  173.  
  174. '''Load DB '''
  175. if os.path.isfile("./aum-data.json"):
  176.     with open('./aum-data.json') as fd:
  177.         contacts = json.load(fd)
  178.         print("\n" + str(len(contacts['people'])) + " profiles loaded from DB...")
  179. else:
  180.     contacts = {}
  181.     contacts['people'] = []
  182.  
  183. try: user
  184. except NameError: user = input("Login > ")
  185. try:pwd
  186. except NameError: pwd = getpass.getpass("Password (no echo) > ")
  187. payload = { 'username': user, 'password': pwd, 'remember': 'on'}
  188.  
  189. ''' prepare to connect, and set a random USerAgent '''
  190. session = requests.Session()
  191. session.headers.update({'User-Agent': setUserAgent()})
  192. ''' Authentication: get session cookie '''
  193. response=session.post(url_base+url_auth, data=payload, cookies=session.cookies)
  194. pseudo = BeautifulSoup(session.get(url_base+url_myprofil, cookies=session.cookies).text, "html.parser").find("div", attrs={"class" : "username _cb-pseudo"}).text
  195. print('Hi \"' + pseudo + '\"')
  196. print("Seeking for online girls near", town)
  197.  
  198. loop = 0
  199. count = 24
  200. vp=0 #Total nb of visited profiles
  201. ip=0 #Total nb of ignored profiles
  202.  
  203. while loop < iteration:
  204.     url=url_base + url_search + "/more?q=en%20ligne%20" + town + "&offset=" + str(loop*count) + "&count=" + str(count) + "&last_seen=0"
  205.     visitProfiles(getDatas(session, town, url), contacts)
  206.     loop += 1
  207. print("\nEnd : ", vp, " Visited profiles / ", ip, "Ignored profiles")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement