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

Windows agent is not deleted after completition #1763

Closed
1 task done
ilija-lazoroski opened this issue Mar 4, 2022 · 3 comments · Fixed by #1900
Closed
1 task done

Windows agent is not deleted after completition #1763

ilija-lazoroski opened this issue Mar 4, 2022 · 3 comments · Fixed by #1900
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Complexity: Medium Impact: High

Comments

@ilija-lazoroski
Copy link
Contributor

ilija-lazoroski commented Mar 4, 2022

Describe the bug

When running the monkey agent on windows system, the agent is not deleted after the execution is finished.
Possible cause is that we are using subprocess.Popen to launch a command that waits and then deletes the binary, but somewhere we exit the agent which kills the Popen execution and the agent is never deleted.

To Reproduce

Steps to reproduce the behavior:

  1. Run the Monkey Agent from executable
  2. Check if the executable is deleted

Expected behavior

The agent should be removed after execution.

Task

Screenshots

image

Machine version (please complete the following information):

  • OS: Windows
@ilija-lazoroski ilija-lazoroski added Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Impact: High Complexity: Medium labels Mar 4, 2022
@mssalvatore
Copy link
Collaborator

mssalvatore commented Mar 4, 2022

Using the at command or the schtasks command instead of the current implementation might resolve the issue and also be cleaner.

@mssalvatore
Copy link
Collaborator

[DeleteFileA](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilea) might be the best solution.

The DeleteFile function marks a file for deletion on close. Therefore, the file deletion does not occur until the last handle to the file is closed. Subsequent calls to CreateFile to open the file fail with ERROR_ACCESS_DENIED.

@mssalvatore
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Complexity: Medium Impact: High
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants