diff --git a/.gitignore b/.gitignore index 4c49bd7..85118b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .env +*.pyc diff --git a/ktvmanager/lib/__pycache__/get_urls.cpython-38.pyc b/ktvmanager/lib/__pycache__/get_urls.cpython-38.pyc new file mode 100644 index 0000000..2d67638 Binary files /dev/null and b/ktvmanager/lib/__pycache__/get_urls.cpython-38.pyc differ diff --git a/ktvmanager/lib/checks.py b/ktvmanager/lib/checks.py new file mode 100644 index 0000000..0e5fbac --- /dev/null +++ b/ktvmanager/lib/checks.py @@ -0,0 +1,41 @@ +import requests +import concurrent.futures +import time +from requests_tor import RequestsTor +import os +from dotenv import load_dotenv +from ktvmanager.lib.get_urls import generate_urls_for_user +import json +load_dotenv() + +rt = RequestsTor(tor_ports=(9001, 9002, 9003, 9004, 9005), tor_cport=9051, password=os.getenv('TORSPWD'), autochange_id=3) + +def get_status(url): + try: + resp = rt.get(url=url, timeout=2) + if resp.status_code == 200: + if "" not in resp.text: + response_data = json.loads(resp.text) + if response_data['user_info']['auth'] == 1: + return response_data + except: + pass + +def find_url_for_user_details(username, password): + urls = generate_urls_for_user(username, password) + tm1 = time.perf_counter() + with concurrent.futures.ThreadPoolExecutor() as executor: + futures = [] + for url in urls: + futures.append(executor.submit(get_status, url=url)) + for future in concurrent.futures.as_completed(futures): + if future._result != None: + executor.shutdown(wait=False) + print(f"{future._result['user_info']['username']} - {future._result['server_info']['url']}:{future._result['server_info']['port']}") + tm2 = time.perf_counter() + print(f'Total time elapsed: {tm2-tm1:0.2f} seconds') + +find_url_for_user_details('Karl061122', 'gkuEDWzxHD') +find_url_for_user_details('Karl130623', 'emYZWPs') +find_url_for_user_details('Karlos2306', 'Gg58Wg8MB9') +find_url_for_user_details('Maxine2306', 'EszFDNNcb2') \ No newline at end of file diff --git a/ktvmanager/lib/extra_urls.txt b/ktvmanager/lib/extra_urls.txt new file mode 100644 index 0000000..1e6c46c --- /dev/null +++ b/ktvmanager/lib/extra_urls.txt @@ -0,0 +1 @@ +http://sarahgraphite.awardvpn.xyz \ No newline at end of file diff --git a/ktvmanager/lib/get_urls.py b/ktvmanager/lib/get_urls.py index 725c7dc..96d27db 100644 --- a/ktvmanager/lib/get_urls.py +++ b/ktvmanager/lib/get_urls.py @@ -3,34 +3,45 @@ from dotenv import load_dotenv import requests import json from requests_tor import RequestsTor - - load_dotenv() - torpass = os.getenv('TORSPWD') - -rt = RequestsTor(tor_ports=(9001, 9002, 9003, 9004, 9005), tor_cport=9051, password=torpass, autochange_id=1) -# check your ip -rt.check_ip() - -url = 'https://httpbin.org/anything' -r = rt.get(url) -print(r.text) +rt = RequestsTor(tor_ports=(9001, 9002, 9003, 9004, 9005), tor_cport=9051, password=torpass, autochange_id=5) -with open('./ktvmanager/lib/DNS_list.txt') as f: - lines = [line.rstrip('\n') for line in f] -print(lines) +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) -hard_url = '/player_api.php?password=gkuEDWzxHD&username=Karl061122&action=user&sub=info' + complete_list_of_urls = [] -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: + 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: complete_list_of_urls.append(url) -complete_list_of_urls = list(set(complete_list_of_urls)) -print(complete_list_of_urls) \ No newline at end of file + 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)