forked from mitre/caldera
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swapping adversary to c_object (mitre#665)
- Loading branch information
david
authored
Oct 29, 2019
1 parent
1da8cad
commit bc08633
Showing
8 changed files
with
52 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from app.objects.base_object import BaseObject | ||
|
||
|
||
class Adversary(BaseObject): | ||
|
||
@property | ||
def unique(self): | ||
return self.hash('%s' % self.adversary_id) | ||
|
||
@property | ||
def display(self): | ||
return dict(adversary_id=self.adversary_id, name=self.name, description=self.description, phases=self.phases) | ||
|
||
def __init__(self, adversary_id, name, description, phases): | ||
self.adversary_id = adversary_id | ||
self.name = name | ||
self.description = description | ||
self.phases = phases | ||
|
||
def store(self, ram): | ||
existing = self.retrieve(ram['adversaries'], self.unique) | ||
if not existing: | ||
ram['adversaries'].append(self) | ||
return self.retrieve(ram['adversaries'], self.unique) |
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
Submodule chain
updated
3 files
+11 −2 | app/chain_api.py | |
+8 −1 | static/js/sections.js | |
+2 −1 | templates/chain.html |