acc khoa: nhan dien Arkose 'press&hold' CAPTCHA + best-effort hold; bao ro KHOA/CAPTCHA/XOA
Browse files- outlook_tool.py +50 -1
outlook_tool.py
CHANGED
|
@@ -519,6 +519,41 @@ def _fill_new_password(page, pw):
|
|
| 519 |
return done
|
| 520 |
|
| 521 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 522 |
def advance_to_inbox(page, ctx, cfg, max_steps=22, deadline=None):
|
| 523 |
"""Vong lap trang thai: tu nhan dien tung man Microsoft va xu ly den khi vao INBOX.
|
| 524 |
Xu ly: trang gioi thieu(Sign in) / nhap email / Verify your email(Send code) / nhap code /
|
|
@@ -567,7 +602,21 @@ def advance_to_inbox(page, ctx, cfg, max_steps=22, deadline=None):
|
|
| 567 |
or "account has been locked" in txt or "goes against the microsoft services" in txt
|
| 568 |
or "detected activity that goes against" in txt or "account has been suspended" in txt
|
| 569 |
or "tài khoản của bạn đã bị khóa" in txt or "đã bị khóa" in txt):
|
| 570 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 571 |
cfg["_no_retry"] = True
|
| 572 |
print(" (!) " + cfg["_fail_reason"]); return False
|
| 573 |
|
|
|
|
| 519 |
return done
|
| 520 |
|
| 521 |
|
| 522 |
+
def _press_and_hold(page, secs=6.5):
|
| 523 |
+
"""Thu vuot challenge 'press and hold' (Arkose) khi acc bi khoa: tim nut (page + iframe),
|
| 524 |
+
giu chuot ~secs voi vai cu dong nho cho giong nguoi. Tra True neu tim + giu duoc nut."""
|
| 525 |
+
bb = None; pg = page
|
| 526 |
+
frames = [page.main_frame] + [f for f in page.frames if f != page.main_frame]
|
| 527 |
+
for fr in frames:
|
| 528 |
+
for sel in ["#px-captcha", "button:has-text('Press')", "div:has-text('Press and hold')",
|
| 529 |
+
"[id*=captcha i]", "[class*=hold i]", "[aria-label*=hold i]",
|
| 530 |
+
"[role=button]", "button"]:
|
| 531 |
+
try:
|
| 532 |
+
loc = fr.locator(sel).first
|
| 533 |
+
if loc.count() > 0 and loc.is_visible():
|
| 534 |
+
b = loc.bounding_box()
|
| 535 |
+
if b and b["width"] > 20 and b["height"] > 10:
|
| 536 |
+
bb = b; break
|
| 537 |
+
except Exception:
|
| 538 |
+
pass
|
| 539 |
+
if bb: break
|
| 540 |
+
if not bb:
|
| 541 |
+
return False
|
| 542 |
+
x = bb["x"] + bb["width"] / 2; y = bb["y"] + bb["height"] / 2
|
| 543 |
+
try:
|
| 544 |
+
page.mouse.move(x - 4, y - 2); page.wait_for_timeout(120)
|
| 545 |
+
page.mouse.move(x, y); page.wait_for_timeout(120)
|
| 546 |
+
page.mouse.down()
|
| 547 |
+
# giu + rung nhe (giong nguoi) trong ~secs
|
| 548 |
+
t = 0
|
| 549 |
+
while t < secs * 1000:
|
| 550 |
+
page.mouse.move(x + (1 if (t // 300) % 2 else -1), y); page.wait_for_timeout(150); t += 150
|
| 551 |
+
page.mouse.up()
|
| 552 |
+
return True
|
| 553 |
+
except Exception:
|
| 554 |
+
return False
|
| 555 |
+
|
| 556 |
+
|
| 557 |
def advance_to_inbox(page, ctx, cfg, max_steps=22, deadline=None):
|
| 558 |
"""Vong lap trang thai: tu nhan dien tung man Microsoft va xu ly den khi vao INBOX.
|
| 559 |
Xu ly: trang gioi thieu(Sign in) / nhap email / Verify your email(Send code) / nhap code /
|
|
|
|
| 602 |
or "account has been locked" in txt or "goes against the microsoft services" in txt
|
| 603 |
or "detected activity that goes against" in txt or "account has been suspended" in txt
|
| 604 |
or "tài khoản của bạn đã bị khóa" in txt or "đã bị khóa" in txt):
|
| 605 |
+
# 1) MAN CHALLENGE that su "press and hold the button" (Arkose) -> thu giu nut (best-effort)
|
| 606 |
+
if ("press and hold" in txt or "hold the button" in txt or "press & hold" in txt):
|
| 607 |
+
cfg["_hold_tries"] = cfg.get("_hold_tries", 0) + 1
|
| 608 |
+
if cfg["_hold_tries"] <= 2:
|
| 609 |
+
ok = _press_and_hold(page)
|
| 610 |
+
print(" [step] challenge press&hold lan %d (%s)" % (cfg["_hold_tries"], "giu nut" if ok else "khong thay nut"))
|
| 611 |
+
page.wait_for_timeout(5000); continue
|
| 612 |
+
cfg["_fail_reason"] = "ACC KHÓA: CAPTCHA 'press & hold' (Arkose) — bot khong qua duoc, can MO KHOA TAY."
|
| 613 |
+
cfg["_no_retry"] = True; print(" (!) " + cfg["_fail_reason"]); return False
|
| 614 |
+
# 2) MAN locked ban dau ("show you're human in the next step" + nut Next) -> bam Next toi challenge
|
| 615 |
+
if cfg.get("_unlock_tries", 0) < 2 and click_text_button(page,
|
| 616 |
+
["Next", "Continue", "Tiep theo", "Tiep tuc"], extra_sels=["#idSIButton9", "input[type=submit]"]):
|
| 617 |
+
cfg["_unlock_tries"] = cfg.get("_unlock_tries", 0) + 1
|
| 618 |
+
print(" [step] acc locked -> Next (toi buoc xac minh human)"); page.wait_for_timeout(3000); continue
|
| 619 |
+
cfg["_fail_reason"] = "ACC BỊ KHÓA (Microsoft locked/abuse) -> bo acc (co the dinh CAPTCHA)."
|
| 620 |
cfg["_no_retry"] = True
|
| 621 |
print(" (!) " + cfg["_fail_reason"]); return False
|
| 622 |
|