From 37b6e65bf7778c5f457b382cd590dae265df0f7b Mon Sep 17 00:00:00 2001 From: doomedraven Date: Wed, 19 Nov 2025 21:30:56 +0100 Subject: [PATCH 1/2] fix docs --- docs/book/src/installation/host/configuration.rst | 10 ---------- web/templates/analysis/admin/index.html | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/docs/book/src/installation/host/configuration.rst b/docs/book/src/installation/host/configuration.rst index 67fc4c6ec01..a989d931b7f 100644 --- a/docs/book/src/installation/host/configuration.rst +++ b/docs/book/src/installation/host/configuration.rst @@ -53,16 +53,6 @@ want to pay more attention to are: .. _`SQLAlchemy`: http://www.sqlalchemy.org/ .. _`Database Urls`: http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls -.. warning:: Check your interface for resultserver IP! Some virtualization software (for example Virtualbox) - doesn't bring up the virtual networking interfaces until a virtual machine is started. - CAPE needs to have the interface where you bind the resultserver up before the start, so please - check your network setup. If you are not sure about how to get the interface up, a good trick is to manually start - and stop an analysis virtual machine, this will bring virtual networking up. - If you are using NAT/PAT in your network, you can set up the resultserver IP - to 0.0.0.0 to listen on all interfaces, then use the specific options `resultserver_ip` and `resultserver_port` - in *.conf* to specify the address and port as every machine sees them. Note that if you set - resultserver IP to 0.0.0.0 in cuckoo.conf you have to set `resultserver_ip` for all your virtual machines. - .. note:: Default freespace value is 50GB It is worth mentioning that the default ``freespace`` value in ``cuckoo.conf`` is 50000 MB aka 50 GB. diff --git a/web/templates/analysis/admin/index.html b/web/templates/analysis/admin/index.html index bcd88ad2a93..f97790a6666 100644 --- a/web/templates/analysis/admin/index.html +++ b/web/templates/analysis/admin/index.html @@ -26,7 +26,7 @@ {% if analysis.info.user_id %} - Task cretated by user id: {{analysis.info.user_id}} + Task created by user id: {{analysis.info.user_id}} or From b8e0bcad685cdd750a8c54cd86745809ad1c320b Mon Sep 17 00:00:00 2001 From: Josh Feather <142008135+josh-feather@users.noreply.github.com> Date: Wed, 19 Nov 2025 21:17:57 +0000 Subject: [PATCH 2/2] Fix a bug that prevents terminal status from being reported by the agent (#2753) Updates the POST /status endpoint to unset the async subprocess if the new status is terminal. This makes GET /status report the final analysis state, rather than the child process state. --- agent/agent.py | 7 +++++++ agent/test_agent.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/agent/agent.py b/agent/agent.py index 1859e135ded..1b0947e49d7 100644 --- a/agent/agent.py +++ b/agent/agent.py @@ -92,6 +92,8 @@ def _missing_(cls, value): return None +TERMINAL_STATUSES = [Status.COMPLETE, Status.FAILED, Status.EXCEPTION] + AGENT_BROWSER_EXT_PATH = "" AGENT_BROWSER_LOCK = Lock() ANALYZER_FOLDER = "" @@ -494,6 +496,11 @@ def put_status(): except ValueError: return json_error(400, "No valid status has been provided") + # If the new status is terminal, unset the async subprocess so /status reports + # the final analysis state rather than the child process state. + if status in TERMINAL_STATUSES: + state["async_subprocess"] = None + state["status"] = status state["description"] = request.form.get("description") return json_success("Analysis status updated") diff --git a/agent/test_agent.py b/agent/test_agent.py index 02f9499ee9a..bb4272cbe41 100644 --- a/agent/test_agent.py +++ b/agent/test_agent.py @@ -639,6 +639,34 @@ def test_async_failure(self): js = self.confirm_status(str(agent.Status.FAILED)) assert "process_id" not in js + def test_async_manual_status_override(self): + """Test that a manual status update overrides an in-progress async process.""" + # Upload a Python file that sleeps for a short period, to ensure the + # async subprocess is running while we override the status. + file_contents = ( + "import time", + "time.sleep(10)", + ) + + filepath = self.store_file(file_contents) + form = {"filepath": filepath, "async": 1} + + execpy_resp = self.post_form("execpy", form) + assert execpy_resp.get("message") == "Successfully spawned command" + + # While the subprocess is running, the status should initially be RUNNING. + self.confirm_status(str(agent.Status.RUNNING)) + + # Manually override the status to COMPLETE via POST /status. + override_form = { + "status": str(agent.Status.COMPLETE), + "description": "beep boop" + } + status_resp = self.post_form("status", override_form) + assert status_resp.get("message") == "Analysis status updated" + + self.confirm_status(str(agent.Status.COMPLETE)) + def test_execute(self): """Test executing the 'date' command.""" if sys.platform == "win32":