From 78df01a5da4623531ea9b0da6b0734fe36b8b994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s?= Date: Tue, 7 Nov 2023 22:08:57 +0200 Subject: [PATCH 1/4] corrected "selected" field assignment in InteractMenu.py --- empire/client/src/menus/InteractMenu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/empire/client/src/menus/InteractMenu.py b/empire/client/src/menus/InteractMenu.py index 3a161ffe4..46180a427 100644 --- a/empire/client/src/menus/InteractMenu.py +++ b/empire/client/src/menus/InteractMenu.py @@ -161,7 +161,7 @@ def use(self, agent_name: str) -> None: state.get_agents() if agent_name in state.agents.keys(): self.name = agent_name - self.selected = state.agents[agent_name]["session_id"] + self.selected = agent_name self.session_id = state.agents[agent_name]["session_id"] self.agent_options = state.agents[agent_name] # todo rename agent_options self.agent_language = self.agent_options["language"] From 4cb09aacf661050c61b21ba1cf0b0803575da91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s?= Date: Tue, 7 Nov 2023 22:33:05 +0200 Subject: [PATCH 2/4] use session id instead of agent name to create shell --- empire/client/src/menus/ShellMenu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/empire/client/src/menus/ShellMenu.py b/empire/client/src/menus/ShellMenu.py index e3d237ae9..fb93745d4 100644 --- a/empire/client/src/menus/ShellMenu.py +++ b/empire/client/src/menus/ShellMenu.py @@ -91,7 +91,7 @@ def shell(self, agent_name: str, shell_cmd: str): Usage: """ - response = state.agent_shell(agent_name, shell_cmd) + response = state.agent_shell(state.agents[agent_name]["session_id"], shell_cmd) if shell_cmd.split()[0].lower() in ["cd", "set-location"]: shell_return = threading.Thread( target=self.update_directory, args=[agent_name] From 6086bb93e851de3ef3902476a580b55da2c2683f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s?= Date: Tue, 7 Nov 2023 23:16:16 +0200 Subject: [PATCH 3/4] make sure update_directory gets session id in ShellMenu.py --- empire/client/src/menus/ShellMenu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/empire/client/src/menus/ShellMenu.py b/empire/client/src/menus/ShellMenu.py index fb93745d4..89deb79f9 100644 --- a/empire/client/src/menus/ShellMenu.py +++ b/empire/client/src/menus/ShellMenu.py @@ -94,7 +94,7 @@ def shell(self, agent_name: str, shell_cmd: str): response = state.agent_shell(state.agents[agent_name]["session_id"], shell_cmd) if shell_cmd.split()[0].lower() in ["cd", "set-location"]: shell_return = threading.Thread( - target=self.update_directory, args=[agent_name] + target=self.update_directory, args=[state.agents[agent_name]["session_id"]] ) shell_return.daemon = True shell_return.start() From fd8a745120039495d2a4382f52e1c08fa08f881a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s?= Date: Wed, 8 Nov 2023 00:21:18 +0200 Subject: [PATCH 4/4] make sure execute_module is called with session_id --- empire/client/src/menus/UseModuleMenu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/empire/client/src/menus/UseModuleMenu.py b/empire/client/src/menus/UseModuleMenu.py index 66cd680a7..d3c0195aa 100644 --- a/empire/client/src/menus/UseModuleMenu.py +++ b/empire/client/src/menus/UseModuleMenu.py @@ -114,7 +114,7 @@ def execute(self): log.error("Agent not set") return response = state.execute_module( - self.record_options["Agent"]["value"], post_body + state.agents[self.record_options["Agent"]["value"]]["session_id"], post_body ) if "status" in response.keys(): if "Agent" in post_body["options"].keys():