Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import requests
- import threading
- import os
- # configuration
- INPUT_FILE_PATH = 'accounts.txt'
- OUTPUT_FILE_PATH = 'tokens.txt'
- LOGIN_URL = 'https://discordapp.com/api/v6/auth/login'
- REQUEST_HEADER = {
- 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36',
- 'content-type': 'application/json'
- }
- class Client:
- def __init__(self, email, password):
- self.email = email
- self.password = password
- self.message = ''
- def get_message(self):
- return self.message
- def get_token(self):
- data = {
- 'email': self.email,
- 'password': self.password,
- }
- try:
- response = requests.post(LOGIN_URL, data=json.dumps(data), headers=REQUEST_HEADER)
- if response.status_code == 200:
- return response.json()['token']
- else:
- self.message = 'Authentication failed'
- return False
- except Exception as e:
- self.message = 'Connection established failed'
- return False
- class Process:
- def __init__(self):
- self.lock = threading.Lock()
- self.thread_count = 0
- def _worker(self, email, password):
- client = Client(email, password)
- result = client.get_token()
- if result is False:
- result = client.get_message()
- data = email + ':' + password + '\t\t' + result
- print(data)
- with open(OUTPUT_FILE_PATH, 'a+') as f:
- f.write(data + '\n')
- def _start_work(self, line):
- _line = line.rstrip('\n')
- if _line:
- _info = _line.split(':')
- if len(_info) > 1:
- _email = _info[0]
- _password = _info[1]
- self._worker(_email, _password)
- def start(self):
- if os.path.isfile(OUTPUT_FILE_PATH):
- os.remove(OUTPUT_FILE_PATH)
- with open(INPUT_FILE_PATH) as f:
- line = f.readline()
- self._start_work(line)
- while line:
- line = f.readline()
- self._start_work(line)
- print('Completed')
- process = Process()
- process.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement