corrected "selected" field assignment in InteractMenu.py #704
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'