diff --git a/Data/Agent/borealis-agent.py b/Data/Agent/borealis-agent.py index a09d29d..acaaa5d 100644 --- a/Data/Agent/borealis-agent.py +++ b/Data/Agent/borealis-agent.py @@ -39,14 +39,14 @@ def connect(): @sio.event def disconnect(): - print("[WS DISCONNECTED] Lost connection to Borealis server.") + print("[WebSocket] Lost connection to Borealis server.") @sio.on('agent_config') def on_agent_config(config): global current_interval, overlay_visible, LAST_CONFIG if config != LAST_CONFIG: - print("[PROVISIONING] Received new configuration from Borealis.") + print("[PROVISIONED] Received new configuration from Borealis.") x = config.get("x", 100) y = config.get("y", 100) w = config.get("w", 300) diff --git a/Data/server.py b/Data/server.py index f48822a..e62adaa 100644 --- a/Data/server.py +++ b/Data/server.py @@ -62,33 +62,120 @@ def provision_agent(): return jsonify({"status": "provisioned"}) -# --------------------------------------------- -# Raw Image Feed Viewer for Screenshot Agents -# --------------------------------------------- +# ---------------------------------------------- +# Canvas Image Feed Viewer for Screenshot Agents +# ---------------------------------------------- @app.route("/api/agent//screenshot") def screenshot_viewer(agent_id): if agent_configurations.get(agent_id, {}).get("task") != "screenshot": return "

Agent not provisioned as Screenshot Collector

", 400 - html = f""" + return f""" + - Borealis - {agent_id} Screenshot - + Borealis Live View - {agent_id} + - - + + + + + """ - return html -@app.route("/api/agent//screenshot/raw") + + +@app.route("/api/agent//screenshot/raw") # Fallback Non-Live Screenshot Preview Code for Legacy Purposes def screenshot_raw(agent_id): entry = latest_images.get(agent_id) if not entry: @@ -132,7 +219,6 @@ def receive_screenshot(data): "image_base64": image, "timestamp": time.time() } - print(f"[DEBUG] Screenshot received from agent {agent_id}") emit("new_screenshot", {"agent_id": agent_id, "image_base64": image}, broadcast=True) @socketio.on('disconnect') @@ -143,4 +229,7 @@ def on_disconnect(): # Server Start # --------------------------------------------- if __name__ == "__main__": + import eventlet + import eventlet.wsgi socketio.run(app, host="0.0.0.0", port=5000, debug=False) +