farm/chr/shim refresh + verified economics 04.11.26 (5000 credits, autoreg 2/2)
This commit is contained in:
@@ -16,14 +16,58 @@ from playwright.sync_api import sync_playwright
|
||||
|
||||
import chr
|
||||
|
||||
MPOOL = r"C:\Users\User\Desktop\avtoreg\working_mails.txt"
|
||||
MPOOL = sys.argv[3] if len(sys.argv) > 3 else r"C:\Users\User\Desktop\avtoreg\working_mails.txt"
|
||||
BANK = "camb_bank.jsonl"
|
||||
VPS = os.environ.get("CAMB_VPS", "") # ssh target that can read the mailbox code
|
||||
VPS = "root@144.31.34.147"
|
||||
VPS_LIST = ["root@144.31.34.149", "root@144.31.34.150", "root@144.31.34.147"]
|
||||
|
||||
N = int(sys.argv[1]) if len(sys.argv) > 1 and sys.argv[1].isdigit() else 1
|
||||
START = int(sys.argv[2]) if len(sys.argv) > 2 and sys.argv[2].isdigit() else 30
|
||||
|
||||
|
||||
def local_code(email, password, timeout=90):
|
||||
import imaplib
|
||||
end = time.time() + timeout
|
||||
while time.time() < end:
|
||||
try:
|
||||
m = imaplib.IMAP4_SSL("secureimap.t-online.de", 993, timeout=40)
|
||||
m.login(email, password)
|
||||
m.select("INBOX", readonly=True)
|
||||
d = m.search(None, "ALL")[1][0].split()
|
||||
uids = [int(x) for x in d] if d else []
|
||||
for u in reversed(uids[-40:]):
|
||||
md = m.fetch(str(u), "(RFC822)")[1]
|
||||
if not md or not md[0]:
|
||||
continue
|
||||
msg = email.message_from_bytes(md[0][1])
|
||||
subj = str(msg.get("Subject", ""))
|
||||
frm = str(msg.get("From", ""))
|
||||
if "camb" not in (subj + frm).lower():
|
||||
continue
|
||||
body = ""
|
||||
if msg.is_multipart():
|
||||
for pp in msg.walk():
|
||||
if pp.get_content_type() in ("text/plain", "text/html"):
|
||||
try:
|
||||
body += pp.get_payload(decode=True).decode(pp.get_content_charset() or "utf-8", "ignore")
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
body = msg.get_payload(decode=True).decode("utf-8", "ignore")
|
||||
except Exception:
|
||||
pass
|
||||
mm = re.search(r"code is\s+([A-Za-z0-9]{6})", subj + " " + body)
|
||||
if mm:
|
||||
m.logout()
|
||||
return mm.group(1)
|
||||
m.logout()
|
||||
except Exception:
|
||||
pass
|
||||
time.sleep(8)
|
||||
return None
|
||||
|
||||
|
||||
def gen_pass(n=16):
|
||||
parts = [random.choice(string.ascii_uppercase), random.choice(string.ascii_lowercase),
|
||||
random.choice(string.digits), random.choice("*#!")]
|
||||
@@ -36,18 +80,22 @@ def mail_code(email, password, timeout=150, tag=""):
|
||||
"""fetch 6-char verification code (camb letter: 'code is XXXXXX')."""
|
||||
deadline = time.time() + timeout
|
||||
while time.time() < deadline:
|
||||
try:
|
||||
r = subprocess.run(
|
||||
["ssh", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=15", VPS,
|
||||
"python3", os.environ.get("CAMB_MAIL_READER", "/root/camb_code.py"), email, password],
|
||||
capture_output=True, text=True, timeout=90)
|
||||
out = (r.stdout or "") + (r.stderr or "")
|
||||
m = re.search(r"CCODE\s+([A-Z0-9]{6})\b", out)
|
||||
if m:
|
||||
return m.group(1)
|
||||
except Exception as e:
|
||||
print(f" [{tag}] ssh err", e)
|
||||
time.sleep(10)
|
||||
for host in VPS_LIST:
|
||||
try:
|
||||
r = subprocess.run(
|
||||
["ssh", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=12", host,
|
||||
"python3", "/root/camb_code.py", email, password, "60"],
|
||||
capture_output=True, text=True, timeout=80)
|
||||
out = (r.stdout or "") + (r.stderr or "")
|
||||
m = re.search(r"CCODE\s+([A-Z0-9]{6})\b", out)
|
||||
if m:
|
||||
return m.group(1)
|
||||
except Exception:
|
||||
continue
|
||||
loc = local_code(email, password, timeout=45)
|
||||
if loc:
|
||||
return loc
|
||||
time.sleep(6)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user