Files
Anthony Rose 41c7abd01d Updated agent taskings to remove unused/redundant functionality (#890)
* removed unused tasks 111 and 113

* moved task 44 to 116

* reorganized tasks into 3 supported languages

* added invoke-script for loading script in memory replacement

* fixed option validation to take into account files being a dependent option

* updated option validation and added tests

* added python invoke script and updated validation

* revised validate options again and added docs

* added DependsOn as validation default to fix validation tests

* Fixed directory for doc gifs in modules

* fixed python invoke-script gif

* fixed changelog and reduced gif sizes

* removed unused proxy classes

* removed agent.functions

* removed default values for python invoke_script

* fixed unused normalization for is_option_required

* Update empire/server/utils/option_util.py

Co-authored-by: Vincent Rose <vrose04@gmail.com>

---------

Co-authored-by: Vincent Rose <vrose04@gmail.com>
2024-09-18 22:16:59 -04:00

1.1 KiB

Python Modules

Python modules are not much different from PowerShell modules in terms of the yaml schema. The differences for Python come in with the script, script_path, script_end, and option formatters.

A python script doesn't have an option_format_string. Instead, options are injected into the script directly using mustache templating. An example of this is the python module say.

options:
  - name: Agent
    description: Agent to run module on.
    required: true
    value: ''
  - name: Text
    description:
    required: true
    value: 'The text to speak.'
  - name: Voice
    description: The voice to use.
    required: true
    value: 'alex'
script: run_command('say -v {{ Voice }} {{ Text }}')

Python modules also support the advanced.custom_generate method of generating the script. Python modules can be used with script OR script_path and will ignore script_end, option_format_string, and option_format_string_boolean.