-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.py
More file actions
46 lines (35 loc) · 1.17 KB
/
utils.py
File metadata and controls
46 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import base64
from datetime import datetime,timezone
import hashlib
import json
import random
def log(text):
print(f"[{datetime.now().strftime('%m-%d-%Y %H:%M:%S')}] - [{text}]")
def nonblank_lines():
with open("proxies.txt") as f:
stripped_lines = [line.strip() for line in f]
return [line for line in stripped_lines if line]
def load_proxies_from_file(shuffle=True):
proxies = nonblank_lines()
if shuffle:
random.shuffle(proxies)
result = []
for proxy in proxies:
proxyTokens = proxy.split(':')
proxyStr = ":".join(proxyTokens[0:2])
if len(proxyTokens) == 4:
proxyStr = ":".join(proxyTokens[2:]) + "@" + proxyStr
result.append(proxyStr)
return result
def load_accounts(file_path):
accounts = []
try:
with open(file_path, 'r') as file:
for line in file:
line = line.strip()
if line and ':' in line:
username, password = line.split(':', 1)
accounts.append((username.strip(), password.strip()))
except FileNotFoundError:
print(f"File not found: {file_path}")
return accounts