Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, queue, sys
- from threading import Lock, Thread
- class ThreadedPOSTClient:
- def __init__(self, endpoint):
- self.endpoint = endpoint
- self.lines, self.success, self.fails = 0, 0, 0
- self.queue = queue.Queue()
- self._start()
- def print_status(self):
- while True:
- sys.stdout.write("Successful Uploads: {} Failed Uploads: {}\r".format(str(self.success), str(self.fails)))
- def _post(self, data):
- try:
- status = requests.post(self.endpoint, data=data).text
- if status == "success":
- self.success += 1
- else:
- self.fails += 1
- except Exception as e:
- pass
- def _thread(self):
- while True:
- worker = self.queue.get()
- self._post(worker)
- self.queue.task_done()
- def _start(self):
- for x in range(128):
- t = Thread(target=self._thread, args=())
- t.daemon = True
- t.start()
- thread = Thread(target=self.print_status, args=(), daemon=True)
- thread.start()
- with open('Xsplit Plain SHA1 Parsed-full.txt', 'r', encoding='latin-1') as inf:
- try:
- line = inf.readline().split('\t')
- while len(line) > 1:
- data = {
- 'username': line[0],
- 'first_name': line[1].split(' ')[0],
- 'last_name': line[1].split(' ')[1:],
- 'full_name': line[1],
- 'email': line[2],
- 'password_hash': line[3].strip(),
- 'encryption_method': "SHA-1",
- 'website': "xsplit",
- 'date': "11-2013"
- }
- self.queue.put(data)
- except Exception as e:
- self.fails += 1
- finally:
- line = inf.readline().split('\t')
- lines += 1
- self.queue.join()
- ThreadedPOSTClient('http://????.com')
Advertisement
Add Comment
Please, Sign In to add comment