From 9e2e0ed921945c913b80379bdb967155dc44d8f4 Mon Sep 17 00:00:00 2001 From: architect-bot Date: Mon, 17 Aug 2026 20:09:27 +0000 Subject: [PATCH] Recovered orphaned WIP before switching to a new task --- sandbox_probe/probe.gd | 78 ++++++++++++++++++++++++++++++++++++ sandbox_probe/test_script.gd | 4 ++ 2 files changed, 82 insertions(+) create mode 100644 sandbox_probe/probe.gd create mode 100644 sandbox_probe/test_script.gd diff --git a/sandbox_probe/probe.gd b/sandbox_probe/probe.gd new file mode 100644 index 0000000..9dddc42 --- /dev/null +++ b/sandbox_probe/probe.gd @@ -0,0 +1,78 @@ +extends SceneTree + +func _init(): + print("=== SANDBOX PROBE START ===") + probe_script_loading() + probe_os_apis() + probe_file_access() + probe_network() + probe_engine_apis() + print("=== SANDBOX PROBE END ===") + quit() + +func probe_script_loading(): + print("--- Script loading ---") + # Can we load a GDScript from a string at runtime? + var gd = GDScript.new() + gd.source_code = "extends RefCounted\nfunc hello():\n\treturn 42\n" + var err = gd.reload() + print("GDScript.reload() from source_code err=", err) + if err == OK: + var inst = gd.new() + print(" instantiated, hello()=", inst.call("hello")) + # Can we load a script resource from a path? + var res = load("res://test_script.gd") + print("load('res://test_script.gd') = ", res) + +func probe_os_apis(): + print("--- OS APIs ---") + # Can we execute shell commands? + var out = [] + var exit_code = OS.execute("echo", ["hello"], out) + print("OS.execute('echo') exit=", exit_code, " out=", out) + # Environment access + print("OS.get_environment('HOME') = ", OS.get_environment("HOME")) + # Process spawning + print("OS.create_process available: ", OS.has_method("create_process")) + +func probe_file_access(): + print("--- File access ---") + # Can we read arbitrary files? + var f = FileAccess.open("/etc/hostname", FileAccess.READ) + print("FileAccess.open('/etc/hostname') = ", f) + if f: + print(" content: ", f.get_as_text()) + f.close() + # Can we write outside the project? + var w = FileAccess.open("/tmp/godot_probe_write.txt", FileAccess.WRITE) + print("FileAccess.open('/tmp/...', WRITE) = ", w) + if w: + w.store_string("probe") + w.close() + print(" wrote to /tmp OK") + +func probe_network(): + print("--- Network ---") + # Can we open raw sockets? + var tcp = TCPServer.new() + var bind_err = tcp.listen(0) + print("TCPServer.listen(0) err=", bind_err) + # HTTP client + var http = HTTPClient.new() + print("HTTPClient instantiated: ", http != null) + +func probe_engine_apis(): + print("--- Engine APIs ---") + # Can we access the scene tree / add nodes? + var node = Node.new() + print("Node.new() = ", node) + # Can we access ProjectSettings? + print("ProjectSettings.get_setting('application/config/name') = ", ProjectSettings.get_setting("application/config/name")) + # Can we access the OS shell / clipboard? + print("OS.get_clipboard() = ", OS.get_clipboard()) + # Can we access the filesystem directory listing? + var dir = DirAccess.open("/") + print("DirAccess.open('/') = ", dir) + if dir: + var names = dir.get_files() + print(" root files count: ", names.size()) diff --git a/sandbox_probe/test_script.gd b/sandbox_probe/test_script.gd new file mode 100644 index 0000000..47cd98a --- /dev/null +++ b/sandbox_probe/test_script.gd @@ -0,0 +1,4 @@ +extends RefCounted + +func hello(): + return "from test_script.gd"