2023-09-14 12:16:18 +01:00
|
|
|
import os
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
import requests
|
|
|
|
import json
|
|
|
|
from requests_tor import RequestsTor
|
|
|
|
load_dotenv()
|
|
|
|
torpass = os.getenv('TORSPWD')
|
2023-09-14 14:40:16 +01:00
|
|
|
rt = RequestsTor(tor_ports=(9001, 9002, 9003, 9004, 9005), tor_cport=9051, password=torpass, autochange_id=5)
|
|
|
|
|
|
|
|
|
|
|
|
def get_latest_urls_from_dns():
|
|
|
|
with open('./ktvmanager/lib/DNS_list.txt') as f:
|
|
|
|
lines = [line.rstrip('\n') for line in f]
|
|
|
|
with open('./ktvmanager/lib/extra_urls.txt') as urls:
|
|
|
|
extra_urls = [line.rstrip('\n') for line in urls]
|
|
|
|
# print(lines)
|
|
|
|
|
|
|
|
complete_list_of_urls = []
|
|
|
|
|
|
|
|
for url in lines:
|
|
|
|
data = requests.get(url)
|
|
|
|
content = json.loads(data.text)
|
|
|
|
list_of_urls = content['su'].split(',')
|
|
|
|
for url in list_of_urls:
|
|
|
|
complete_list_of_urls.append(url)
|
|
|
|
complete_list_of_urls = list(set(complete_list_of_urls))
|
|
|
|
# print(complete_list_of_urls)
|
|
|
|
for url in extra_urls:
|
2023-09-14 12:16:18 +01:00
|
|
|
complete_list_of_urls.append(url)
|
2023-09-14 14:40:16 +01:00
|
|
|
return complete_list_of_urls
|
|
|
|
|
|
|
|
def generate_urls_for_user(username, password):
|
|
|
|
new_urls = []
|
|
|
|
for url in get_latest_urls_from_dns():
|
|
|
|
hard_url = f'/player_api.php?password={password}&username={username}&action=user&sub=info'
|
|
|
|
new_url = url + hard_url
|
|
|
|
new_urls.append(new_url)
|
|
|
|
return new_urls
|
|
|
|
|
|
|
|
|
|
|
|
def check_for_url_from_details(username, password):
|
|
|
|
new_urls = []
|
|
|
|
for url in get_latest_urls_from_dns():
|
|
|
|
hard_url = f'/player_api.php?password={password}&username={username}&action=user&sub=info'
|
|
|
|
new_url = url + hard_url
|
|
|
|
new_urls.append(new_url)
|
|
|
|
print(new_urls)
|