This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contrib agent Support for Machine Target Executor (#106)
* MachineTargetExecutor support for contrib agent
- Loading branch information
Showing
8 changed files
with
135 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from ychaos.agents.agent import Agent, AgentConfig | ||
from ychaos.agents.utils.annotations import log_agent_lifecycle | ||
|
||
|
||
class AwesomeAgentConfig(AgentConfig): | ||
name: str = "awesomeagent" | ||
description: str = "This is an dummy agent" | ||
|
||
|
||
class MyAwesomeAgent(Agent): | ||
@log_agent_lifecycle | ||
def __init__(self, config) -> None: | ||
print("in method: init") | ||
assert isinstance(config, AgentConfig) | ||
super(MyAwesomeAgent, self).__init__(config) | ||
|
||
@log_agent_lifecycle | ||
def monitor(self) -> None: | ||
print("in method: monitor") | ||
super(MyAwesomeAgent, self).monitor() | ||
return self._status | ||
|
||
@log_agent_lifecycle | ||
def setup(self) -> None: | ||
print("in method: setup") | ||
super(MyAwesomeAgent, self).setup() | ||
|
||
@log_agent_lifecycle | ||
def run(self) -> None: | ||
print("in method: run") | ||
super(MyAwesomeAgent, self).run() | ||
|
||
@log_agent_lifecycle | ||
def teardown(self) -> None: | ||
print("in method: teardown") | ||
super(MyAwesomeAgent, self).teardown() | ||
|
||
|
||
AgentClass = MyAwesomeAgent | ||
AgentConfigClass = AwesomeAgentConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
attack: | ||
target_type: machine | ||
target_config: | ||
blast_radius: 100 | ||
hostnames: | ||
- mockhost.resilience.yahoo.cloud | ||
ssh_config: {} | ||
agents: | ||
- type: contrib | ||
config: | ||
path: path/to/awesome_agent.py | ||
contrib_agent_config: | ||
key1 : value1 | ||
key2 : value2 |