Advertisement
Guest User

Untitled

a guest
Apr 6th, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.67 KB | None | 0 0
  1. import requests
  2. import re
  3. import time
  4.  
  5. class User:
  6.     def __init__(self):
  7.         self.sess = requests.Session()
  8.         self.sess.headers.update({"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefaox/52.0"})
  9.  
  10.     def login(self):
  11.         API_KEY = key.api #input ("KEY >>") #'KEY'
  12.         password = password #input("Password >>")
  13.         site_key = key.login
  14.         self.sess.get('http://legacy.hackerexperience.com/')
  15.         captcha_id = s.post("http://2captcha.com/in.php?key={}&method=userrecaptcha&googlekey={}&pageurl={}".format(API_KEY, site_key, url)).text.split('|')[1]
  16.         if(captcha_id == 'ERROR_ZERO_BALANCE'):
  17.             print("No balance")
  18.         recaptcha_answer = sess.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
  19.         start = time.time()
  20.         print("Solving Captcha...")
  21.         while 'CAPCHA_NOT_READY' in recaptcha_answer:
  22.             time.sleep(5)
  23.             recaptcha_answer = slef.sess.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
  24.         if(recaptcha_answer == 'ERROR_CAPTCHA_UNSOLVABLE'):
  25.             print("Captcha failed")
  26.         else:
  27.             end = time.time()
  28.             print("Time Elapsed: ",end - start)
  29.             recaptcha_answer = recaptcha_answer.split('|')[1]
  30.             payload = {
  31.                 'action':'login',
  32.                 'username':username,
  33.                 'password':password,
  34.                 'g-recaptcha-response':recaptcha_answer,
  35.                 'terms':1
  36.             }
  37.             url = 'https://legacy.hackerexperience.com/login'
  38.             complete = sess.post(url,payload)
  39.  
  40.     def crackIP(IP):
  41.         url = "https://legacy.hackerexperience.com/internet?action=hack&method=bf&ip={}".format(IP)
  42.         result = self.sess.get(url)
  43.         return result
  44.  
  45.     def loginIP(IP):
  46.         #print("Attemping to login to {}".format(IP))
  47.         collectCreds = self.sess.get("https://legacy.hackerexperience.com/internet?action=login&ip={}".format(IP)).text
  48.         soup = BeautifulSoup(collectCreds, 'html.parser')
  49.         ip_pass = soup.find('input', {'name': 'pass'}).get('value')
  50.         url = 'https://legacy.hackerexperience.com/internet?action=login&user=root&pass={}'.format(ip_pass)
  51.         self.sess.get(url)
  52.         print("Logging into {} with username 'root' and password {}...\n-------------------------------".format(IP, ip_pass))
  53.  
  54.     def keepLog():
  55.         print("Keeping logs")
  56.         req = self.sess.get('https://legacy.hackerexperience.com/internet?view=logs')
  57.         result = req.text
  58.         parseData = re.findall("(\d+\.\d+\.\d+\.\d+)", result)
  59.         file = "log.txt"
  60.         with open(file, "r+") as f:
  61.             file_content = f.read()
  62.         for ip in parseData:
  63.             if ip not in file_content:
  64.                 print(ip)
  65.                 f = open(file, "w+")
  66.                 now = datetime.datetime.now()
  67.                 f.write(file_content+now.strftime("%Y-%m-%d %H:%M")+" - "+ip+'\n')
  68.                 f.close()
  69.                 print (now.strftime("%Y-%m-%d %H:%M")+" - "+ip)
  70.  
  71.     def clearLog(self):
  72.         print("LogEdit Started...")
  73.         self.sess.get('https://legacy.hackerexperience.com/internet?view=logs'')
  74.        data = { 'id': '0', 'log': '...' }
  75.        self.sess.post('https://legacy.hackerexperience.com/logEdit', data=data)
  76.  
  77.    def findID():
  78.        valueRegex = 'complete[0-9]+'
  79.        idRegex = "[0-9]+"
  80.        url = "https://legacy.hackerexperience.com/processes"
  81.        result = self.sess.get(url).text
  82.        if "Hacker Experience is a browser-based hacking simulation game" not in result:
  83.            p = re.findall(valueRegex, result)
  84.            for match in p:
  85.                ids = re.findall(idRegex, match)
  86.                ID = ids[0]
  87.        else:
  88.            print ("Error: Account not logged in")
  89.  
  90.    def finsihProccess(self, id, sleep):
  91.        valueRegex = 'complete[0-9]+'
  92.        idRegex = "[0-9]+"
  93.        url = "https://legacy.hackerexperience.com/processes"
  94.        result = self.sess.get(url).text
  95.        if "Hacker Experience is a browser-based hacking simulation game" not in result:
  96.            p = re.findall(valueRegex, result)
  97.            for match in p:
  98.                ids = re.findall(idRegex, match)
  99.                ID = ids[0]
  100.                print("Attempting to finish proccess... Waiting {} seconds").format(sleep)
  101.                time.sleep(sleep)
  102.                req = self.sess.get('https://legacy.hackerexperience.com/processes')
  103.                proc = req.text
  104.                params = {
  105.                ('pid', id),
  106.                }
  107.                post = self.sess.get('https://legacy.hackerexperience.com/processes', params=params)
  108.                if id not in post.url:
  109.                    print("Proccess not complete")
  110.                    time.sleep(1)
  111.                    print("Attempting to complete Proccess...")
  112.                    finishProccess(id, 1)
  113.                else:
  114.                    print("Proccess Completed")
  115.                    return post
  116.        else:
  117.            print ("Error: Account not logged in")
  118.  
  119.  
  120.  
  121.    def logout(self):
  122.        self.sess.post("https://legacy.hackerexperience.com/internet?view=logout")
  123.  
  124. class Genie(User):
  125.    """docstring for Genie"""
  126.    username = "LandGenie"
  127.    password = "Dzd"
  128.    ip = "213.163.125.107"
  129.    bank = "985924847091"
  130.    btc = "1fVXCUQCcm33WWlNvzxMfiiX63KRWAAvPw"
  131.    sess = requests.Session()
  132.  
  133.    def login(self):
  134.       #self.s.post(<stuff to HE>)
  135.       raise NotImplementedError("Not Implemented Yet!")
  136.  
  137. class Snow(User):
  138.    """docstring for Snow"""
  139.    username = "GreenSnowman"
  140.    password = 'DzD'
  141.    ip = '170.240.11.29'
  142.    bank = '991374651146'
  143.    btc = '1uLPXB0QFAW0EFoIQNvwRPYrOUdHs9zEDk'
  144.    sess = requests.Session()
  145.  
  146.    def login(self):
  147.        #self.s.post(<stuff to HE>)
  148.        raise NotImplementedError("Not Implemented Yet!")
  149.  
  150. def login(user, password, sess):
  151.    sess.headers.update({"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefaox/52.0"})
  152.    username = user #input("Username >>") #"Username"
  153.    API_KEY = key.api #input ("KEY >>") #'KEY'
  154.    password = password #input("Password >>")
  155.    site_key = key.login
  156.    url = 'http://legacy.hackerexperience.com/'
  157.    sess.get(url)
  158.    url = 'http://legacy.hackerexperience.com/'
  159.    captcha_id = s.post("http://2captcha.com/in.php?key={}&method=userrecaptcha&googlekey={}&pageurl={}".format(API_KEY, site_key, url)).text.split('|')[1]
  160.    if(captcha_id == 'ERROR_ZERO_BALANCE'):
  161.  
  162.        print("No balance")
  163.    recaptcha_answer = sess.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
  164.    start = time.time()
  165.    print("Solving Captcha...")
  166.    while 'CAPCHA_NOT_READY' in recaptcha_answer:
  167.        time.sleep(5)
  168.        recaptcha_answer = sess.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
  169.    if(recaptcha_answer == 'ERROR_CAPTCHA_UNSOLVABLE'):
  170.        print("Captcha failed")
  171.    else:
  172.        end = time.time()
  173.        print("Time Elapsed: ",end - start)
  174.        recaptcha_answer = recaptcha_answer.split('|')[1]
  175.        #password = input("Password >>") #'Lemons22'
  176.        payload = {
  177.            'action':'login',
  178.            'username':username,
  179.            'password':password,
  180.            'g-recaptcha-response':recaptcha_answer,
  181.            'terms':1
  182.        }
  183.        url = 'https://legacy.hackerexperience.com/login'
  184.        complete = sess.post(url,payload)
  185.  
  186. print(Snow.username)
  187. print(Genie.username)
  188. #login(User.Genie.username, User.Genie.password, User.Genie.sess)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement