-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstep_021b_debug_chatgpt.py
More file actions
54 lines (48 loc) · 2.31 KB
/
step_021b_debug_chatgpt.py
File metadata and controls
54 lines (48 loc) · 2.31 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
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
import urllib.request, json, sys, time, subprocess
def run():
print("[Step 021b] Debugging ChatGPT Login Screen...")
# Hole den aktuellen Text auf dem Screen
js = "document.body.innerText.substring(0, 500)"
req = urllib.request.Request("http://127.0.0.1:8888", data=json.dumps({"cmd": "eval", "val": js}).encode(), method="POST")
try:
with urllib.request.urlopen(req) as r:
text = json.load(r).get("result", "")
print(f"Befindet sich auf dem Screen:\\n{text}\\n")
except Exception as e:
print(f"FEHLER: {e}"); sys.exit(1)
if "Mit Google fortsetzen" in text or "Continue with Google" in text:
print("WARNUNG: One-Tap hat nicht reagiert! Klicke auf den Haupt-Button 'Mit Google fortsetzen' im DOM...")
js_click = """
(() => {
const btns = document.querySelectorAll('button');
for(const b of btns) {
if((b.innerText||'').toLowerCase().includes('google')) {
b.click(); return 'CLICKED_DOM_BUTTON';
}
}
return 'NOT_FOUND';
})()
"""
req_click = urllib.request.Request("http://127.0.0.1:8888", data=json.dumps({"cmd": "eval", "val": js_click}).encode(), method="POST")
with urllib.request.urlopen(req_click) as r:
print(f"RESULTAT: {json.load(r).get('result')}")
time.sleep(5)
# Wenn der "Account Chooser" aufploppt (weil One-Tap versagt hat), klicken wir den Account hart via DOM
print("Klicke ggf. Account Chooser...")
js_chooser = """
(() => {
const acc = document.querySelector('div[data-identifier]');
if(acc) { acc.click(); return 'CHOSE_ACCOUNT'; }
return 'NO_CHOOSER';
})()
"""
req_chooser = urllib.request.Request("http://127.0.0.1:8888", data=json.dumps({"cmd": "eval", "val": js_chooser}).encode(), method="POST")
with urllib.request.urlopen(req_chooser) as r:
print(f"CHOOSER RESULTAT: {json.load(r).get('result')}")
time.sleep(5)
sys.exit(0)
else:
print("VERIFIZIERT: Sind nicht mehr auf Login-Seite, One-Tap war wohl erfolgreich (nur URL hing hinterher)!")
sys.exit(0)
if __name__ == "__main__": run()