Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corrected "selected" field assignment in InteractMenu.py #704

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tamasbakos
Copy link

@tamasbakos tamasbakos commented Nov 7, 2023

The "selected" field in the InteractMenu was not assigned correctly before. I changed it to assign the agent_name to the "selected" field, similarly as in other menus. Without this correction if you rename an agent, interact with its new name, and issue the "shell" command, the client will crash because it will try to find the agent in "state.agents" by session ID, even though it should search by name. Exception that occurs in this case without my correction:

(Empire: web05) > shell
Traceback (most recent call last):
File "/home/tamas/repos/Empire/empire.py", line 26, in
client.start(args)
File "/home/tamas/repos/Empire/empire/client/client.py", line 508, in start
empire.main()
File "/home/tamas/repos/Empire/empire/client/client.py", line 261, in main
self.parse_command_line(text, cmd_line)
File "/home/tamas/repos/Empire/empire/client/client.py", line 363, in parse_command_line
menu_state.push(
File "/home/tamas/repos/Empire/empire/client/src/MenuState.py", line 22, in push
if menu.on_enter(**kwargs):
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tamas/repos/Empire/empire/client/src/menus/ShellMenu.py", line 31, in on_enter
self.use(kwargs["selected"])
File "/home/tamas/repos/Empire/empire/client/src/menus/ShellMenu.py", line 50, in use
self.session_id = state.agents[self.selected]["session_id"]
~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'F7EZCSH9'

@vinnybod
Copy link

vinnybod commented Nov 14, 2023

Thanks. works for me.

Probably would be better (but more work to fix) to have the state key be the session_id and just use name for display interaction purposes, but I'm fine with this soution.

Can you run the linting? Looks like its failing there. poetry run black . https://github.com/BC-SECURITY/Empire/blob/main/.github/CONTRIBUTING.md#code-formatting-and-linting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants