Skip to content

Commit 202da0e

Browse files
Updated executor docs to reflect functions of all executors (#96)
1 parent 1dbf33e commit 202da0e

File tree

1 file changed

+124
-53
lines changed

1 file changed

+124
-53
lines changed

docs/content/en/docs/core-components/executer.md

+124-53
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,94 @@ description: >
1010
## Components
1111
The executor consists of the following components.
1212

13+
- Action executor
14+
- Playbook action executor
15+
- if-condition executor
16+
- while-condition executor
17+
- parallel executor
18+
19+
The decomposer interacts with every executor type. They all have separate interfaces to handle new step types in the future without changing the current interfaces.
20+
21+
```plantuml
22+
23+
package action{
24+
interface IExecutor {
25+
..., err Execute(...)
26+
}
27+
}
28+
29+
package playbookaction{
30+
interface IExecutor {
31+
..., err Execute(...)
32+
}
33+
}
34+
35+
package ifcondition{
36+
interface IExecutor {
37+
..., err Execute(...)
38+
}
39+
}
40+
41+
package whilecondition{
42+
interface IExecutor {
43+
..., err Execute(...)
44+
}
45+
}
46+
47+
package parallel{
48+
interface IExecutor {
49+
..., err Execute(...)
50+
}
51+
}
52+
53+
54+
interface ICapability{
55+
variables, error Execute(Metadata, command, variable[], target, agent)
56+
string GetModuleName()
57+
}
58+
59+
class "Decomposer" as decomposer
60+
class "Action Executor" as Executor
61+
class "Playbook Executor" as playbook
62+
class "Parallel Executor" as parallelexecutor
63+
class "While Executor" as while
64+
class "If condition Executor" as condition
65+
66+
class "Ssh" as ssh
67+
class "OpenC2" as openc2
68+
class "HttpApi" as api
69+
class "Fin" as fin
70+
71+
72+
action.IExecutor <|.. Executor
73+
ICapability <-up- Executor
74+
ICapability <|.. ssh
75+
ICapability <|.. openc2
76+
ICapability <|.. api
77+
ICapability <|.. fin
78+
79+
playbookaction.IExecutor <|.. playbook
80+
ifcondition.IExecutor <|.. condition
81+
whilecondition.IExecutor <|.. while
82+
parallel.IExecutor <|.. parallelexecutor
83+
84+
decomposer -down-> playbookaction.IExecutor
85+
decomposer -down-> ifcondition.IExecutor
86+
decomposer -down-> whilecondition.IExecutor
87+
decomposer -down-> parallel.IExecutor
88+
decomposer -down-> action.IExecutor
89+
90+
91+
```
92+
93+
### Action executor
94+
95+
The action executor consist of the following components
96+
1397
- The capability selector
1498
- Native capabilities (command executors)
1599
- MQTT capability to interact with: Fin capabilities (third-party executors)
16100

17-
### Capability selector (Executor)
18-
19101
The capability selector will select the implementation which is capable of executing the incoming command. There are native capabilities based on the CACAO `command-type-ov`:
20102

21103
* **Currently implemented**
@@ -33,15 +115,15 @@ The capability selector will select the implementation which is capable of execu
33115
* sigma
34116
* yara
35117

36-
### Native capabilities
118+
#### Native capabilities
37119
The executor will select a module that is capable of executing the command and pass the details to it. The capability selection is performed based on the agent type (see [Agent and Target Common Properties](https://docs.oasis-open.org/cacao/security-playbooks/v2.0/cs01/security-playbooks-v2.0-cs01.html#_Toc152256509) in the CACAO 2.0 spec). The convention is that the agent type must equal `soarca-<capability identifier>`, e.g. `soarca-ssh` or `soarca-openc2-http`.
38120

39121
The result of the step execution will be returned to the decomposer. A result can be either output variables or error status.
40122

41-
### MQTT executor -> Fin capabilities
123+
#### MQTT executor -> Fin capabilities
42124
The Executor will put the command on the MQTT topic that is offered by the module. How a module handles this is described in the link:modules.adoc[module documentation]
43125

44-
### Component overview
126+
#### Component overview
45127

46128
```plantuml
47129
@@ -64,54 +146,7 @@ parser -- Executor
64146
exe3 -- Fins : " MQTT topics"
65147
```
66148

67-
68-
## Executor classes
69-
70-
71-
```plantuml
72-
73-
interface IExecutor {
74-
void Execute(ExecutionId, CommandData, variable[], target, module, completionCallback(variables[]))
75-
void Pause(CommandData, module)
76-
void Resume(CommandData, module)
77-
void Kill(CommandData, module)
78-
}
79-
80-
struct State{
81-
stopped
82-
running
83-
paused
84-
}
85-
86-
87-
interface ICapability{
88-
void Execute(ExecutionId, CommandData, variable[], target, completionCallback(variables[]))
89-
module GetModuleName()
90-
}
91-
92-
93-
class Executor
94-
95-
class "Ssh" as ssh
96-
class "OpenC2" as openc2
97-
class "HttpApi" as api
98-
99-
100-
IExecutor <|.. Executor
101-
Executor -> ICapability
102-
ICapability <|.. ssh
103-
ICapability <|.. openc2
104-
ICapability <|.. api
105-
106-
```
107-
108-
109-
110-
111-
112-
113-
114-
## Sequences
149+
#### Sequences
115150

116151
Example execution for SSH commands with SOARCA native capability.
117152

@@ -135,3 +170,39 @@ else capability not available
135170
end
136171
```
137172

173+
### Playbook action executor
174+
The playbook executor handles execution of playbook action steps. The variables from the top level playbook are injected into the be executed playbook.
175+
It could happen that in the downstream playbook the variables `collide` with the top level playbook. In this case the top level playbook variables are `NOT` transferred to the downstream playbook. `Agents and Targets cannot be transferred` between playbooks at this time. Playbooks are only loaded in the executor and then a new Decomposer is created to execute the playbook.
176+
177+
The result of the step execution will be returned to the decomposer. A result can be either output variables or error status.
178+
179+
```plantuml
180+
package playbookaction{
181+
interface IExecutor {
182+
Variables, err Execute(meta, step, variables)
183+
}
184+
}
185+
class "Decomposer" as decomposer
186+
class "Action Executor" as exe
187+
interface "IPlaybookController" as controller
188+
interface "IDatabaseController" as database
189+
190+
playbookaction.IExecutor <|.. exe
191+
decomposer -> playbookaction.IExecutor
192+
exe -> controller
193+
database <- exe
194+
195+
```
196+
197+
### If condition executor
198+
The if-condition executor will process a cacao if-condition step and determine it's output.
199+
200+
The result of the step comparison will be returned to the decomposer. A result can be either a next step id and/or error status.
201+
202+
### While condition executor
203+
The if-condition executor will process a cacao while-condition step and determine it's output.
204+
205+
The result of the step comparison will be returned to the decomposer. A result can be either a next step id and/or error status.
206+
207+
### Parallel step executor
208+
The parallel executor will execute the parallel step. This wil be done in sequence to simplify implementation. As parallel steps must not be depended on each other sequential execution is possible. Later this will be changed.

0 commit comments

Comments
 (0)