Skip to content

[BUG] Python agent doesn't execute jobs in background #820

Description

@ruvolof

Is there an existing issue for this?

  • I have searched the existing issues

Empire Version

6.5.0

Python Version

3.14

Operating System

Kali

Database

SQLite

Current Behavior

When a module is set to be executed in the background, the module service sends a TASK_PYTHON_CMD_JOB:

module_data.command = "TASK_PYTHON_CMD_JOB"

TASK_PYTHON_CMD_JOB is mapped to value 112:

"TASK_PYTHON_CMD_JOB": 112,

However when the agent receive task 112 (

self.disk_code_execution_wait_save(data, result_id)
) it calls disk_code_execution_wait_save, which does not execute jobs in background:
def disk_code_execution_wait_save(self, data, result_id):

The function to execute jobs in background is assigned to task 113 (

elif packet_type == 113:
), which is never sent by the module service (no other usage other than the definition in packets.py: https://github.com/search?q=repo%3ABC-SECURITY%2FEmpire+TASK_PYTHON_CMD_JOB_SAVE&type=code).

Expected Behavior

Jobs should be executed in background.

Steps To Reproduce

  1. Start Empire.
  2. Create a listener and launch a python agent on a linux machine.
  3. Execute the long running linpeas module.
  4. Try to execute other commands while linpeas is running.

Anything else?

In addition to the problem above, the python agent is not ready for background jobs as-is, this is because jobs in python currently redirect stdout in order to capture the output. Multiple background job will likely pollute each other output.

I have a working branch that addresses this issue. I will send a merge request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions