Advertisement
Guest User

Untitled

a guest
Apr 4th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.90 KB | None | 0 0
  1. import requests
  2. import time
  3. import re
  4. from bs4 import BeautifulSoup
  5. import random
  6. from random import choice
  7. from string import ascii_uppercase
  8. import string
  9. import time
  10. import secret
  11. global s
  12. global GID
  13. GID = ''
  14. s = requests.Session()
  15. s.headers.update({"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefaox/52.0"})
  16.  
  17.  
  18. def login():    
  19.     username = "HungryEmu"
  20.     password = secret.password()
  21.     API_KEY = secret.apikey()  
  22.     site_key = '6Ld1KwITAAAAAB1taFKufv4_Tu5x_TEblkzWNDt8'
  23.     url = 'http://legacy.hackerexperience.com/'  
  24.     s.get(url)
  25.     url = 'http://legacy.hackerexperience.com/'
  26.     captcha_id = s.post("http://2captcha.com/in.php?key={}&method=userrecaptcha&googlekey={}&pageurl={}".format(API_KEY, site_key, url)).text.split('|')[1]
  27.     if(captcha_id == 'ERROR_ZERO_BALANCE'):
  28.        print("No balance")
  29.     recaptcha_answer = s.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
  30.     start = time.time()
  31.     print("Solving Captcha...")
  32.     while 'CAPCHA_NOT_READY' in recaptcha_answer:
  33.         time.sleep(5)
  34.         recaptcha_answer = s.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
  35.     if(recaptcha_answer == 'ERROR_CAPTCHA_UNSOLVABLE'):
  36.         print("Captcha failed")
  37.     else:
  38.         end = time.time()
  39.         print("Time Elapsed: ",end - start)
  40.         recaptcha_answer = recaptcha_answer.split('|')[1]
  41.         payload = {
  42.             'action':'login',
  43.             'username':username,
  44.             'password':password,
  45.             'g-recaptcha-response':recaptcha_answer,
  46.             'terms':1
  47.         }
  48.         url = 'https://legacy.hackerexperience.com/login'
  49.         test = s.post(url,payload)
  50.         return test
  51.  
  52. def findID():
  53.     valueRegex = 'value=\"[0-9]+\"'
  54.     idRegex = "[0-9]+"
  55.     url = "https://legacy.hackerexperience.com/university"
  56.     result = s.get(url).text
  57.     if "Hacker Experience is a browser-based hacking simulation game" not in result:
  58.         p = re.findall(valueRegex, result)
  59.         for match in p:
  60.             ids = re.findall(idRegex, match)
  61.             return ids[0]
  62.     else:
  63.         print ("Error: Account not logged in")
  64.  
  65. def findPID():
  66.     valueRegex = 'complete[0-9]+'
  67.     idRegex = "[0-9]+"
  68.     url = "https://legacy.hackerexperience.com/processes"
  69.     result = s.get(url).text
  70.     if "Hacker Experience is a browser-based hacking simulation game" not in result:
  71.         p = re.findall(valueRegex, result)
  72.         for match in p:
  73.             ids = re.findall(idRegex, match)
  74.             return ids[0]
  75.     else:
  76.         print ("Error: Account not logged in")
  77.  
  78. def startResearch(softID):
  79.     API_KEY = secret.apikey()
  80.     site_key = '6LfCtBETAAAAAEJNqkKIAfLbH4mNx38wxGJV_ZUK'
  81.     url = "https://legacy.hackerexperience.com/university?id=" + str(softID)
  82.     get = requests.get(url).text
  83.     captcha_id = s.post("http://2captcha.com/in.php?key={}&method=userrecaptcha&googlekey={}&pageurl={}".format(API_KEY, site_key, url)).text.split('|')[1]
  84.     recaptcha_answer = s.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
  85.     print ("Solving Captcha..")
  86.     while 'CAPCHA_NOT_READY' in recaptcha_answer:
  87.         time.sleep(5)
  88.         recaptcha_answer = s.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
  89.     recaptcha_answer = recaptcha_answer.split('|')[1]
  90.     postData = {
  91.         'id': softID,
  92.         'act': 'research',
  93.         'name': 'DELETED',
  94.         'delete': '1',
  95.         'acc': '964796715008',
  96.         'g-recaptcha-response': recaptcha_answer
  97.     }
  98.     post = s.post(url, data=postData)
  99.     print("Research Started @ "+str(softID))
  100.     return post
  101.  
  102. def finishResearch(PID):
  103.     url = ('https://legacy.hackerexperience.com/processes')
  104.     req = s.get(url)
  105.     proc = req.text
  106.     params = {
  107.     ('pid', PID),
  108.     }
  109.     post = s.post('https://legacy.hackerexperience.com/processes', params=params)
  110.     if "Task manager - Hacker Experience" in proc:
  111.         if "Research file" in proc:
  112.             time.sleep(30)
  113.             ID = findID()
  114.             PID = findPID()
  115.             finishResearch(PID)
  116.         else:
  117.             print("Proccess Completed")
  118.             return post
  119.  
  120. def research():
  121.     url = ('https://legacy.hackerexperience.com/processes')
  122.     req = s.get(url)
  123.     proc = req.text
  124.     if "Hacker Experience is a browser-based hacking simulation" in proc:
  125.         login()
  126.         print("Logging into account...")
  127.     elif "Task manager - Hacker Experience" in proc:
  128.         print("Researching SSH...")
  129.         PID = findPID()
  130.         finishResearch(PID)
  131.         time.sleep(2)
  132.         ID = findID()
  133.         startResearch(ID)
  134.     else:
  135.         print("Possible 502... Restarting")
  136.         time.sleep(5)
  137.         research()
  138.  
  139.  
  140. while True:
  141.     try:
  142.         research()
  143.     except:
  144.         research()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement