Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
1,080
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. def login():
  2.            
  3.     username = "username"
  4.     API_KEY = 'API KEY'  
  5.     site_key = '6Ld1KwITAAAAAB1taFKufv4_Tu5x_TEblkzWNDt8'
  6.     url = 'http://legacy.hackerexperience.com/'  
  7.     s.get(url)
  8.     url = 'http://legacy.hackerexperience.com/'
  9.     captcha_id = s.post("http://2captcha.com/in.php?key={}&method=userrecaptcha&googlekey={}&pageurl={}".format(API_KEY, site_key, url)).text.split('|')[1]
  10.     print(captcha_id)
  11.     if(captcha_id == 'ERROR_ZERO_BALANCE'):
  12.        print("No balance")
  13.     recaptcha_answer = s.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
  14.     start = time.time()
  15.     print("Solving Captcha...")
  16.     while 'CAPCHA_NOT_READY' in recaptcha_answer:
  17.         time.sleep(5)
  18.         recaptcha_answer = s.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id)).text
  19.     if(recaptcha_answer == 'ERROR_CAPTCHA_UNSOLVABLE'):
  20.         print("Captcha failed")
  21.     else:
  22.         end = time.time()
  23.         print("Time Elapsed: ",end - start)
  24.         recaptcha_answer = recaptcha_answer.split('|')[1]
  25.         password = 'password'
  26.         payload = {
  27.             'action':'login',
  28.             'username':username,
  29.             'password':password,
  30.             'g-recaptcha-response':recaptcha_answer,
  31.             'terms':1
  32.         }
  33.         url = 'https://legacy.hackerexperience.com/login'
  34.         test = s.post(url,payload)
  35.         return test
  36.  
  37. login()
  38. page = s.get('https://legacy.hackerexperience.com/software')
  39. test = page.text
  40. print(test)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement