TuoniPayloadTemplate¶
- class tuoni.TuoniPayloadTemplate(conf, c2)[source]¶
A class that provides data and functionality for a payload template.
- id¶
The unique identifier of the payload template.
- Type:
str
- name¶
The name of the payload template.
- Type:
str
- status¶
The status of the payload template.
- Type:
str
- description¶
A description of the payload template.
- Type:
str
- payload_type¶
The type of payload associated with the payload template.
- Type:
str
- plugin_id¶
The unique identifier of the payload plugin.
- Type:
str
- example_configurations¶
A list of example configurations for the payload template.
- Type:
list[dict]
- conf_schema¶
The configuration schema for the payload template.
- Type:
dict
- available_listeners¶
A list of available listeners that can be used with this payload template.
- Type:
list[TuoniListener]
Examples
Inspect a template’s configuration schema and create a payload for each supported type:
>>> payload_plugins = tuoni_c2.load_payload_plugins() >>> for plugin in payload_plugins.values(): ... for template in plugin.templates: ... print(f"Template: {template.id}, type: {template.payload_type}") ... type_values = ( ... template.conf_schema ... .get("properties", {}) ... .get("type", {}) ... .get("enum", []) ... ) ... for type_value in type_values: ... payload = TuoniPayload( ... conf={ ... "templateId": template.id, ... "configuration": {"type": type_value} ... }, ... c2=tuoni_c2 ... ) ... payload.create(listener_id=1) ... data = payload.download() ... with open(f"{payload.payload_id}.bin", "wb") as f: ... f.write(data) ... payload.delete()