Upload 32 files
Browse files- .gitattributes +2 -0
- Home.py +12 -0
- __init__.py +0 -0
- __pycache__/__init__.cpython-311.pyc +0 -0
- __pycache__/__init__.cpython-39.pyc +0 -0
- __pycache__/aeo_example_generator.cpython-311.pyc +0 -0
- __pycache__/aeo_example_generator.cpython-39.pyc +0 -0
- aeo_ex_generator/__init__.py +0 -0
- aeo_ex_generator/__pycache__/__init__.cpython-311.pyc +0 -0
- aeo_ex_generator/__pycache__/__init__.cpython-39.pyc +0 -0
- aeo_ex_generator/__pycache__/aeo_example_generator.cpython-311.pyc +0 -0
- aeo_ex_generator/__pycache__/aeo_example_generator.cpython-39.pyc +0 -0
- aeo_ex_generator/aeo_example_generator.py +417 -0
- aeo_example_generator.py +417 -0
- data/chroma.sqlite3 +3 -0
- data/d1a96671-aee8-491c-a591-df54be606f81/data_level0.bin +3 -0
- data/d1a96671-aee8-491c-a591-df54be606f81/header.bin +3 -0
- data/d1a96671-aee8-491c-a591-df54be606f81/length.bin +3 -0
- data/d1a96671-aee8-491c-a591-df54be606f81/link_lists.bin +3 -0
- docs/EngageHandbook-v1.0.pdf +3 -0
- docs/SmallBusinessExample.md +1089 -0
- docs/aeo_example_generator.py +300 -0
- lureGeneration/LureGenerator.py +144 -0
- lureGeneration/__init__.py +0 -0
- lureGeneration/__pycache__/LureGenerator.cpython-310.pyc +0 -0
- lureGeneration/__pycache__/LureGenerator.cpython-39.pyc +0 -0
- lureGeneration/__pycache__/__init__.cpython-310.pyc +0 -0
- lureGeneration/__pycache__/__init__.cpython-39.pyc +0 -0
- pages/1_AEO_Example_Generator.py +76 -0
- pages/2_Auto_Generate_Plan_and_Personas.py +43 -0
- pages/3_Lure_Generation.py +29 -0
- pages/4_AutoEngage.py +77 -0
- requirements.txt +10 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
data/chroma.sqlite3 filter=lfs diff=lfs merge=lfs -text
|
37 |
+
docs/EngageHandbook-v1.0.pdf filter=lfs diff=lfs merge=lfs -text
|
Home.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
st.set_page_config(
|
4 |
+
page_title="Adversary Engagement Ontology",
|
5 |
+
page_icon='🕷',
|
6 |
+
layout='wide'
|
7 |
+
)
|
8 |
+
st.header("Adversary Engagement Ontology")
|
9 |
+
|
10 |
+
st.write("Adversary Engagement Ontology (AEO) is a candidate ontology to the Unified Cyber Ontology (UCO), a community effort for the ontological standardization of cyber domain concepts and objects under a unifying framework, and is part of the Cyber Domain Ontology (CDO). Community efforts and development has always been manual labor intensive in regards to ontology changes, ontology example generation for adopters, documentation generation. Large Language Models (LLMs) have been shown to be capable of automating many tasks or aiding in human expert decision-making. We demonstrate how foundational LLMs such as ChatGPT and GPT4 can assist in ontology example generation, ontology development, and overall be used in automation tooling for structured but tedious tasks. This space can be used to create an example of how to setup the AEO instance. It uses the power of OpenAI's ChatGPT. The generator currently uses strictly prewritten rules of AEO, discussion on an automation process is still early . he generator currently is bounded by prompt size limits.")
|
11 |
+
|
12 |
+
st.write("There are different pages in this space which you can use to generate examples, personas, honey tokens, and also create an auto engagement strategy")
|
__init__.py
ADDED
File without changes
|
__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (191 Bytes). View file
|
|
__pycache__/__init__.cpython-39.pyc
ADDED
Binary file (146 Bytes). View file
|
|
__pycache__/aeo_example_generator.cpython-311.pyc
ADDED
Binary file (24.1 kB). View file
|
|
__pycache__/aeo_example_generator.cpython-39.pyc
ADDED
Binary file (17 kB). View file
|
|
aeo_ex_generator/__init__.py
ADDED
File without changes
|
aeo_ex_generator/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (191 Bytes). View file
|
|
aeo_ex_generator/__pycache__/__init__.cpython-39.pyc
ADDED
Binary file (146 Bytes). View file
|
|
aeo_ex_generator/__pycache__/aeo_example_generator.cpython-311.pyc
ADDED
Binary file (24.1 kB). View file
|
|
aeo_ex_generator/__pycache__/aeo_example_generator.cpython-39.pyc
ADDED
Binary file (17 kB). View file
|
|
aeo_ex_generator/aeo_example_generator.py
ADDED
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import openai
|
3 |
+
import json
|
4 |
+
import rdflib
|
5 |
+
|
6 |
+
|
7 |
+
class ExampleGenerator:
|
8 |
+
def __init__(self):
|
9 |
+
self.ontologies = {}
|
10 |
+
self.ontology_files = []
|
11 |
+
self.rules = {}
|
12 |
+
self.description = None
|
13 |
+
def add_ontology(self, onto):
|
14 |
+
if onto in self.ontology_files:
|
15 |
+
raise ValueError("Ontology file already exists.")
|
16 |
+
else:
|
17 |
+
onto_data = self.get_ontology_file(onto)
|
18 |
+
if onto_data:
|
19 |
+
self.ontology_files.append(onto)
|
20 |
+
self.ontologies[onto] = self.get_ontology_file(onto)
|
21 |
+
self.rules[onto] = self.generate_rules(onto)
|
22 |
+
else:
|
23 |
+
raise ValueError("Ontology file error.")
|
24 |
+
def get_ontology_file(self,filename):
|
25 |
+
text = ""
|
26 |
+
if os.path.isfile(filename):
|
27 |
+
with open(filename,'r') as f:
|
28 |
+
text = f.read()
|
29 |
+
f.close()
|
30 |
+
return text
|
31 |
+
else:
|
32 |
+
raise ValueError("Invalid filename.")
|
33 |
+
def ChatGPTTextSplitter(self,text):
|
34 |
+
"""Splits text in smaller subblocks to feed to the LLM"""
|
35 |
+
prompt = f"""The total length of content that I want to send you is too large to send in only one piece.
|
36 |
+
|
37 |
+
For sending you that content, I will follow this rule:
|
38 |
+
|
39 |
+
[START PART 1/10]
|
40 |
+
this is the content of the part 1 out of 10 in total
|
41 |
+
[END PART 1/10]
|
42 |
+
|
43 |
+
Then you just answer: "Instructions Sent."
|
44 |
+
|
45 |
+
And when I tell you "ALL PARTS SENT", then you can continue processing the data and answering my requests.
|
46 |
+
"""
|
47 |
+
if type(text) == str:
|
48 |
+
textsize = 12000
|
49 |
+
blocksize = int(len(text) / textsize)
|
50 |
+
if blocksize > 0:
|
51 |
+
yield prompt
|
52 |
+
|
53 |
+
for b in range(1,blocksize+1):
|
54 |
+
if b < blocksize+1:
|
55 |
+
prompt = f"""Do not answer yet. This is just another part of the text I want to send you. Just receive and acknowledge as "Part {b}/{blocksize} received" and wait for the next part.
|
56 |
+
[START PART {b}/{blocksize}]
|
57 |
+
{text[(b-1)*textsize:b*textsize]}
|
58 |
+
[END PART {b}/{blocksize}]
|
59 |
+
Remember not answering yet. Just acknowledge you received this part with the message "Part {b}/{blocksize} received" and wait for the next part.
|
60 |
+
"""
|
61 |
+
yield prompt
|
62 |
+
else:
|
63 |
+
prompt = f"""
|
64 |
+
[START PART {b}/{blocksize}]
|
65 |
+
{text[(b-1)*textsize:b*textsize]}
|
66 |
+
[END PART {b}/{blocksize}]
|
67 |
+
ALL PARTS SENT. Now you can continue processing the request.
|
68 |
+
"""
|
69 |
+
yield prompt
|
70 |
+
else:
|
71 |
+
yield text
|
72 |
+
elif type(text) == list:
|
73 |
+
yield prompt
|
74 |
+
|
75 |
+
for n,block in enumerate(text):
|
76 |
+
if n+1 < len(text):
|
77 |
+
prompt = f"""Do not answer yet. This is just another part of the text I want to send you. Just receive and acknowledge as "Part {n+1}/{len(text)} received" and wait for the next part.
|
78 |
+
[START PART {n+1}/{len(text)}]
|
79 |
+
{text[n]}
|
80 |
+
[END PART {n+1}/{len(text)}]
|
81 |
+
Remember not answering yet. Just acknowledge you received this part with the message "Part {n+1}/{len(text)} received" and wait for the next part.
|
82 |
+
"""
|
83 |
+
yield prompt
|
84 |
+
else:
|
85 |
+
prompt = f"""
|
86 |
+
[START PART {n+1}/{len(text)}]
|
87 |
+
{text[n]}
|
88 |
+
[END PART {n+1}/{len(text)}]
|
89 |
+
ALL PARTS SENT. Now you can continue processing the request.
|
90 |
+
"""
|
91 |
+
yield prompt
|
92 |
+
|
93 |
+
def send_ontology(self):
|
94 |
+
ontology = ""
|
95 |
+
if len(self.ontologies) > 0:
|
96 |
+
for k,v in self.ontologies.items():
|
97 |
+
ontology+=v+"\n"
|
98 |
+
print("Sending Ontology in Parts")
|
99 |
+
for i in self.ChatGPTTextSplitter(ontology):
|
100 |
+
print(self.llm_api(i))
|
101 |
+
else:
|
102 |
+
raise ValueError("No loaded ontology to send.")
|
103 |
+
def llm_api(self,prompt,model="gpt-3.5-turbo"):
|
104 |
+
messages = [{
|
105 |
+
"role":"user",
|
106 |
+
"content":prompt
|
107 |
+
}]
|
108 |
+
res = openai.ChatCompletion.create(model=model,messages=messages,temperature=0)
|
109 |
+
return res.choices[0].message['content']
|
110 |
+
|
111 |
+
def generate_rule(self,onto=None):
|
112 |
+
"""Raw rule string of AEO."""
|
113 |
+
v = """These are the components that construct the plan:
|
114 |
+
Fake personas - first and last name
|
115 |
+
People can have one of the following DeceptionRoles:
|
116 |
+
adversary
|
117 |
+
defender
|
118 |
+
Identities can take one of the following DeceptionActions:
|
119 |
+
engagement:Access - subject is an identity, predicate is an object
|
120 |
+
engagement:Alert - subject is an identity, predicate is a human identity
|
121 |
+
engagement:Beacon - subject is non-human identities, services, or tools, predicate can be a server, service, tool or an identity
|
122 |
+
engagement:Deploy - subject is human or agent, the predicate must be a DeceptionObject
|
123 |
+
engagement:Obfuscate
|
124 |
+
engagement:Respond
|
125 |
+
There can be one or more DeceptionObjects:
|
126 |
+
engagement:Honeypot
|
127 |
+
engagement:Honeytoken
|
128 |
+
engagement:Breadcrumb
|
129 |
+
engagement:BreadcrumbTrail - this is a set of breadcrumbs
|
130 |
+
engagement:LureObject
|
131 |
+
engagement:HoneyObject
|
132 |
+
engagement:Decoy
|
133 |
+
engagement:DataSource
|
134 |
+
A defender that performs an a DeceptionAction has at least one of the following DefenderObjectives
|
135 |
+
objective:Reconnaissance
|
136 |
+
objective:Affect
|
137 |
+
objective:Collect
|
138 |
+
objective:Detect
|
139 |
+
objective:Direct
|
140 |
+
objective:Disrupt
|
141 |
+
objective:Elicit
|
142 |
+
objective:Expose
|
143 |
+
objective:Motivate
|
144 |
+
objective:Plan
|
145 |
+
objective:Prepare
|
146 |
+
objective:Prevent
|
147 |
+
objective:Reassure
|
148 |
+
objective:Analyze
|
149 |
+
objective:Deny
|
150 |
+
objective:ElicitBehavior
|
151 |
+
objective:Lure
|
152 |
+
objective:TimeSink
|
153 |
+
objective:Track
|
154 |
+
objective:Trap
|
155 |
+
An adversary that performs an a DeceptionAction has at least one of the following AdversaryObjectives
|
156 |
+
objective:CommandAndControl
|
157 |
+
objective:CredentialAccess
|
158 |
+
objective:DevelopResource
|
159 |
+
objective:Discover
|
160 |
+
objective:EscalatePrivilege
|
161 |
+
objective:Evade
|
162 |
+
objective:Execute
|
163 |
+
objective:Exfilitrate
|
164 |
+
objective:GainInitialAccess
|
165 |
+
objective:Impact
|
166 |
+
objective:MoveLaterally
|
167 |
+
objective:Persist
|
168 |
+
objective:Reconnaissance
|
169 |
+
Generate the plan in the following structure:
|
170 |
+
print "Use one engagement:Narrative"
|
171 |
+
print "Use one engagement:Storyline"
|
172 |
+
print "Use the following people:"
|
173 |
+
Enumerate each person's name and DeceptionRole
|
174 |
+
|
175 |
+
Each planned event is centered around a DeceptionAction taken by some identity or person with a DeceptionRole onto a DeceptionObject or Object. Enumerate each planned events where each planned event has a short description and number starting with "Planned Event 1". Describe which person deploys a DeceptionObject, what DeceptionAction they used and what the DefenderObjective or AdversaryObjective of the action or deployed DeceptionObject. The last planned event should conclude that an defender has been alerted that the DeceptionObject was accessed by the adversary.
|
176 |
+
|
177 |
+
Remember to use only given DefenderObjectives, AdversaryObjectives, DeceptionObjects, DeceptionActions, and DeceptionRoles. Do not use any other objectives, objects, actions, or roles other than what is provided. If a person uses an action not from DeceptionActions, then the action is "uco-core:Action" with the name of action.
|
178 |
+
"""
|
179 |
+
return v
|
180 |
+
def generate_json_rule(self,onto=None):
|
181 |
+
"""Raw rule string of AEO."""
|
182 |
+
v = """Remember make a json-ld format example that only uses classes and properties terms from Adversary Engagement Ontology, Unified Cyber Ontology.
|
183 |
+
|
184 |
+
Each engagement:Narrative has property:
|
185 |
+
engagement:hasStoryline connects to an engagement:Storyline
|
186 |
+
Each engagement:Storyline has property:
|
187 |
+
engagement:hasEvent connects to a uco-types:Thread
|
188 |
+
Each uco-types:Thread has properties:
|
189 |
+
co:element contains all engagement:PlannedEvents
|
190 |
+
co:item contains all uco-types:ThreadItem one each for each engagement:PlannedEvent.
|
191 |
+
co:size
|
192 |
+
uco-types:threadOriginItem is the uco-types:ThreadItem for the first engagement:PlannedEvent
|
193 |
+
uco-types:threadTerminalItem is the uco-types:ThreadItem for the last engagement:PlannedEvent
|
194 |
+
Each co:size has properties:
|
195 |
+
@type as xsd:nonNegativeInteger
|
196 |
+
@value which is the number of uco-types:ThreadItem
|
197 |
+
Each uco-types:ThreadItem has property:
|
198 |
+
co:itemContent is the engagement:PlannedEvent
|
199 |
+
optional uco-types:threadNextItem is the next uco-types:ThreadItem for the next engagement:PlannedEvent if there is one,
|
200 |
+
optional uco-types:threadPreviousItem is the previous uco-types:ThreadItem for the previous engagement:PlannedEvent if there is one
|
201 |
+
Each engagement:PlannedEvent has property:
|
202 |
+
engagement:eventContext connects to one engagement action has property @type one of the following:
|
203 |
+
engagement:Access
|
204 |
+
engagement:Alert
|
205 |
+
engagement:Beacon
|
206 |
+
engagement:Deploy
|
207 |
+
engagement:Obfuscate
|
208 |
+
engagement:Respond
|
209 |
+
Each engagement action has properties:
|
210 |
+
@type is the action
|
211 |
+
uco-core:performer
|
212 |
+
uco-core:object connects to one of the following engagement deception object denoted as "EDO" objects:
|
213 |
+
engagement:Honeypot
|
214 |
+
engagement:Honeytoken
|
215 |
+
engagement:Breadcrumb
|
216 |
+
engagement:BreadcrumbTrail
|
217 |
+
engagement:LureObject
|
218 |
+
engagement:HoneyObject
|
219 |
+
engagement:Decoy
|
220 |
+
engagement:DataSource
|
221 |
+
Each "EDO" object has properties:
|
222 |
+
engagement:hasCharacterization connects to a uco-core:UcoObject
|
223 |
+
objective:hasObjective with @type objective:Objective and @id with one of the following instances:
|
224 |
+
objective:CommandAndControl
|
225 |
+
objective:CredentialAccess
|
226 |
+
objective:DevelopResource
|
227 |
+
objective:Discover
|
228 |
+
objective:EscalatePrivilege
|
229 |
+
objective:Evade
|
230 |
+
objective:Execute
|
231 |
+
objective:Exfilitrate
|
232 |
+
objective:GainInitialAccess
|
233 |
+
objective:Impact
|
234 |
+
objective:MoveLaterally
|
235 |
+
objective:Persist
|
236 |
+
objective:Reconnaissance
|
237 |
+
objective:Affect
|
238 |
+
objective:Collect
|
239 |
+
objective:Detect
|
240 |
+
objective:Direct
|
241 |
+
objective:Disrupt
|
242 |
+
objective:Elicit
|
243 |
+
objective:Expose
|
244 |
+
objective:Motivate
|
245 |
+
objective:Plan
|
246 |
+
objective:Prepare
|
247 |
+
objective:Prevent
|
248 |
+
objective:Reassure
|
249 |
+
objective:Analyze
|
250 |
+
objective:Deny
|
251 |
+
objective:ElicitBehavior
|
252 |
+
objective:Lure
|
253 |
+
objective:TimeSink
|
254 |
+
objective:Track
|
255 |
+
objective:Trap
|
256 |
+
uco-core:name is the objective
|
257 |
+
All people have property:
|
258 |
+
@type is uco-identity:Person
|
259 |
+
uco-core:hasFacet that connects to one of the following:
|
260 |
+
uco-identity:SimpleNameFacet which has the property:
|
261 |
+
uco-identity:familyName
|
262 |
+
uco-identity:givenName
|
263 |
+
Each uco-core:Role has properties:
|
264 |
+
@id is the role
|
265 |
+
uco-core:name is the role
|
266 |
+
Each uco-core:Role there is a uco-core:Relationship with properties:
|
267 |
+
uco-core:kindofRelationship is "has_Role"
|
268 |
+
uco-core:source connects to the person who has the role
|
269 |
+
uco-core:target connects to uco-core:Role
|
270 |
+
Each engagement:BreadcrumbTrail has property:
|
271 |
+
engagement:hasBreadcrumb connects to uco-types:Thread
|
272 |
+
This uco-types:Thread has property:
|
273 |
+
co:element contains all engagement:Breadcrumb that belong to this engagement:BreadcrumbTrail
|
274 |
+
co:item contains all uco-types:ThreadItem one each for each engagement:Breadcrumb
|
275 |
+
co:size
|
276 |
+
uco-types:threadOriginItem is the uco-types:ThreadItem for the first engagement:Breadcrumb belonging to this engagement:BreadcrumbTrail
|
277 |
+
uco-types:threadTerminalItem is the uco-types:ThreadItem for the last engagement:Breadcrumb belonging to this engagement:BreadcrumbTrail
|
278 |
+
Each engagement:Breadcrumb has the properties:
|
279 |
+
engagement:hasCharacterization which connects to a uco-core:UcoObject with the property:
|
280 |
+
uco-core:description which describes the object characterizing the breadcrumb
|
281 |
+
All classes must include property:
|
282 |
+
@type is the class
|
283 |
+
@id is a unique identifier
|
284 |
+
|
285 |
+
If namespace "engagement" prefix is used then https://ontology.adversaryengagement.org/ae/engagement#
|
286 |
+
If namespace "objective" prefix is used then https://ontology.adversaryengagement.org/ae/objective#
|
287 |
+
If namespace "role" prefix is used then https://ontology.adversaryengagement.org/ae/role#
|
288 |
+
If namespace "identity" prefix is used then https://ontology.adversaryengagement.org/ae/identity#
|
289 |
+
If namespace "uco-core" prefix is used then https://ontology.unifiedcyberontology.org/uco/core#
|
290 |
+
If namespace "uco-types" prefix is used then https://ontology.unifiedcyberontology.org/uco/types#
|
291 |
+
If namespace "uco-role" prefix is used then https://ontology.unifiedcyberontology.org/uco/role#
|
292 |
+
"""
|
293 |
+
return v
|
294 |
+
|
295 |
+
def generate_continue(self):
|
296 |
+
v = """
|
297 |
+
continue
|
298 |
+
"""
|
299 |
+
return v
|
300 |
+
|
301 |
+
def raw_prompt(self,description,jsn=True):
|
302 |
+
def run(val,jsn):
|
303 |
+
if jsn:
|
304 |
+
prompt = f"""Give me a full json-ld format example for the following scenario:
|
305 |
+
{description}
|
306 |
+
|
307 |
+
{"".join(val)}
|
308 |
+
"""
|
309 |
+
else:
|
310 |
+
prompt = f"""
|
311 |
+
{"".join(val)}
|
312 |
+
{description}
|
313 |
+
"""
|
314 |
+
for i in self.ChatGPTTextSplitter(prompt):
|
315 |
+
res = self.llm_api(i)
|
316 |
+
return res
|
317 |
+
|
318 |
+
if not jsn:
|
319 |
+
res_val = run(self.generate_rule(),jsn)
|
320 |
+
return res_val
|
321 |
+
else:
|
322 |
+
res_val = run(self.generate_json_rule(),jsn)
|
323 |
+
try:
|
324 |
+
val = json.loads(res_val)
|
325 |
+
return val
|
326 |
+
except:
|
327 |
+
#the response was cut off, prompt for the continuation.
|
328 |
+
data = []
|
329 |
+
data.append(res_val)
|
330 |
+
while True:
|
331 |
+
res = self.llm_api(self.generate_continue())
|
332 |
+
data.append(res)
|
333 |
+
try:
|
334 |
+
full = "".join(data)
|
335 |
+
return json.loads(full)
|
336 |
+
except:
|
337 |
+
pass
|
338 |
+
|
339 |
+
return None
|
340 |
+
|
341 |
+
def get_ns(self,string):
|
342 |
+
return string.split(":")[0]
|
343 |
+
|
344 |
+
|
345 |
+
def auto_generate(self,planSize:int=3,keywords:str="",nkeywords:str=""):
|
346 |
+
p = f"Generate a deception plan with {planSize} PlannedEvents."
|
347 |
+
if keywords:
|
348 |
+
p+= f"The plan must include specifically {keywords}."
|
349 |
+
if nkeywords:
|
350 |
+
p+= f"Do not include {nkeywords}."
|
351 |
+
#deception plan description
|
352 |
+
e = self.prompt(p,jsn=False)
|
353 |
+
self.description = e
|
354 |
+
#deception plan converted into json
|
355 |
+
w = self.prompt(e,jsn=True)
|
356 |
+
self.json = w
|
357 |
+
return self.json
|
358 |
+
|
359 |
+
def generate_personas(self):
|
360 |
+
if not self.description:
|
361 |
+
raise ValueError("Run auto_generate() or prompt() before attempting to generate persona profiles.")
|
362 |
+
description =f"""{self.description}
|
363 |
+
Generate a believable, detailed, and professional description of each person as if they had a LinkedIn profile with the following configurations:
|
364 |
+
Name
|
365 |
+
Occupation and occupation job title
|
366 |
+
Gender
|
367 |
+
Random configuration from the big five personality traits that fits their occupation and 1 of the 16 Myer-Briggs personality classifications. Do not disclose their configuration or their personality type, write as if they wrote an introduction about themselves and their accomplishments.
|
368 |
+
Education history including graduation year, school, degree
|
369 |
+
Job history with at least 10 active years
|
370 |
+
Rewards that highlight the factitious character's strength
|
371 |
+
A schedule of their activities and active behaviors at work
|
372 |
+
|
373 |
+
"""
|
374 |
+
w = self.prompt(description,jsn=False)
|
375 |
+
self.persona_descriptions = w
|
376 |
+
return w
|
377 |
+
|
378 |
+
|
379 |
+
def prompt(self,description,jsn=True):
|
380 |
+
if not self.description:
|
381 |
+
self.description = description
|
382 |
+
if not jsn:
|
383 |
+
res = self.raw_prompt(description,jsn=jsn)
|
384 |
+
else:
|
385 |
+
res = self.raw_prompt(description)
|
386 |
+
|
387 |
+
#include only relevent namespaces
|
388 |
+
prefixes = []
|
389 |
+
|
390 |
+
def is_nested(LIST):
|
391 |
+
if type(LIST) == list:
|
392 |
+
for JSON in LIST:
|
393 |
+
for key in JSON.keys():
|
394 |
+
if type(JSON[key]) == dict:
|
395 |
+
is_nested(JSON[key])
|
396 |
+
if '@type' in JSON.keys():
|
397 |
+
prefixes.append(self.get_ns(JSON['@type']))
|
398 |
+
else:
|
399 |
+
JSON = LIST
|
400 |
+
for key in JSON.keys():
|
401 |
+
if type(JSON[key]) == dict:
|
402 |
+
is_nested(JSON[key])
|
403 |
+
if '@type' in JSON.keys():
|
404 |
+
prefixes.append(self.get_ns(JSON['@type']))
|
405 |
+
|
406 |
+
|
407 |
+
is_nested(res['@graph'])
|
408 |
+
prefixes = set(prefixes)
|
409 |
+
|
410 |
+
new_prefixes = {}
|
411 |
+
for prefix in prefixes:
|
412 |
+
if prefix in res['@context']:
|
413 |
+
new_prefixes[prefix] = res['@context'][prefix]
|
414 |
+
|
415 |
+
res['@context'] = new_prefixes
|
416 |
+
|
417 |
+
return res
|
aeo_example_generator.py
ADDED
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import openai
|
3 |
+
import json
|
4 |
+
import rdflib
|
5 |
+
|
6 |
+
|
7 |
+
class ExampleGenerator:
|
8 |
+
def __init__(self):
|
9 |
+
self.ontologies = {}
|
10 |
+
self.ontology_files = []
|
11 |
+
self.rules = {}
|
12 |
+
self.description = None
|
13 |
+
def add_ontology(self, onto):
|
14 |
+
if onto in self.ontology_files:
|
15 |
+
raise ValueError("Ontology file already exists.")
|
16 |
+
else:
|
17 |
+
onto_data = self.get_ontology_file(onto)
|
18 |
+
if onto_data:
|
19 |
+
self.ontology_files.append(onto)
|
20 |
+
self.ontologies[onto] = self.get_ontology_file(onto)
|
21 |
+
self.rules[onto] = self.generate_rules(onto)
|
22 |
+
else:
|
23 |
+
raise ValueError("Ontology file error.")
|
24 |
+
def get_ontology_file(self,filename):
|
25 |
+
text = ""
|
26 |
+
if os.path.isfile(filename):
|
27 |
+
with open(filename,'r') as f:
|
28 |
+
text = f.read()
|
29 |
+
f.close()
|
30 |
+
return text
|
31 |
+
else:
|
32 |
+
raise ValueError("Invalid filename.")
|
33 |
+
def ChatGPTTextSplitter(self,text):
|
34 |
+
"""Splits text in smaller subblocks to feed to the LLM"""
|
35 |
+
prompt = f"""The total length of content that I want to send you is too large to send in only one piece.
|
36 |
+
|
37 |
+
For sending you that content, I will follow this rule:
|
38 |
+
|
39 |
+
[START PART 1/10]
|
40 |
+
this is the content of the part 1 out of 10 in total
|
41 |
+
[END PART 1/10]
|
42 |
+
|
43 |
+
Then you just answer: "Instructions Sent."
|
44 |
+
|
45 |
+
And when I tell you "ALL PARTS SENT", then you can continue processing the data and answering my requests.
|
46 |
+
"""
|
47 |
+
if type(text) == str:
|
48 |
+
textsize = 12000
|
49 |
+
blocksize = int(len(text) / textsize)
|
50 |
+
if blocksize > 0:
|
51 |
+
yield prompt
|
52 |
+
|
53 |
+
for b in range(1,blocksize+1):
|
54 |
+
if b < blocksize+1:
|
55 |
+
prompt = f"""Do not answer yet. This is just another part of the text I want to send you. Just receive and acknowledge as "Part {b}/{blocksize} received" and wait for the next part.
|
56 |
+
[START PART {b}/{blocksize}]
|
57 |
+
{text[(b-1)*textsize:b*textsize]}
|
58 |
+
[END PART {b}/{blocksize}]
|
59 |
+
Remember not answering yet. Just acknowledge you received this part with the message "Part {b}/{blocksize} received" and wait for the next part.
|
60 |
+
"""
|
61 |
+
yield prompt
|
62 |
+
else:
|
63 |
+
prompt = f"""
|
64 |
+
[START PART {b}/{blocksize}]
|
65 |
+
{text[(b-1)*textsize:b*textsize]}
|
66 |
+
[END PART {b}/{blocksize}]
|
67 |
+
ALL PARTS SENT. Now you can continue processing the request.
|
68 |
+
"""
|
69 |
+
yield prompt
|
70 |
+
else:
|
71 |
+
yield text
|
72 |
+
elif type(text) == list:
|
73 |
+
yield prompt
|
74 |
+
|
75 |
+
for n,block in enumerate(text):
|
76 |
+
if n+1 < len(text):
|
77 |
+
prompt = f"""Do not answer yet. This is just another part of the text I want to send you. Just receive and acknowledge as "Part {n+1}/{len(text)} received" and wait for the next part.
|
78 |
+
[START PART {n+1}/{len(text)}]
|
79 |
+
{text[n]}
|
80 |
+
[END PART {n+1}/{len(text)}]
|
81 |
+
Remember not answering yet. Just acknowledge you received this part with the message "Part {n+1}/{len(text)} received" and wait for the next part.
|
82 |
+
"""
|
83 |
+
yield prompt
|
84 |
+
else:
|
85 |
+
prompt = f"""
|
86 |
+
[START PART {n+1}/{len(text)}]
|
87 |
+
{text[n]}
|
88 |
+
[END PART {n+1}/{len(text)}]
|
89 |
+
ALL PARTS SENT. Now you can continue processing the request.
|
90 |
+
"""
|
91 |
+
yield prompt
|
92 |
+
|
93 |
+
def send_ontology(self):
|
94 |
+
ontology = ""
|
95 |
+
if len(self.ontologies) > 0:
|
96 |
+
for k,v in self.ontologies.items():
|
97 |
+
ontology+=v+"\n"
|
98 |
+
print("Sending Ontology in Parts")
|
99 |
+
for i in self.ChatGPTTextSplitter(ontology):
|
100 |
+
print(self.llm_api(i))
|
101 |
+
else:
|
102 |
+
raise ValueError("No loaded ontology to send.")
|
103 |
+
def llm_api(self,prompt,model="gpt-3.5-turbo"):
|
104 |
+
messages = [{
|
105 |
+
"role":"user",
|
106 |
+
"content":prompt
|
107 |
+
}]
|
108 |
+
res = openai.ChatCompletion.create(model=model,messages=messages,temperature=0)
|
109 |
+
return res.choices[0].message['content']
|
110 |
+
|
111 |
+
def generate_rule(self,onto=None):
|
112 |
+
"""Raw rule string of AEO."""
|
113 |
+
v = """These are the components that construct the plan:
|
114 |
+
Fake personas - first and last name
|
115 |
+
People can have one of the following DeceptionRoles:
|
116 |
+
adversary
|
117 |
+
defender
|
118 |
+
Identities can take one of the following DeceptionActions:
|
119 |
+
engagement:Access - subject is an identity, predicate is an object
|
120 |
+
engagement:Alert - subject is an identity, predicate is a human identity
|
121 |
+
engagement:Beacon - subject is non-human identities, services, or tools, predicate can be a server, service, tool or an identity
|
122 |
+
engagement:Deploy - subject is human or agent, the predicate must be a DeceptionObject
|
123 |
+
engagement:Obfuscate
|
124 |
+
engagement:Respond
|
125 |
+
There can be one or more DeceptionObjects:
|
126 |
+
engagement:Honeypot
|
127 |
+
engagement:Honeytoken
|
128 |
+
engagement:Breadcrumb
|
129 |
+
engagement:BreadcrumbTrail - this is a set of breadcrumbs
|
130 |
+
engagement:LureObject
|
131 |
+
engagement:HoneyObject
|
132 |
+
engagement:Decoy
|
133 |
+
engagement:DataSource
|
134 |
+
A defender that performs an a DeceptionAction has at least one of the following DefenderObjectives
|
135 |
+
objective:Reconnaissance
|
136 |
+
objective:Affect
|
137 |
+
objective:Collect
|
138 |
+
objective:Detect
|
139 |
+
objective:Direct
|
140 |
+
objective:Disrupt
|
141 |
+
objective:Elicit
|
142 |
+
objective:Expose
|
143 |
+
objective:Motivate
|
144 |
+
objective:Plan
|
145 |
+
objective:Prepare
|
146 |
+
objective:Prevent
|
147 |
+
objective:Reassure
|
148 |
+
objective:Analyze
|
149 |
+
objective:Deny
|
150 |
+
objective:ElicitBehavior
|
151 |
+
objective:Lure
|
152 |
+
objective:TimeSink
|
153 |
+
objective:Track
|
154 |
+
objective:Trap
|
155 |
+
An adversary that performs an a DeceptionAction has at least one of the following AdversaryObjectives
|
156 |
+
objective:CommandAndControl
|
157 |
+
objective:CredentialAccess
|
158 |
+
objective:DevelopResource
|
159 |
+
objective:Discover
|
160 |
+
objective:EscalatePrivilege
|
161 |
+
objective:Evade
|
162 |
+
objective:Execute
|
163 |
+
objective:Exfilitrate
|
164 |
+
objective:GainInitialAccess
|
165 |
+
objective:Impact
|
166 |
+
objective:MoveLaterally
|
167 |
+
objective:Persist
|
168 |
+
objective:Reconnaissance
|
169 |
+
Generate the plan in the following structure:
|
170 |
+
print "Use one engagement:Narrative"
|
171 |
+
print "Use one engagement:Storyline"
|
172 |
+
print "Use the following people:"
|
173 |
+
Enumerate each person's name and DeceptionRole
|
174 |
+
|
175 |
+
Each planned event is centered around a DeceptionAction taken by some identity or person with a DeceptionRole onto a DeceptionObject or Object. Enumerate each planned events where each planned event has a short description and number starting with "Planned Event 1". Describe which person deploys a DeceptionObject, what DeceptionAction they used and what the DefenderObjective or AdversaryObjective of the action or deployed DeceptionObject. The last planned event should conclude that an defender has been alerted that the DeceptionObject was accessed by the adversary.
|
176 |
+
|
177 |
+
Remember to use only given DefenderObjectives, AdversaryObjectives, DeceptionObjects, DeceptionActions, and DeceptionRoles. Do not use any other objectives, objects, actions, or roles other than what is provided. If a person uses an action not from DeceptionActions, then the action is "uco-core:Action" with the name of action.
|
178 |
+
"""
|
179 |
+
return v
|
180 |
+
def generate_json_rule(self,onto=None):
|
181 |
+
"""Raw rule string of AEO."""
|
182 |
+
v = """Remember make a json-ld format example that only uses classes and properties terms from Adversary Engagement Ontology, Unified Cyber Ontology.
|
183 |
+
|
184 |
+
Each engagement:Narrative has property:
|
185 |
+
engagement:hasStoryline connects to an engagement:Storyline
|
186 |
+
Each engagement:Storyline has property:
|
187 |
+
engagement:hasEvent connects to a uco-types:Thread
|
188 |
+
Each uco-types:Thread has properties:
|
189 |
+
co:element contains all engagement:PlannedEvents
|
190 |
+
co:item contains all uco-types:ThreadItem one each for each engagement:PlannedEvent.
|
191 |
+
co:size
|
192 |
+
uco-types:threadOriginItem is the uco-types:ThreadItem for the first engagement:PlannedEvent
|
193 |
+
uco-types:threadTerminalItem is the uco-types:ThreadItem for the last engagement:PlannedEvent
|
194 |
+
Each co:size has properties:
|
195 |
+
@type as xsd:nonNegativeInteger
|
196 |
+
@value which is the number of uco-types:ThreadItem
|
197 |
+
Each uco-types:ThreadItem has property:
|
198 |
+
co:itemContent is the engagement:PlannedEvent
|
199 |
+
optional uco-types:threadNextItem is the next uco-types:ThreadItem for the next engagement:PlannedEvent if there is one,
|
200 |
+
optional uco-types:threadPreviousItem is the previous uco-types:ThreadItem for the previous engagement:PlannedEvent if there is one
|
201 |
+
Each engagement:PlannedEvent has property:
|
202 |
+
engagement:eventContext connects to one engagement action has property @type one of the following:
|
203 |
+
engagement:Access
|
204 |
+
engagement:Alert
|
205 |
+
engagement:Beacon
|
206 |
+
engagement:Deploy
|
207 |
+
engagement:Obfuscate
|
208 |
+
engagement:Respond
|
209 |
+
Each engagement action has properties:
|
210 |
+
@type is the action
|
211 |
+
uco-core:performer
|
212 |
+
uco-core:object connects to one of the following engagement deception object denoted as "EDO" objects:
|
213 |
+
engagement:Honeypot
|
214 |
+
engagement:Honeytoken
|
215 |
+
engagement:Breadcrumb
|
216 |
+
engagement:BreadcrumbTrail
|
217 |
+
engagement:LureObject
|
218 |
+
engagement:HoneyObject
|
219 |
+
engagement:Decoy
|
220 |
+
engagement:DataSource
|
221 |
+
Each "EDO" object has properties:
|
222 |
+
engagement:hasCharacterization connects to a uco-core:UcoObject
|
223 |
+
objective:hasObjective with @type objective:Objective and @id with one of the following instances:
|
224 |
+
objective:CommandAndControl
|
225 |
+
objective:CredentialAccess
|
226 |
+
objective:DevelopResource
|
227 |
+
objective:Discover
|
228 |
+
objective:EscalatePrivilege
|
229 |
+
objective:Evade
|
230 |
+
objective:Execute
|
231 |
+
objective:Exfilitrate
|
232 |
+
objective:GainInitialAccess
|
233 |
+
objective:Impact
|
234 |
+
objective:MoveLaterally
|
235 |
+
objective:Persist
|
236 |
+
objective:Reconnaissance
|
237 |
+
objective:Affect
|
238 |
+
objective:Collect
|
239 |
+
objective:Detect
|
240 |
+
objective:Direct
|
241 |
+
objective:Disrupt
|
242 |
+
objective:Elicit
|
243 |
+
objective:Expose
|
244 |
+
objective:Motivate
|
245 |
+
objective:Plan
|
246 |
+
objective:Prepare
|
247 |
+
objective:Prevent
|
248 |
+
objective:Reassure
|
249 |
+
objective:Analyze
|
250 |
+
objective:Deny
|
251 |
+
objective:ElicitBehavior
|
252 |
+
objective:Lure
|
253 |
+
objective:TimeSink
|
254 |
+
objective:Track
|
255 |
+
objective:Trap
|
256 |
+
uco-core:name is the objective
|
257 |
+
All people have property:
|
258 |
+
@type is uco-identity:Person
|
259 |
+
uco-core:hasFacet that connects to one of the following:
|
260 |
+
uco-identity:SimpleNameFacet which has the property:
|
261 |
+
uco-identity:familyName
|
262 |
+
uco-identity:givenName
|
263 |
+
Each uco-core:Role has properties:
|
264 |
+
@id is the role
|
265 |
+
uco-core:name is the role
|
266 |
+
Each uco-core:Role there is a uco-core:Relationship with properties:
|
267 |
+
uco-core:kindofRelationship is "has_Role"
|
268 |
+
uco-core:source connects to the person who has the role
|
269 |
+
uco-core:target connects to uco-core:Role
|
270 |
+
Each engagement:BreadcrumbTrail has property:
|
271 |
+
engagement:hasBreadcrumb connects to uco-types:Thread
|
272 |
+
This uco-types:Thread has property:
|
273 |
+
co:element contains all engagement:Breadcrumb that belong to this engagement:BreadcrumbTrail
|
274 |
+
co:item contains all uco-types:ThreadItem one each for each engagement:Breadcrumb
|
275 |
+
co:size
|
276 |
+
uco-types:threadOriginItem is the uco-types:ThreadItem for the first engagement:Breadcrumb belonging to this engagement:BreadcrumbTrail
|
277 |
+
uco-types:threadTerminalItem is the uco-types:ThreadItem for the last engagement:Breadcrumb belonging to this engagement:BreadcrumbTrail
|
278 |
+
Each engagement:Breadcrumb has the properties:
|
279 |
+
engagement:hasCharacterization which connects to a uco-core:UcoObject with the property:
|
280 |
+
uco-core:description which describes the object characterizing the breadcrumb
|
281 |
+
All classes must include property:
|
282 |
+
@type is the class
|
283 |
+
@id is a unique identifier
|
284 |
+
|
285 |
+
If namespace "engagement" prefix is used then https://ontology.adversaryengagement.org/ae/engagement#
|
286 |
+
If namespace "objective" prefix is used then https://ontology.adversaryengagement.org/ae/objective#
|
287 |
+
If namespace "role" prefix is used then https://ontology.adversaryengagement.org/ae/role#
|
288 |
+
If namespace "identity" prefix is used then https://ontology.adversaryengagement.org/ae/identity#
|
289 |
+
If namespace "uco-core" prefix is used then https://ontology.unifiedcyberontology.org/uco/core#
|
290 |
+
If namespace "uco-types" prefix is used then https://ontology.unifiedcyberontology.org/uco/types#
|
291 |
+
If namespace "uco-role" prefix is used then https://ontology.unifiedcyberontology.org/uco/role#
|
292 |
+
"""
|
293 |
+
return v
|
294 |
+
|
295 |
+
def generate_continue(self):
|
296 |
+
v = """
|
297 |
+
continue
|
298 |
+
"""
|
299 |
+
return v
|
300 |
+
|
301 |
+
def raw_prompt(self,description,jsn=True):
|
302 |
+
def run(val,jsn):
|
303 |
+
if jsn:
|
304 |
+
prompt = f"""Give me a full json-ld format example for the following scenario:
|
305 |
+
{description}
|
306 |
+
|
307 |
+
{"".join(val)}
|
308 |
+
"""
|
309 |
+
else:
|
310 |
+
prompt = f"""
|
311 |
+
{"".join(val)}
|
312 |
+
{description}
|
313 |
+
"""
|
314 |
+
for i in self.ChatGPTTextSplitter(prompt):
|
315 |
+
res = self.llm_api(i)
|
316 |
+
return res
|
317 |
+
|
318 |
+
if not jsn:
|
319 |
+
res_val = run(self.generate_rule(),jsn)
|
320 |
+
return res_val
|
321 |
+
else:
|
322 |
+
res_val = run(self.generate_json_rule(),jsn)
|
323 |
+
try:
|
324 |
+
val = json.loads(res_val)
|
325 |
+
return val
|
326 |
+
except:
|
327 |
+
#the response was cut off, prompt for the continuation.
|
328 |
+
data = []
|
329 |
+
data.append(res_val)
|
330 |
+
while True:
|
331 |
+
res = self.llm_api(self.generate_continue())
|
332 |
+
data.append(res)
|
333 |
+
try:
|
334 |
+
full = "".join(data)
|
335 |
+
return json.loads(full)
|
336 |
+
except:
|
337 |
+
pass
|
338 |
+
|
339 |
+
return None
|
340 |
+
|
341 |
+
def get_ns(self,string):
|
342 |
+
return string.split(":")[0]
|
343 |
+
|
344 |
+
|
345 |
+
def auto_generate(self,planSize:int=3,keywords:str="",nkeywords:str=""):
|
346 |
+
p = f"Generate a deception plan with {planSize} PlannedEvents."
|
347 |
+
if keywords:
|
348 |
+
p+= f"The plan must include specifically {keywords}."
|
349 |
+
if nkeywords:
|
350 |
+
p+= f"Do not include {nkeywords}."
|
351 |
+
#deception plan description
|
352 |
+
e = self.prompt(p,jsn=False)
|
353 |
+
self.description = e
|
354 |
+
#deception plan converted into json
|
355 |
+
w = self.prompt(e,jsn=True)
|
356 |
+
self.json = w
|
357 |
+
return self.json
|
358 |
+
|
359 |
+
def generate_personas(self):
|
360 |
+
if not self.description:
|
361 |
+
raise ValueError("Run auto_generate() or prompt() before attempting to generate persona profiles.")
|
362 |
+
description =f"""{self.description}
|
363 |
+
Generate a believable, detailed, and professional description of each person as if they had a LinkedIn profile with the following configurations:
|
364 |
+
Name
|
365 |
+
Occupation and occupation job title
|
366 |
+
Gender
|
367 |
+
Random configuration from the big five personality traits that fits their occupation and 1 of the 16 Myer-Briggs personality classifications. Do not disclose their configuration or their personality type, write as if they wrote an introduction about themselves and their accomplishments.
|
368 |
+
Education history including graduation year, school, degree
|
369 |
+
Job history with at least 10 active years
|
370 |
+
Rewards that highlight the factitious character's strength
|
371 |
+
A schedule of their activities and active behaviors at work
|
372 |
+
|
373 |
+
"""
|
374 |
+
w = self.prompt(description,jsn=False)
|
375 |
+
self.persona_descriptions = w
|
376 |
+
return w
|
377 |
+
|
378 |
+
|
379 |
+
def prompt(self,description,jsn=True):
|
380 |
+
if not self.description:
|
381 |
+
self.description = description
|
382 |
+
if not jsn:
|
383 |
+
res = self.raw_prompt(description,jsn=jsn)
|
384 |
+
else:
|
385 |
+
res = self.raw_prompt(description)
|
386 |
+
|
387 |
+
#include only relevent namespaces
|
388 |
+
prefixes = []
|
389 |
+
|
390 |
+
def is_nested(LIST):
|
391 |
+
if type(LIST) == list:
|
392 |
+
for JSON in LIST:
|
393 |
+
for key in JSON.keys():
|
394 |
+
if type(JSON[key]) == dict:
|
395 |
+
is_nested(JSON[key])
|
396 |
+
if '@type' in JSON.keys():
|
397 |
+
prefixes.append(self.get_ns(JSON['@type']))
|
398 |
+
else:
|
399 |
+
JSON = LIST
|
400 |
+
for key in JSON.keys():
|
401 |
+
if type(JSON[key]) == dict:
|
402 |
+
is_nested(JSON[key])
|
403 |
+
if '@type' in JSON.keys():
|
404 |
+
prefixes.append(self.get_ns(JSON['@type']))
|
405 |
+
|
406 |
+
|
407 |
+
is_nested(res['@graph'])
|
408 |
+
prefixes = set(prefixes)
|
409 |
+
|
410 |
+
new_prefixes = {}
|
411 |
+
for prefix in prefixes:
|
412 |
+
if prefix in res['@context']:
|
413 |
+
new_prefixes[prefix] = res['@context'][prefix]
|
414 |
+
|
415 |
+
res['@context'] = new_prefixes
|
416 |
+
|
417 |
+
return res
|
data/chroma.sqlite3
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:81687fffb098ff3950a4143bb89be8c7d051bc24c4ba95a667ad3901ec6d66b5
|
3 |
+
size 2187264
|
data/d1a96671-aee8-491c-a591-df54be606f81/data_level0.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f18abd8c514282db82706e52b0a33ed659cd534e925a6f149deb7af9ce34bd8e
|
3 |
+
size 6284000
|
data/d1a96671-aee8-491c-a591-df54be606f81/header.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:effaa959ce2b30070fdafc2fe82096fc46e4ee7561b75920dd3ce43d09679b21
|
3 |
+
size 100
|
data/d1a96671-aee8-491c-a591-df54be606f81/length.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f51030a50f6bee470c5fc6702c6e43fe48a4bb732a4ed0cd0752b6a994ef47d7
|
3 |
+
size 4000
|
data/d1a96671-aee8-491c-a591-df54be606f81/link_lists.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
|
3 |
+
size 0
|
docs/EngageHandbook-v1.0.pdf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b48dfb9833d4b8152effe2bc39abcf73ad72ca02e1a72636e09c3d1d05b6857b
|
3 |
+
size 1886870
|
docs/SmallBusinessExample.md
ADDED
@@ -0,0 +1,1089 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Small Business Example
|
2 |
+
|
3 |
+
|
4 |
+
```python
|
5 |
+
# This software was produced for the U.S. Government under contract FA8702-23-C-0001,
|
6 |
+
# and is subject to the Rights in Data-General Clause 52.227-14, Alt. IV (DEC 2007)
|
7 |
+
# ©2023 The MITRE Corporation. Published under the Linux Foundation’s Cyber Domain Ontology project’s Apache 2 license.
|
8 |
+
# Released under MITRE PRS 18-4297.
|
9 |
+
```
|
10 |
+
|
11 |
+
After checking out the specific class instantiation tutorial examples such as `Honeypot`, `FluidDeception` and `Breadcrumb`, we believe enumerating through an application example can help our audience understand how AEO can represent and support a deception operation.
|
12 |
+
|
13 |
+
# Premise
|
14 |
+
|
15 |
+
- You are part of a small business called <b> MineralRUs Inc.</b>, which is a small, yet critical mining company in New Hampshire specializing in rare earth elements.
|
16 |
+
- Your main clients are from particular sectors of technology and defense industries, and are considered to be critical infrastructure. Therefore, your business and its operation is essential to the integrity of supply chains enabling those critical infrastructure.
|
17 |
+
- MineralRUs Inc. maintains paper-based record of their key intellectual property and operational procedures, which are stored in a physical safe. This fact is known by only a select few in the company.
|
18 |
+
- Your business has a small, unorganized computer network with only generic security infrastructure, and the company does not have the resources to employ an in-house information security team. Instead, a very small team is tasked with maintaining Operational Technology (OT) systems on the network.
|
19 |
+
|
20 |
+
Your company has recently received an advisory from federal authorities, warning businesses in your industry about the rapidly growing threat of cyber espionage by state-sponsored Advanced Persistent Threats (APTs). In response, your company decides to engage an external cybersecurity provider to assist with timely incident response and prevention. The external provider recommends the employment of active adversary engagement plans, and asks you to develop a high-level deception and denial strategy.
|
21 |
+
|
22 |
+
## Preplanning & Indentifying Assets
|
23 |
+
|
24 |
+
To get started with the planning of this adversary engagement operation, we begin with an existing tool, namely the <b> Fact&Fiction/(D&D) matrix </b>. The original matrix uses Deception & Denial (D&D) technique types as the row header (for more details, see [Heckman, K. E., et al. (2015), Denial and deception in cyber defense.](https://www.researchgate.net/publication/275270540_Denial_and_Deception_in_Cyber_Defense)
|
25 |
+
|
26 |
+
The <b> row header </b> outlines two types of methods that concurrently facilitate adversary engagement: <b>misleading-type methods used to reveal specific information to an adversary and ambiguity-type methods for concealing or denying information from an adversary </b>. The ambiguity-type methods for denial can be used to safe-guard assets through confusion and obfuscation, thus impeding an adversary's efforts to obtain a clear view of relevant resources and access paths. On the other hand, the misleading-type methods aim to induce a desired (mis)perception of the cyber ecosystem through the controlled revelation of real or fabricated information to an adversary.
|
27 |
+
|
28 |
+
|
29 |
+
The <b> column header </b> refers to the <b> value of information </b> an adversary gains from some revealed event. In this specific method, fact is used to describe the asset information and fiction specifically implies the intended (mis)perception of such information.
|
30 |
+
|
31 |
+
|
32 |
+
[remove?] Generally speaking, we do not specify actual values, but comparative concepts such as high-value, low-value or no-value in relationship with the deception operation and the expectation of value an adversary justifies for expending resources for. Extension to numerical values can be done, but is not within the scope of this example.
|
33 |
+
|
34 |
+
|| Deception Operation Mislead-type Methods (Revealing) | Denial Operation Ambiguity-type Methods (Concealing) |
|
35 |
+
|---| --- | --- |
|
36 |
+
|Fact | Network in New Hampshire, business runs a mine in New Hampshire | Business relationships with a specific strategic partner, types of minerals mined given to the strategic partner, process of mineral mining that is essential to the strategic partner, amounts of mined minerals for the strategic partner, company safe location, passcodes, locations of IP keys|
|
37 |
+
|Fiction | low-value IP is stored on the network, contained within falsified, obfuscated files | Most important IP is located in <i> this </i> specific encrypted volume |
|
38 |
+
|
39 |
+
1. The fiction under the Deception Operation column refers to presenting to an adversary that there is low-value intellectual property on the network such as referencing perhaps other types of non-confidential mineral mining processes and outdated contracts with public partners.
|
40 |
+
|
41 |
+
2. The fact under Deception Operation refers to bits of factual but so called friendly information that can help bring realism to the deception operation and allow adversaries to validate some mutual information to minimize inconsistencies in the perception.
|
42 |
+
|
43 |
+
3. The fiction under the Denial Operation refers to giving the adversary the perception that it is in the defender's interest for the network to conceal the location of the IP.
|
44 |
+
|
45 |
+
4. The fact under the Denial Operation refers to the information or assets the strategic partner would like to conceal such as their business relationships and exact details about the mining process and contracted amounts of minerals provided by MineralRUs.
|
46 |
+
|
47 |
+
By enumerating the assets of the business such as the intellectual property located in the safe and business operation details, we directly identify what information we would like to deny an adversary. Building on this analysis, we then decide on the appropriate adversary engagement tools and techniques for our deception and denial needs.
|
48 |
+
|
49 |
+
At this point, we would like to raise a reminder that the AE ontology specializes in the characterization of deception and denial operations, but asset evaluation and risk profiling are outside the scope of this work. Such concepts and processes fall within the purview of the soon-to-come UCO Risk and Cyber Threat Intelligence (CTI) subontologies.
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
## From the Narrative to a Graph
|
54 |
+
|
55 |
+
The Adversary Engagement Ontology provides the structure needed to transform your abstract deception operation plan into graph representation. The degree of how detailed your `Narrative` depends on how extensively refined do you want your preoperation planning to be.
|
56 |
+
|
57 |
+
|
58 |
+
### The Mapping Process
|
59 |
+
|
60 |
+
- 1. Start with a basic more or less static structure. Outline the sequence of planned events for the deception operation. Then comes the following iterative process:
|
61 |
+
- 2.a Select deception techniques and objects according to the intended fiction (cf. Fact&Fiction matrix)
|
62 |
+
- 2.b Evaluate the refinements: Does it deliver your desired fiction in the most feasible, effective and efficient manner?
|
63 |
+
- 2.c If not, repeat 2.a and 2.b until satisfied.
|
64 |
+
|
65 |
+
### Diagram representation
|
66 |
+
|
67 |
+
![SmallBusinessNarrativeExample.drawio.png](SmallBusinessNarrativeExample.drawio.png)
|
68 |
+
|
69 |
+
In this diagram, the `Narrative` has very little `PlannedEvent(s)` within the `Storyline`. That's okay! Not all deception operations need to consider adversaries with straightforward access to the contents and artifacts of a network. Deception operations typically use just a subset of all the deception tools and tricks, particularly since the employment of each additional component comes with additional cost in terms of resources, risk, and operational integrity. In our example scenario of a small business, extremely complex forms of deception are deemed infeasible within their scope of available resources and risk models.
|
70 |
+
|
71 |
+
- The class [`engagement:Honeypot`](https://aeontology.sail-lab.org/docs/class-engagementhoneypot.html) in this use case is used with the specific objective `objective:Direct` to lure an adversary away from the real assets of the network to this fictitious staged location.
|
72 |
+
|
73 |
+
- Staged files are instantiated under the general [`engagement:LureObject`](https://aeontology.sail-lab.org/docs/class-engagementlureobject.html) class, though these can be fully real, partially real or completely facticious files. Furthermore, these `LureObject(s)` are associated with the objective `objective:Exfiltrate` which implies that these files are intended to be taken by an adversary off the network. (More complex representations may include instances associated with attack patterns for an adversary with the same objective.)
|
74 |
+
|
75 |
+
- The method which we plan to be notified whether these files were removed from the network is through a canary token, however one can have other `DataSource(s)` such as a network monitor.
|
76 |
+
|
77 |
+
## Building the JSON-LD:
|
78 |
+
|
79 |
+
1. As with all `Narrative(s)`, we start with instantiating an [`engagement:Narrative`](https://aeontology.sail-lab.org/docs/class-engagementnarrative.html) class which is often referred to as a deception campaign and is the collection of all storylines . We also specify a large-scale operational objective to the Narrative object. This instance of an [`engagement:Narrative`](https://aeontology.sail-lab.org/docs/class-engagementnarrative.html) only has one instance of a [`engagement:Storyline`](https://aeontology.sail-lab.org/docs/class-engagementstoryline.html) attached since we have only developed one plan so far. However, we can model this with multiple `Storyline(s)` if we wanted to separate each falsified file as its own `Storyline`.
|
80 |
+
2. An objective can be attached to describe large-scale operational objectives. Explicit objectives are considered individual, so please remember that!
|
81 |
+
|
82 |
+
|
83 |
+
```python
|
84 |
+
{
|
85 |
+
"@id": "kb:narrative1",
|
86 |
+
"@type": "engagement:Narrative",
|
87 |
+
"engagement:hasStoryline": [
|
88 |
+
{
|
89 |
+
"@id": "kb:storyline1",
|
90 |
+
"@type": "engagement:Storyline",
|
91 |
+
"uco-core:name": "ProtectTheFilesNarrative"
|
92 |
+
}
|
93 |
+
],
|
94 |
+
"objective:hasObjective": [
|
95 |
+
{
|
96 |
+
"@id": "kb:objective1",
|
97 |
+
"@type": "objective:Objective",
|
98 |
+
"uco-core:name": "ProtectTheFiles"
|
99 |
+
}
|
100 |
+
],
|
101 |
+
"uco-core:description": "Grand objective is to lure adversaries or insiders on the network away from details of the mining operations, location and passcode of the safe containing intellectual property."
|
102 |
+
}
|
103 |
+
```
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
{'@id': 'kb:narrative1',
|
109 |
+
'@type': 'engagement:Narrative',
|
110 |
+
'engagement:hasStoryline': [{'@id': 'kb:storyline1',
|
111 |
+
'@type': 'engagement:Storyline',
|
112 |
+
'uco-core:name': 'ProtectTheFilesNarrative'}],
|
113 |
+
'objective:hasObjective': [{'@id': 'kb:objective1',
|
114 |
+
'@type': 'objective:Objective',
|
115 |
+
'uco-core:name': 'ProtectTheFiles'}],
|
116 |
+
'uco-core:description': 'Grand objective is to lure adversaries or insiders on the network away from details of the mining operations, location and passcode of the safe containing intellectual property.'}
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
+
3. Next, to populate the sequence of `PlannedEvent(s)`for a our instance of [`engagement:Storyline`](https://aeontology.sail-lab.org/docs/class-engagementstoryline.html), we add an event, let's call it `kb:Event1`.
|
121 |
+
4. Each instance of [`PlannedEvent`](https://aeontology.sail-lab.org/docs/class-engagementplannedevent.html) is designed to have an action class e.g. `engagement:Deploy` by the [`engagement:eventContext`](https://aeontology.sail-lab.org/docs/prop-engagementeventcontext.html) property. By design, action concepts like `Deploy` can support properties such as `performers`, `object`, `environment` etc because of its parent class `uco-action:Action`.
|
122 |
+
5. In this explicit case, the `object` that is `Deploy`(ed) is an instance of a [`engagement:Honeypot`](https://aeontology.sail-lab.org/docs/class-engagementhoneypot.html) with the specific objective of `objective:Direct`, implying the honeypot is used to direct adversaries to or away from other assets on the network.
|
123 |
+
|
124 |
+
|
125 |
+
```python
|
126 |
+
{
|
127 |
+
"@id": "kb:Event1",
|
128 |
+
"@type": "engagement:PlannedEvent",
|
129 |
+
"engagement:eventContext": [
|
130 |
+
{
|
131 |
+
"@id": "kb:deploy1",
|
132 |
+
"@type": "engagement:Deploy",
|
133 |
+
"uco-action:object": [
|
134 |
+
{
|
135 |
+
"@id": "kb:honeypot1",
|
136 |
+
"@type": "engagement:Honeypot",
|
137 |
+
"uco-core:description": "Fake production server to contain the fabricated files.",
|
138 |
+
"objective:hasObjective": [
|
139 |
+
{
|
140 |
+
"@id": "objective:Direct"
|
141 |
+
}
|
142 |
+
]
|
143 |
+
|
144 |
+
}]
|
145 |
+
}]
|
146 |
+
}
|
147 |
+
```
|
148 |
+
|
149 |
+
|
150 |
+
|
151 |
+
|
152 |
+
{'@id': 'kb:Event1',
|
153 |
+
'@type': 'engagement:PlannedEvent',
|
154 |
+
'engagement:eventContext': [{'@id': 'kb:deploy1',
|
155 |
+
'@type': 'engagement:Deploy',
|
156 |
+
'uco-action:object': [{'@id': 'kb:honeypot1',
|
157 |
+
'@type': 'engagement:Honeypot',
|
158 |
+
'uco-core:description': 'Fake production server to contain the fabricated files.',
|
159 |
+
'objective:hasObjective': [{'@id': 'objective:Direct'}]}]}]}
|
160 |
+
|
161 |
+
|
162 |
+
|
163 |
+
6. Besides an instance of a [`engagement:Honeypot`](https://aeontology.sail-lab.org/docs/class-engagementhoneypot.html) and the CanaryTokenAlert `dataSource`, two deception objects namely the obfuscated, falsified files were deployed during the first `PlannedEvent`. Both files `kb:obffile1` and `kb:obffile2` are an instances of a [`engagement:LureObject`](https://aeontology.sail-lab.org/docs/class-engagementlureobject.html) with the explicit objective `objective:Exfiltrate` of being exfilitrated from the network by adversaries. The first file being false information on the mining procedures used by the business and the second file refers to false passcodes in case the adversary happens to be an insider.
|
164 |
+
|
165 |
+
|
166 |
+
```python
|
167 |
+
{
|
168 |
+
"@id": "kb:obffile1",
|
169 |
+
"@type": "engagement:LureObject",
|
170 |
+
"uco-core:name": "mining-procedure.pdf",
|
171 |
+
"uco-core:description": "Fake file of mining procedures.",
|
172 |
+
"objective:hasObjective": [
|
173 |
+
{
|
174 |
+
"@id": "objective:Exfilitrate"
|
175 |
+
}
|
176 |
+
]
|
177 |
+
},
|
178 |
+
{
|
179 |
+
"@id": "kb:obffile2",
|
180 |
+
"@type": "engagement:LureObject",
|
181 |
+
"uco-core:name": "backup-safe-passcode.pdf",
|
182 |
+
"uco-core:description": "Fake file of safe passcode and physical location of the safe.",
|
183 |
+
"objective:hasObjective": [
|
184 |
+
{
|
185 |
+
"@id": "objective:Exfiltrate"
|
186 |
+
}
|
187 |
+
]
|
188 |
+
}
|
189 |
+
```
|
190 |
+
|
191 |
+
|
192 |
+
|
193 |
+
|
194 |
+
{'@id': 'kb:obffile2',
|
195 |
+
'@type': 'engagement:LureObject',
|
196 |
+
'uco-core:name': 'backup-safe-passcode.pdf',
|
197 |
+
'uco-core:description': 'Fake file of safe passcode and physical location of the safe.',
|
198 |
+
'objective:hasObjective': [{'@id': 'objective:Exfiltrate'}]}
|
199 |
+
|
200 |
+
|
201 |
+
|
202 |
+
7. We also know who is going to `Deploy` the deception objects so we should also include that through the `performer` property.
|
203 |
+
8. We also attach an objective the `Deploy` action.
|
204 |
+
|
205 |
+
|
206 |
+
```python
|
207 |
+
{"uco-action:performer": [
|
208 |
+
{
|
209 |
+
"@id": "kb:person1",
|
210 |
+
"@type": "uco-identity:Person",
|
211 |
+
"uco-core:hasFacet": [
|
212 |
+
{
|
213 |
+
"@id": "kb:RichardRocky",
|
214 |
+
"@type": "identity:SimpleNameFacet",
|
215 |
+
"uco-identity:familyName": "Richard",
|
216 |
+
"uco-identity:givenName": "Rocky"
|
217 |
+
}
|
218 |
+
]
|
219 |
+
}
|
220 |
+
],
|
221 |
+
"objective:hasObjective": [
|
222 |
+
{
|
223 |
+
"@id": "objective:Deploy"
|
224 |
+
}
|
225 |
+
]
|
226 |
+
}
|
227 |
+
```
|
228 |
+
|
229 |
+
|
230 |
+
|
231 |
+
|
232 |
+
{'uco-action:performer': [{'@id': 'kb:person1',
|
233 |
+
'@type': 'uco-identity:Person',
|
234 |
+
'uco-core:hasFacet': [{'@id': 'kb:RichardRocky',
|
235 |
+
'@type': 'identity:SimpleNameFacet',
|
236 |
+
'uco-identity:familyName': 'Richard',
|
237 |
+
'uco-identity:givenName': 'Rocky'}]}],
|
238 |
+
'objective:hasObjective': [{'@id': 'objective:Deploy'}]}
|
239 |
+
|
240 |
+
|
241 |
+
|
242 |
+
9. The first instance of [`PlannedEvent`](https://aeontology.sail-lab.org/docs/class-engagementplannedevent.html) describes the deployment of the deception objects onto the network. Now we continue to what we expect to happen in the next `PlannedEvent` called `kb:Event2`. We left the property [`eventContext`](https://aeontology.sail-lab.org/docs/prop-engagementeventcontext.html) with `...` because this needs to be expanded, but we will get to that in the next step.
|
243 |
+
|
244 |
+
|
245 |
+
```python
|
246 |
+
{
|
247 |
+
"@id": "kb:Event2",
|
248 |
+
"@type": "engagement:PlannedEvent",
|
249 |
+
"engagement:eventContext": [...],
|
250 |
+
"uco-core:name": "adv-exfiltrates-Obfuscated-files"
|
251 |
+
}
|
252 |
+
|
253 |
+
```
|
254 |
+
|
255 |
+
10. The first thing we expect is an action that is partially-observable, but not entirely. In this case, we do not actually know if a file is exfiltrated until we are alerted by our `dataSource` that it recieved a signal from the obfuscated file through the canarytoken. We include an instance of `Alert` to represent the relationship between the CanaryTokenAlert system and the obfuscated files which we are able to deduce.
|
256 |
+
|
257 |
+
|
258 |
+
```python
|
259 |
+
{
|
260 |
+
"@id": "kb:alert0",
|
261 |
+
"@type": "engagement:Alert",
|
262 |
+
"uco-action:performer": [
|
263 |
+
{
|
264 |
+
"@id": "kb:obffile1"
|
265 |
+
},
|
266 |
+
{
|
267 |
+
"@id": "kb:obffile2"
|
268 |
+
},
|
269 |
+
{
|
270 |
+
"@id": "kb:file1",
|
271 |
+
"@type": "uco-observable:File",
|
272 |
+
"uco-core:name": "backup-safe-passcode.pdf",
|
273 |
+
"uco-core:hasFacet": [
|
274 |
+
{
|
275 |
+
"@id": "kb:filefacet1",
|
276 |
+
"@type": "uco-observable:FileFacet",
|
277 |
+
"observable:filename": "backup-safe-passcode.pdf"
|
278 |
+
}
|
279 |
+
]
|
280 |
+
},
|
281 |
+
{
|
282 |
+
"@id": "kb:file2",
|
283 |
+
"@type": "uco-observable:File",
|
284 |
+
"uco-core:name": "mining-procedure.pdf",
|
285 |
+
"uco-core:hasFacet": [
|
286 |
+
{
|
287 |
+
"@id": "kb:filefacet1",
|
288 |
+
"@type": "uco-observable:FileFacet",
|
289 |
+
"observable:filename": "mining-procedure.pdf"
|
290 |
+
}
|
291 |
+
]
|
292 |
+
}
|
293 |
+
],
|
294 |
+
"uco-action:object": [
|
295 |
+
{
|
296 |
+
"@id": "kb:DataSource1",
|
297 |
+
"@type": "engagement:DataSource",
|
298 |
+
"uco-core:name": "CanaryTokenAlert"
|
299 |
+
}
|
300 |
+
]
|
301 |
+
}
|
302 |
+
```
|
303 |
+
|
304 |
+
11. The second thing we expect is to be alerted by some data source. Then, the action class we will use to describe this is an instance of [`Alert`](https://aeontology.sail-lab.org/docs/class-engagementalert.html). The `performer` for this instance of [`Alert`](https://aeontology.sail-lab.org/docs/class-engagementalert.html) is not going to be a person or identity, but rather an [`engagement:DataSource`](https://aeontology.sail-lab.org/docs/class-engagementdatasource.html) we call CanaryTokenAlert.
|
305 |
+
12. The `object` property of `Alert` would be an identity such as a person such as our deployer, Richard Rocky.
|
306 |
+
13. The attached objective to this action is `objective:Detect` because the usage of an alert is to inform a defender or identity of an event.
|
307 |
+
|
308 |
+
|
309 |
+
```python
|
310 |
+
{
|
311 |
+
"@id": "kb:alert1",
|
312 |
+
"@type": "engagement:Alert",
|
313 |
+
"engagement:alertContext": [...],
|
314 |
+
"uco-action:object": [
|
315 |
+
{
|
316 |
+
"@id": "kb:person1"
|
317 |
+
}
|
318 |
+
],
|
319 |
+
"uco-action:performer": [
|
320 |
+
{
|
321 |
+
"@id": "kb:DataSource1",
|
322 |
+
"@type": "engagement:DataSource",
|
323 |
+
"uco-core:name": "CanaryTokenAlert"
|
324 |
+
}
|
325 |
+
]
|
326 |
+
}
|
327 |
+
|
328 |
+
```
|
329 |
+
|
330 |
+
14. We now expand the property `alertContext` to describe what this explicit alert implies about an occurence. By design, we expect to see another action such as `Access` since the alert informed us that one of the falsified files were accessed.
|
331 |
+
15. Unified Cyber Ontology (UCO) explicitly has a class called `uco-observable:File` which we use to instantiate the UCO object itself with an attached facet `uco-observable:FileFacet`. We reference the `kb:obffile1` instance with the property `object`.
|
332 |
+
|
333 |
+
`kb:obffile1`
|
334 |
+
|
335 |
+
|
336 |
+
```python
|
337 |
+
{
|
338 |
+
"engagement:alertContext": [
|
339 |
+
{
|
340 |
+
"@id": "kb:access1",
|
341 |
+
"@type": "engagement:Access",
|
342 |
+
"uco-action:object": [
|
343 |
+
{
|
344 |
+
"@id": "kb:obffile1",
|
345 |
+
},
|
346 |
+
{
|
347 |
+
"@id": "kb:file1",
|
348 |
+
"@type": "uco-observable:File",
|
349 |
+
"uco-core:name": "backup-safe-passcode.pdf",
|
350 |
+
"uco-core:hasFacet": [
|
351 |
+
{
|
352 |
+
"@id": "kb:filefacet1",
|
353 |
+
"@type": "uco-observable:FileFacet",
|
354 |
+
"observable:filename": "backup-safe-passcode.pdf"
|
355 |
+
}
|
356 |
+
]
|
357 |
+
}
|
358 |
+
],
|
359 |
+
"uco-action:performer": [...]
|
360 |
+
}
|
361 |
+
]
|
362 |
+
}
|
363 |
+
```
|
364 |
+
|
365 |
+
16. We then repeat the process for `kb:obffile2`. Additionally, we expect the `performer` of the `Access` action to be a specific person, namely Mary Moroe. This is because she is the only other person that is aware of the physical safe and has a privilege user account that would have user account access to view this file.
|
366 |
+
|
367 |
+
`kb:obffile2`
|
368 |
+
|
369 |
+
|
370 |
+
```python
|
371 |
+
{
|
372 |
+
"engagement:alertContext": [
|
373 |
+
{
|
374 |
+
"@id": "kb:access1",
|
375 |
+
"@type": "engagement:Access",
|
376 |
+
"uco-action:object": [
|
377 |
+
{
|
378 |
+
"@id": "kb:obffile2"
|
379 |
+
},
|
380 |
+
{
|
381 |
+
"@id": "kb:file2",
|
382 |
+
"@type": "uco-observable:File",
|
383 |
+
"uco-core:name": "mining-procedure.pdf",
|
384 |
+
"uco-core:hasFacet": [
|
385 |
+
{
|
386 |
+
"@id": "kb:filefacet1",
|
387 |
+
"@type": "uco-observable:FileFacet",
|
388 |
+
"observable:filename": "mining-procedure.pdf"
|
389 |
+
}
|
390 |
+
]
|
391 |
+
}
|
392 |
+
],
|
393 |
+
"uco-action:performer": [
|
394 |
+
{
|
395 |
+
"@id": "kb:person2",
|
396 |
+
"@type": "uco-identity:Person",
|
397 |
+
"uco-core:hasFacet": [
|
398 |
+
{
|
399 |
+
"@id": "kb:MaryMoroe",
|
400 |
+
"@type": "identity:SimpleNameFacet",
|
401 |
+
"uco-identity:familyName": "Mary",
|
402 |
+
"uco-identity:givenName": "Moroe"
|
403 |
+
}
|
404 |
+
]
|
405 |
+
}
|
406 |
+
]
|
407 |
+
}
|
408 |
+
]
|
409 |
+
}
|
410 |
+
```
|
411 |
+
|
412 |
+
17. Now that the [`PlannedEvent`](https://aeontology.sail-lab.org/docs/class-engagementplannedevent.html) is complete, we now need to ensure that the `PlannedEvent(s)` can be used as a sequence of events tied to the [`engagement:Storyline`](https://aeontology.sail-lab.org/docs/class-engagementstoryline.html). To do this, UCO has a specific class called `uco-types:Thread` which has the structure for supporting the concepts of sequential relationships.
|
413 |
+
|
414 |
+
18. Our explicit instance of [`engagement:Storyline`](https://aeontology.sail-lab.org/docs/class-engagementstoryline.html) uses a property called `hasEvent` to instantiate an instance of `uco-types:Thread`. The important properties of `uco-types:Thread` for our use case are: `co:element`, `co:item`, `co:size`, `uco-types:threadOriginItem`, `uco-types:threadTerminalItem`. We outline the necessary properties and will expand them separately.
|
415 |
+
|
416 |
+
|
417 |
+
```python
|
418 |
+
{
|
419 |
+
"@id": "kb:storyline1",
|
420 |
+
"@type": "engagement:Storyline",
|
421 |
+
"engagement:hasEvent": [
|
422 |
+
{
|
423 |
+
"@id": "kb:eventthread1",
|
424 |
+
"@type": "uco-types:Thread",
|
425 |
+
"co:element": [...],
|
426 |
+
"co:item": [...],
|
427 |
+
"co:size": {...},
|
428 |
+
"uco-types:threadOriginItem": [...],
|
429 |
+
"uco-types:threadTerminalItem": [...]
|
430 |
+
}
|
431 |
+
]
|
432 |
+
}
|
433 |
+
```
|
434 |
+
|
435 |
+
|
436 |
+
|
437 |
+
|
438 |
+
{'@id': 'kb:storyline1',
|
439 |
+
'@type': 'engagement:Storyline',
|
440 |
+
'engagement:hasEvent': [Ellipsis]}
|
441 |
+
|
442 |
+
|
443 |
+
|
444 |
+
`co:element` refers to the elements of the `Thread` so in our case, they reference our instantiated `PlannedEvent(s)`: `kb:Event1` and `kb:Event2`
|
445 |
+
|
446 |
+
|
447 |
+
```python
|
448 |
+
{"co:element": [
|
449 |
+
{
|
450 |
+
"@id": "kb:Event1"
|
451 |
+
},
|
452 |
+
{
|
453 |
+
"@id": "kb:Event2"
|
454 |
+
}
|
455 |
+
] }
|
456 |
+
```
|
457 |
+
|
458 |
+
|
459 |
+
|
460 |
+
|
461 |
+
{'co:element': [{'@id': 'kb:Event1'}, {'@id': 'kb:Event2'}]}
|
462 |
+
|
463 |
+
|
464 |
+
|
465 |
+
`co:item` refers to the event as a thread item itself.
|
466 |
+
|
467 |
+
|
468 |
+
```python
|
469 |
+
{
|
470 |
+
|
471 |
+
"co:item": [
|
472 |
+
{
|
473 |
+
"@id": "kb:event-thread-item1"
|
474 |
+
},
|
475 |
+
{
|
476 |
+
"@id": "kb:event-thread-item2"
|
477 |
+
}
|
478 |
+
]}
|
479 |
+
```
|
480 |
+
|
481 |
+
|
482 |
+
|
483 |
+
|
484 |
+
{'co:item': [{'@id': 'kb:event-thread-item1'},
|
485 |
+
{'@id': 'kb:event-thread-item2'}]}
|
486 |
+
|
487 |
+
|
488 |
+
|
489 |
+
`co:size` refers to the number of thread items in the thread.
|
490 |
+
|
491 |
+
|
492 |
+
```python
|
493 |
+
{ "co:size": {
|
494 |
+
"@type": "xsd:nonNegativeInteger",
|
495 |
+
"@value": "2"
|
496 |
+
}}
|
497 |
+
```
|
498 |
+
|
499 |
+
|
500 |
+
|
501 |
+
|
502 |
+
{'co:size': {'@type': 'xsd:nonNegativeInteger', '@value': '2'}}
|
503 |
+
|
504 |
+
|
505 |
+
|
506 |
+
`uco-types:threadOriginItem` refers to the first thread item or source thread item.
|
507 |
+
|
508 |
+
|
509 |
+
```python
|
510 |
+
{ "uco-types:threadOriginItem": [
|
511 |
+
{
|
512 |
+
"@id": "kb:event-thread-item1"
|
513 |
+
}
|
514 |
+
]}
|
515 |
+
```
|
516 |
+
|
517 |
+
|
518 |
+
|
519 |
+
|
520 |
+
{'uco-types:threadOriginItem': [{'@id': 'kb:event-thread-item1'}]}
|
521 |
+
|
522 |
+
|
523 |
+
|
524 |
+
`uco-types:threadTerminalItem` refers to the last thread item which terminates the sequence of thread items.
|
525 |
+
|
526 |
+
|
527 |
+
```python
|
528 |
+
{
|
529 |
+
"uco-types:threadTerminalItem": [
|
530 |
+
{
|
531 |
+
"@id": "kb:event-thread-item2"
|
532 |
+
}
|
533 |
+
]
|
534 |
+
}
|
535 |
+
```
|
536 |
+
|
537 |
+
|
538 |
+
|
539 |
+
|
540 |
+
{'uco-types:threadTerminalItem': [{'@id': 'kb:event-thread-item2'}]}
|
541 |
+
|
542 |
+
|
543 |
+
|
544 |
+
19. Finally, in the home stretch, we need to use `uco-types:ThreadItem` to create the chain of threads using the `uco-types:threadNextItem` property and `uco-types:threadPreviousItem` property. `kb:Event1` only uses the `threadNextItem` and `kb:Event2` only uses the `threadPreviousItem`.
|
545 |
+
|
546 |
+
`kb:Event1`
|
547 |
+
|
548 |
+
|
549 |
+
```python
|
550 |
+
{
|
551 |
+
"@id": "kb:event-thread-item1",
|
552 |
+
"@type": "uco-types:ThreadItem",
|
553 |
+
"co:itemContent": {
|
554 |
+
"@id": "kb:Event1"
|
555 |
+
},
|
556 |
+
"uco-types:threadNextItem": [
|
557 |
+
{
|
558 |
+
"@id": "kb:event-thread-item2"
|
559 |
+
}
|
560 |
+
]
|
561 |
+
}
|
562 |
+
```
|
563 |
+
|
564 |
+
|
565 |
+
|
566 |
+
|
567 |
+
{'@id': 'kb:event-thread-item1',
|
568 |
+
'@type': 'uco-types:ThreadItem',
|
569 |
+
'co:itemContent': {'@id': 'kb:Event1'},
|
570 |
+
'uco-types:threadNextItem': [{'@id': 'kb:event-thread-item2'}]}
|
571 |
+
|
572 |
+
|
573 |
+
|
574 |
+
`kb:Event2`
|
575 |
+
|
576 |
+
|
577 |
+
```python
|
578 |
+
{
|
579 |
+
"@id": "kb:event-thread-item2",
|
580 |
+
"@type": "uco-types:ThreadItem",
|
581 |
+
"co:itemContent": {
|
582 |
+
"@id": "kb:Event2"
|
583 |
+
},
|
584 |
+
"uco-types:threadPreviousItem": [
|
585 |
+
{
|
586 |
+
"@id": "kb:event-thread-item1"
|
587 |
+
}
|
588 |
+
]
|
589 |
+
}
|
590 |
+
|
591 |
+
```
|
592 |
+
|
593 |
+
|
594 |
+
|
595 |
+
|
596 |
+
{'@id': 'kb:event-thread-item2',
|
597 |
+
'@type': 'uco-types:ThreadItem',
|
598 |
+
'co:itemContent': {'@id': 'kb:Event2'},
|
599 |
+
'uco-types:threadPreviousItem': [{'@id': 'kb:event-thread-item1'}]}
|
600 |
+
|
601 |
+
|
602 |
+
|
603 |
+
And voila! Your adversary engagement plan is now fully represented in a standardized knowledge graph using the AE ontology.
|
604 |
+
|
605 |
+
# Querying a Graph
|
606 |
+
|
607 |
+
Now that we have a fully functional example which we can insert into a graph database, let's test some queries. We'll work with logistics for the narrative which can help in the development of more variance and variety of deception techniques used within the `Narrative`
|
608 |
+
|
609 |
+
|
610 |
+
```python
|
611 |
+
import rdflib
|
612 |
+
g = rdflib.Graph()
|
613 |
+
narrative_example = "SmallBusinessExample.jsonld"
|
614 |
+
g.parse(narrative_example)
|
615 |
+
```
|
616 |
+
|
617 |
+
|
618 |
+
|
619 |
+
|
620 |
+
<Graph identifier=N3f6735a044f846e19ecfecb90e0d2179 (<class 'rdflib.graph.Graph'>)>
|
621 |
+
|
622 |
+
|
623 |
+
|
624 |
+
## [Q] How many deception objects were instantiated with the objective `engagement:Exfiltrate`?
|
625 |
+
|
626 |
+
It may be useful to know how many deception objects were deployed with the objective to be exfiltrated. For our example, it is relatively easy to deploy more obfuscated files on a network than scale up the number of highly functional honeypots on a network, therefore perhaps in a revision of the deception plan, more falsified files are placed on the network for more visibility.
|
627 |
+
|
628 |
+
|
629 |
+
```python
|
630 |
+
query = """
|
631 |
+
PREFIX co: <http://purl.org/co/>
|
632 |
+
PREFIX kb: <http://example.org/kb/>
|
633 |
+
PREFIX engagement: <https://ontology.adversaryengagement.org/ae/engagement/>
|
634 |
+
PREFIX objective: <https://ontology.adversaryengagement.org/ae/objective/>
|
635 |
+
|
636 |
+
|
637 |
+
SELECT (COUNT(DISTINCT ?s) as ?count)
|
638 |
+
|
639 |
+
WHERE {
|
640 |
+
?s objective:hasObjective ?o .
|
641 |
+
?s ?p objective:Exfiltrate .
|
642 |
+
}
|
643 |
+
"""
|
644 |
+
for row in g.query(query):
|
645 |
+
print(row)
|
646 |
+
```
|
647 |
+
|
648 |
+
(rdflib.term.Literal('2', datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#integer')),)
|
649 |
+
|
650 |
+
|
651 |
+
## [Q] What are the distinct objectives used during planned events that deployed objects?
|
652 |
+
|
653 |
+
It may also be useful to know whether or not our deception operation uses a wide variety of techniques based on their objective. If we know specific characteristics of an adversary such as their attack pattern preferences, we may wish to diversify our plan or simulate a network environment that caters to their preferences for false sense of security.
|
654 |
+
|
655 |
+
|
656 |
+
```python
|
657 |
+
query = """
|
658 |
+
PREFIX co: <http://purl.org/co/>
|
659 |
+
PREFIX kb: <http://example.org/kb/>
|
660 |
+
PREFIX engagement: <https://ontology.adversaryengagement.org/ae/engagement/>
|
661 |
+
PREFIX objective: <https://ontology.adversaryengagement.org/ae/objective/>
|
662 |
+
|
663 |
+
|
664 |
+
SELECT DISTINCT ?obj
|
665 |
+
|
666 |
+
WHERE {
|
667 |
+
?allevents engagement:eventContext ?action .
|
668 |
+
?action ?p engagement:Deploy .
|
669 |
+
?event ?y ?action .
|
670 |
+
?event engagement:eventContext ?action .
|
671 |
+
?action ?has ?object .
|
672 |
+
?object objective:hasObjective ?obj .
|
673 |
+
}
|
674 |
+
"""
|
675 |
+
for row in g.query(query):
|
676 |
+
print(row)
|
677 |
+
```
|
678 |
+
|
679 |
+
(rdflib.term.URIRef('https://ontology.adversaryengagement.org/ae/objective/Direct'),)
|
680 |
+
(rdflib.term.URIRef('https://ontology.adversaryengagement.org/ae/objective/Exfilitrate'),)
|
681 |
+
|
682 |
+
|
683 |
+
### Full JSON-LD Format
|
684 |
+
|
685 |
+
|
686 |
+
```python
|
687 |
+
{
|
688 |
+
"@context": {
|
689 |
+
"co": "http://purl.org/co/",
|
690 |
+
"engagement": "https://ontology.adversaryengagement.org/ae/engagement/",
|
691 |
+
"objective": "https://ontology.adversaryengagement.org/ae/objective/",
|
692 |
+
"role": "https://ontology.adversaryengagement.org/ae/role/",
|
693 |
+
"kb": "http://example.org/kb/",
|
694 |
+
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
695 |
+
"uco-action": "https://ontology.unifiedcyberontology.org/uco/action/",
|
696 |
+
"uco-core": "https://ontology.unifiedcyberontology.org/uco/core/",
|
697 |
+
"uco-identity": "https://ontology.unifiedcyberontology.org/uco/identity/",
|
698 |
+
"uco-observable": "https://ontology.unifiedcyberontology.org/uco/observable/",
|
699 |
+
"uco-types": "https://ontology.unifiedcyberontology.org/uco/types/",
|
700 |
+
"xsd": "http://www.w3.org/2001/XMLSchema#"
|
701 |
+
},
|
702 |
+
"@graph": [
|
703 |
+
{
|
704 |
+
"@id": "kb:narrative1",
|
705 |
+
"@type": "engagement:Narrative",
|
706 |
+
"engagement:hasStoryline": [
|
707 |
+
{
|
708 |
+
"@id": "kb:storyline1",
|
709 |
+
"@type": "engagement:Storyline",
|
710 |
+
"uco-core:name": "ProtectTheFilesNarrative"
|
711 |
+
}
|
712 |
+
],
|
713 |
+
"objective:hasObjective": [
|
714 |
+
{
|
715 |
+
"@id": "kb:objective1",
|
716 |
+
"@type": "objective:Objective",
|
717 |
+
"uco-core:name": "ProtectTheFiles"
|
718 |
+
}
|
719 |
+
],
|
720 |
+
"uco-core:description": "Grand objective is to lure adversaries or insiders on the network away from details of the mining operations, location and passcode of the safe containing intellectual property."
|
721 |
+
},
|
722 |
+
{
|
723 |
+
"@id": "kb:Event1",
|
724 |
+
"@type": "engagement:PlannedEvent",
|
725 |
+
"engagement:eventContext": [
|
726 |
+
{
|
727 |
+
"@id": "kb:deploy1",
|
728 |
+
"@type": "engagement:Deploy",
|
729 |
+
"uco-action:object": [
|
730 |
+
{
|
731 |
+
"@id": "kb:honeypot1",
|
732 |
+
"@type": "engagement:Honeypot",
|
733 |
+
"uco-core:description": "Fake production server to contain the fabricated files.",
|
734 |
+
"objective:hasObjective": [
|
735 |
+
{
|
736 |
+
"@id": "objective:Direct"
|
737 |
+
}
|
738 |
+
]
|
739 |
+
|
740 |
+
},
|
741 |
+
{
|
742 |
+
"@id": "kb:obffile1",
|
743 |
+
"@type": "engagement:LureObject",
|
744 |
+
"uco-core:name": "mining-procedure.pdf",
|
745 |
+
"uco-core:description": "ADO file of mining procedures.",
|
746 |
+
"objective:hasObjective": [
|
747 |
+
{
|
748 |
+
"@id": "objective:Exfiltrate"
|
749 |
+
}
|
750 |
+
]
|
751 |
+
},
|
752 |
+
{
|
753 |
+
"@id": "kb:obffile2",
|
754 |
+
"@type": "engagement:LureObject",
|
755 |
+
"uco-core:name": "backup-safe-passcode.pdf",
|
756 |
+
"uco-core:description": "ADO file of safe passcode and physical location of the safe.",
|
757 |
+
"objective:hasObjective": [
|
758 |
+
{
|
759 |
+
"@id": "objective:Exfiltrate"
|
760 |
+
}
|
761 |
+
]
|
762 |
+
}
|
763 |
+
],
|
764 |
+
"uco-action:performer": [
|
765 |
+
{
|
766 |
+
"@id": "kb:person1",
|
767 |
+
"@type": "uco-identity:Person",
|
768 |
+
"uco-core:hasFacet": [
|
769 |
+
{
|
770 |
+
"@id": "kb:RichardRocky",
|
771 |
+
"@type": "identity:SimpleNameFacet",
|
772 |
+
"uco-identity:familyName": "Richard",
|
773 |
+
"uco-identity:givenName": "Rocky"
|
774 |
+
}
|
775 |
+
]
|
776 |
+
}
|
777 |
+
]
|
778 |
+
}
|
779 |
+
],
|
780 |
+
"objective:hasObjective": [
|
781 |
+
{
|
782 |
+
"@id": "objective:Deploy"
|
783 |
+
}
|
784 |
+
],
|
785 |
+
"uco-core:name": "def-deploy-deception-objects"
|
786 |
+
},
|
787 |
+
{
|
788 |
+
"@id": "kb:Event2",
|
789 |
+
"@type": "engagement:PlannedEvent",
|
790 |
+
"engagement:eventContext": [
|
791 |
+
{
|
792 |
+
"@id": "kb:alert0",
|
793 |
+
"@type": "engagement:Alert",
|
794 |
+
"uco-action:performer": [
|
795 |
+
{
|
796 |
+
"@id": "kb:obffile1"
|
797 |
+
},
|
798 |
+
{
|
799 |
+
"@id": "kb:obffile2"
|
800 |
+
},
|
801 |
+
{
|
802 |
+
"@id": "kb:file1",
|
803 |
+
"@type": "uco-observable:File",
|
804 |
+
"uco-core:name": "backup-safe-passcode.pdf",
|
805 |
+
"uco-core:hasFacet": [
|
806 |
+
{
|
807 |
+
"@id": "kb:filefacet1",
|
808 |
+
"@type": "uco-observable:FileFacet",
|
809 |
+
"observable:filename": "backup-safe-passcode.pdf"
|
810 |
+
}
|
811 |
+
]
|
812 |
+
},
|
813 |
+
{
|
814 |
+
"@id": "kb:file2",
|
815 |
+
"@type": "uco-observable:File",
|
816 |
+
"uco-core:name": "mining-procedure.pdf",
|
817 |
+
"uco-core:hasFacet": [
|
818 |
+
{
|
819 |
+
"@id": "kb:filefacet1",
|
820 |
+
"@type": "uco-observable:FileFacet",
|
821 |
+
"observable:filename": "mining-procedure.pdf"
|
822 |
+
}
|
823 |
+
]
|
824 |
+
}
|
825 |
+
],
|
826 |
+
"uco-action:object": [
|
827 |
+
{
|
828 |
+
"@id": "kb:DataSource1",
|
829 |
+
"@type": "engagement:DataSource",
|
830 |
+
"uco-core:name": "CanaryTokenAlert"
|
831 |
+
}
|
832 |
+
]
|
833 |
+
},
|
834 |
+
|
835 |
+
|
836 |
+
{
|
837 |
+
"@id": "kb:alert1",
|
838 |
+
"@type": "engagement:Alert",
|
839 |
+
"engagement:alertContext": [
|
840 |
+
{
|
841 |
+
"@id": "kb:access1",
|
842 |
+
"@type": "engagement:Access",
|
843 |
+
"uco-action:object": [
|
844 |
+
{
|
845 |
+
"@id": "kb:obffile1"
|
846 |
+
},
|
847 |
+
{
|
848 |
+
"@id": "kb:obffile2"
|
849 |
+
},
|
850 |
+
{
|
851 |
+
"@id": "kb:file1",
|
852 |
+
"@type": "uco-observable:File",
|
853 |
+
"uco-core:name": "backup-safe-passcode.pdf",
|
854 |
+
"uco-core:hasFacet": [
|
855 |
+
{
|
856 |
+
"@id": "kb:filefacet1",
|
857 |
+
"@type": "uco-observable:FileFacet",
|
858 |
+
"observable:filename": "backup-safe-passcode.pdf"
|
859 |
+
}
|
860 |
+
]
|
861 |
+
},
|
862 |
+
{
|
863 |
+
"@id": "kb:file2",
|
864 |
+
"@type": "uco-observable:File",
|
865 |
+
"uco-core:name": "mining-procedure.pdf",
|
866 |
+
"uco-core:hasFacet": [
|
867 |
+
{
|
868 |
+
"@id": "kb:filefacet1",
|
869 |
+
"@type": "uco-observable:FileFacet",
|
870 |
+
"observable:filename": "mining-procedure.pdf"
|
871 |
+
}
|
872 |
+
]
|
873 |
+
}
|
874 |
+
],
|
875 |
+
"uco-action:performer": [
|
876 |
+
{
|
877 |
+
"@id": "kb:person2",
|
878 |
+
"@type": "uco-identity:Person",
|
879 |
+
"uco-core:hasFacet": [
|
880 |
+
{
|
881 |
+
"@id": "kb:MaryMoroe",
|
882 |
+
"@type": "identity:SimpleNameFacet",
|
883 |
+
"uco-identity:familyName": "Mary",
|
884 |
+
"uco-identity:givenName": "Moroe"
|
885 |
+
}
|
886 |
+
]
|
887 |
+
}
|
888 |
+
]
|
889 |
+
}
|
890 |
+
],
|
891 |
+
"uco-action:object": [
|
892 |
+
{
|
893 |
+
"@id": "kb:person1"
|
894 |
+
}
|
895 |
+
],
|
896 |
+
"uco-action:performer": [
|
897 |
+
{
|
898 |
+
"@id": "kb:DataSource1",
|
899 |
+
"@type": "engagement:DataSource",
|
900 |
+
"uco-core:name": "CanaryTokenAlert"
|
901 |
+
}
|
902 |
+
]
|
903 |
+
}
|
904 |
+
],
|
905 |
+
"objective:hasObjective": [
|
906 |
+
{
|
907 |
+
"@id": "objective:Detect"
|
908 |
+
}
|
909 |
+
],
|
910 |
+
"uco-core:name": "adv-exfiltrates-Obfuscated-files"
|
911 |
+
},
|
912 |
+
|
913 |
+
{
|
914 |
+
"@id": "kb:storyline1",
|
915 |
+
"@type": "engagement:Storyline",
|
916 |
+
"engagement:hasEvent": [
|
917 |
+
{
|
918 |
+
"@id": "kb:eventthread1",
|
919 |
+
"@type": "uco-types:Thread",
|
920 |
+
"co:element": [
|
921 |
+
{
|
922 |
+
"@id": "kb:Event1"
|
923 |
+
},
|
924 |
+
{
|
925 |
+
"@id": "kb:Event2"
|
926 |
+
}
|
927 |
+
],
|
928 |
+
"co:item": [
|
929 |
+
{
|
930 |
+
"@id": "kb:event-thread-item1"
|
931 |
+
},
|
932 |
+
{
|
933 |
+
"@id": "kb:event-thread-item2"
|
934 |
+
}
|
935 |
+
],
|
936 |
+
"co:size": {
|
937 |
+
"@type": "xsd:nonNegativeInteger",
|
938 |
+
"@value": "2"
|
939 |
+
},
|
940 |
+
"uco-types:threadOriginItem": [
|
941 |
+
{
|
942 |
+
"@id": "kb:event-thread-item1"
|
943 |
+
}
|
944 |
+
],
|
945 |
+
"uco-types:threadTerminalItem": [
|
946 |
+
{
|
947 |
+
"@id": "kb:event-thread-item2"
|
948 |
+
}
|
949 |
+
]
|
950 |
+
}
|
951 |
+
]
|
952 |
+
},
|
953 |
+
{
|
954 |
+
"@id": "kb:event-thread-item1",
|
955 |
+
"@type": "uco-types:ThreadItem",
|
956 |
+
"co:itemContent": {
|
957 |
+
"@id": "kb:Event1"
|
958 |
+
},
|
959 |
+
"uco-types:threadNextItem": [
|
960 |
+
{
|
961 |
+
"@id": "kb:event-thread-item2"
|
962 |
+
}
|
963 |
+
]
|
964 |
+
},
|
965 |
+
{
|
966 |
+
"@id": "kb:event-thread-item2",
|
967 |
+
"@type": "uco-types:ThreadItem",
|
968 |
+
"co:itemContent": {
|
969 |
+
"@id": "kb:Event2"
|
970 |
+
},
|
971 |
+
"uco-types:threadPreviousItem": [
|
972 |
+
{
|
973 |
+
"@id": "kb:event-thread-item1"
|
974 |
+
}
|
975 |
+
]
|
976 |
+
}
|
977 |
+
]
|
978 |
+
}
|
979 |
+
|
980 |
+
```
|
981 |
+
|
982 |
+
|
983 |
+
|
984 |
+
|
985 |
+
{'@context': {'co': 'http://purl.org/co/',
|
986 |
+
'engagement': 'https://ontology.adversaryengagement.org/ae/engagement/',
|
987 |
+
'objective': 'https://ontology.adversaryengagement.org/ae/objective/',
|
988 |
+
'role': 'https://ontology.adversaryengagement.org/ae/role/',
|
989 |
+
'kb': 'http://example.org/kb/',
|
990 |
+
'rdfs': 'http://www.w3.org/2000/01/rdf-schema#',
|
991 |
+
'uco-action': 'https://ontology.unifiedcyberontology.org/uco/action/',
|
992 |
+
'uco-core': 'https://ontology.unifiedcyberontology.org/uco/core/',
|
993 |
+
'uco-identity': 'https://ontology.unifiedcyberontology.org/uco/identity/',
|
994 |
+
'uco-observable': 'https://ontology.unifiedcyberontology.org/uco/observable/',
|
995 |
+
'uco-types': 'https://ontology.unifiedcyberontology.org/uco/types/',
|
996 |
+
'xsd': 'http://www.w3.org/2001/XMLSchema#'},
|
997 |
+
'@graph': [{'@id': 'kb:narrative1',
|
998 |
+
'@type': 'engagement:Narrative',
|
999 |
+
'engagement:hasStoryline': [{'@id': 'kb:storyline1',
|
1000 |
+
'@type': 'engagement:Storyline',
|
1001 |
+
'uco-core:name': 'ProtectTheFilesNarrative'}],
|
1002 |
+
'objective:hasObjective': [{'@id': 'kb:objective1',
|
1003 |
+
'@type': 'objective:Objective',
|
1004 |
+
'uco-core:name': 'ProtectTheFiles'}],
|
1005 |
+
'uco-core:description': 'Grand objective is to lure adversaries or insiders on the network away from details of the mining operations, location and passcode of the safe containing intellectual property.'},
|
1006 |
+
{'@id': 'kb:Event1',
|
1007 |
+
'@type': 'engagement:PlannedEvent',
|
1008 |
+
'engagement:eventContext': [{'@id': 'kb:deploy1',
|
1009 |
+
'@type': 'engagement:Deploy',
|
1010 |
+
'uco-action:object': [{'@id': 'kb:honeypot1',
|
1011 |
+
'@type': 'engagement:Honeypot',
|
1012 |
+
'uco-core:description': 'Fake production server to contain the fabricated files.',
|
1013 |
+
'objective:hasObjective': [{'@id': 'objective:Direct'}]},
|
1014 |
+
{'@id': 'kb:obffile1',
|
1015 |
+
'@type': 'engagement:LureObject',
|
1016 |
+
'uco-core:name': 'mining-procedure.pdf',
|
1017 |
+
'uco-core:description': 'ADO file of mining procedures.',
|
1018 |
+
'objective:hasObjective': [{'@id': 'objective:exfiltrate'}]},
|
1019 |
+
{'@id': 'kb:obffile2',
|
1020 |
+
'@type': 'engagement:LureObject',
|
1021 |
+
'uco-core:name': 'backup-safe-passcode.pdf',
|
1022 |
+
'uco-core:description': 'ADO file of safe passcode and physical location of the safe.',
|
1023 |
+
'objective:hasObjective': [{'@id': 'objective:exfiltrate'}]}],
|
1024 |
+
'uco-action:performer': [{'@id': 'kb:person1',
|
1025 |
+
'@type': 'uco-identity:Person',
|
1026 |
+
'uco-core:hasFacet': [{'@id': 'kb:RichardRocky',
|
1027 |
+
'@type': 'identity:SimpleNameFacet',
|
1028 |
+
'uco-identity:familyName': 'Richard',
|
1029 |
+
'uco-identity:givenName': 'Rocky'}]}]}],
|
1030 |
+
'objective:hasObjective': [{'@id': 'objective:Deploy'}],
|
1031 |
+
'uco-core:name': 'def-deploy-deception-objects'},
|
1032 |
+
{'@id': 'kb:Event2',
|
1033 |
+
'@type': 'engagement:PlannedEvent',
|
1034 |
+
'engagement:eventContext': [{'@id': 'kb:alert1',
|
1035 |
+
'@type': 'engagement:Alert',
|
1036 |
+
'engagement:alertContext': [{'@id': 'kb:access1',
|
1037 |
+
'@type': 'engagement:Access',
|
1038 |
+
'uco-action:object': [{'@id': 'kb:obffile1'},
|
1039 |
+
{'@id': 'kb:obffile2'},
|
1040 |
+
{'@id': 'kb:file1',
|
1041 |
+
'@type': 'uco-observable:File',
|
1042 |
+
'uco-core:name': 'backup-safe-passcode.pdf',
|
1043 |
+
'uco-core:hasFacet': [{'@id': 'kb:filefacet1',
|
1044 |
+
'@type': 'uco-observable:FileFacet',
|
1045 |
+
'observable:filename': 'backup-safe-passcode.pdf'}]},
|
1046 |
+
{'@id': 'kb:file2',
|
1047 |
+
'@type': 'uco-observable:File',
|
1048 |
+
'uco-core:name': 'mining-procedure.pdf',
|
1049 |
+
'uco-core:hasFacet': [{'@id': 'kb:filefacet1',
|
1050 |
+
'@type': 'uco-observable:FileFacet',
|
1051 |
+
'observable:filename': 'mining-procedure.pdf'}]}],
|
1052 |
+
'uco-action:performer': [{'@id': 'kb:person2',
|
1053 |
+
'@type': 'uco-identity:Person',
|
1054 |
+
'uco-core:hasFacet': [{'@id': 'kb:MaryMoroe',
|
1055 |
+
'@type': 'identity:SimpleNameFacet',
|
1056 |
+
'uco-identity:familyName': 'Mary',
|
1057 |
+
'uco-identity:givenName': 'Moroe'}]}]}],
|
1058 |
+
'uco-action:object': [{'@id': 'kb:person1'}],
|
1059 |
+
'uco-action:performer': [{'@id': 'kb:DataSource1',
|
1060 |
+
'@type': 'engagement:DataSource',
|
1061 |
+
'uco-core:name': 'CanaryTokenAlert'}]}],
|
1062 |
+
'objective:hasObjective': [{'@id': 'objective:Detect'}],
|
1063 |
+
'uco-core:name': 'adv-exfiltrates-Obfuscated-files'},
|
1064 |
+
{'@id': 'kb:storyline1',
|
1065 |
+
'@type': 'engagement:Storyline',
|
1066 |
+
'engagement:hasEvent': [{'@id': 'kb:eventthread1',
|
1067 |
+
'@type': 'uco-types:Thread',
|
1068 |
+
'co:element': [{'@id': 'kb:Event1'}, {'@id': 'kb:Event2'}],
|
1069 |
+
'co:item': [{'@id': 'kb:event-thread-item1'},
|
1070 |
+
{'@id': 'kb:event-thread-item2'}],
|
1071 |
+
'co:size': {'@type': 'xsd:nonNegativeInteger', '@value': '2'},
|
1072 |
+
'uco-types:threadOriginItem': [{'@id': 'kb:event-thread-item1'}],
|
1073 |
+
'uco-types:threadTerminalItem': [{'@id': 'kb:event-thread-item2'}]}]},
|
1074 |
+
{'@id': 'kb:event-thread-item1',
|
1075 |
+
'@type': 'uco-types:ThreadItem',
|
1076 |
+
'co:itemContent': {'@id': 'kb:Event1'},
|
1077 |
+
'uco-types:threadNextItem': [{'@id': 'kb:event-thread-item2'}]},
|
1078 |
+
{'@id': 'kb:event-thread-item2',
|
1079 |
+
'@type': 'uco-types:ThreadItem',
|
1080 |
+
'co:itemContent': {'@id': 'kb:Event2'},
|
1081 |
+
'uco-types:threadPreviousItem': [{'@id': 'kb:event-thread-item1'}]}]}
|
1082 |
+
|
1083 |
+
|
1084 |
+
|
1085 |
+
Note: Objectives are considered individual and, as such, will not be found under any classes in the documentation. For more details on the AE Ontology Documentation, please [click here](https://aeontology.sail-lab.org/docs/index.html). The UCO Documentation can be accessed from this [link.](https://unifiedcyberontology.org/releases/0.7.0/docs/index.html)
|
1086 |
+
|
1087 |
+
|
1088 |
+
The aforementioned examples are based on the latest release of AE Ontology version 0.1.8. It should be noted that the AE Ontology will continue to incorporate additive improvements, which may involve the inclusion of new classes and the removal of old concepts, potentially affecting the existing examples. We recommend checking the [latest release](https://aeontology.sail-lab.org/release/) news on [AE ontology website](https://aeontology.sail-lab.org/) to ensure you have access to the most up-to-date information. Additionally, supplementary examples can be found in the GitHub [`examples`](https://github.com/UNHSAILLab/Adversary-Engagement-Ontology/tree/main/examples) directory. Lastly, if you have any inquiries, please do not hesitate to contact us through this [contact form](https://aeontology.sail-lab.org/contact/).
|
1089 |
+
|
docs/aeo_example_generator.py
ADDED
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import openai
|
3 |
+
import json
|
4 |
+
import rdflib
|
5 |
+
|
6 |
+
|
7 |
+
class ExampleGenerator:
|
8 |
+
def __init__(self):
|
9 |
+
self.ontologies = {}
|
10 |
+
self.ontology_files = []
|
11 |
+
self.rules = {}
|
12 |
+
def add_ontology(self, onto):
|
13 |
+
if onto in self.ontology_files:
|
14 |
+
raise ValueError("Ontology file already exists.")
|
15 |
+
else:
|
16 |
+
onto_data = self.get_ontology_file(onto)
|
17 |
+
if onto_data:
|
18 |
+
self.ontology_files.append(onto)
|
19 |
+
self.ontologies[onto] = self.get_ontology_file(onto)
|
20 |
+
self.rules[onto] = self.generate_rules(onto)
|
21 |
+
else:
|
22 |
+
raise ValueError("Ontology file error.")
|
23 |
+
def get_ontology_file(self,filename):
|
24 |
+
text = ""
|
25 |
+
if os.path.isfile(filename):
|
26 |
+
with open(filename,'r') as f:
|
27 |
+
text = f.read()
|
28 |
+
f.close()
|
29 |
+
return text
|
30 |
+
else:
|
31 |
+
raise ValueError("Invalid filename.")
|
32 |
+
def ChatGPTTextSplitter(self,text):
|
33 |
+
"""Splits text in smaller subblocks to feed to the LLM"""
|
34 |
+
prompt = f"""The total length of content that I want to send you is too large to send in only one piece.
|
35 |
+
|
36 |
+
For sending you that content, I will follow this rule:
|
37 |
+
|
38 |
+
[START PART 1/10]
|
39 |
+
this is the content of the part 1 out of 10 in total
|
40 |
+
[END PART 1/10]
|
41 |
+
|
42 |
+
Then you just answer: "Instructions Sent."
|
43 |
+
|
44 |
+
And when I tell you "ALL PARTS SENT", then you can continue processing the data and answering my requests.
|
45 |
+
"""
|
46 |
+
if type(text) == str:
|
47 |
+
textsize = 12000
|
48 |
+
blocksize = int(len(text) / textsize)
|
49 |
+
if blocksize > 0:
|
50 |
+
yield prompt
|
51 |
+
|
52 |
+
for b in range(1,blocksize+1):
|
53 |
+
if b < blocksize+1:
|
54 |
+
prompt = f"""Do not answer yet. This is just another part of the text I want to send you. Just receive and acknowledge as "Part {b}/{blocksize} received" and wait for the next part.
|
55 |
+
[START PART {b}/{blocksize}]
|
56 |
+
{text[(b-1)*textsize:b*textsize]}
|
57 |
+
[END PART {b}/{blocksize}]
|
58 |
+
Remember not answering yet. Just acknowledge you received this part with the message "Part {b}/{blocksize} received" and wait for the next part.
|
59 |
+
"""
|
60 |
+
yield prompt
|
61 |
+
else:
|
62 |
+
prompt = f"""
|
63 |
+
[START PART {b}/{blocksize}]
|
64 |
+
{text[(b-1)*textsize:b*textsize]}
|
65 |
+
[END PART {b}/{blocksize}]
|
66 |
+
ALL PARTS SENT. Now you can continue processing the request.
|
67 |
+
"""
|
68 |
+
yield prompt
|
69 |
+
else:
|
70 |
+
yield text
|
71 |
+
elif type(text) == list:
|
72 |
+
yield prompt
|
73 |
+
|
74 |
+
for n,block in enumerate(text):
|
75 |
+
if n+1 < len(text):
|
76 |
+
prompt = f"""Do not answer yet. This is just another part of the text I want to send you. Just receive and acknowledge as "Part {n+1}/{len(text)} received" and wait for the next part.
|
77 |
+
[START PART {n+1}/{len(text)}]
|
78 |
+
{text[n]}
|
79 |
+
[END PART {n+1}/{len(text)}]
|
80 |
+
Remember not answering yet. Just acknowledge you received this part with the message "Part {n+1}/{len(text)} received" and wait for the next part.
|
81 |
+
"""
|
82 |
+
yield prompt
|
83 |
+
else:
|
84 |
+
prompt = f"""
|
85 |
+
[START PART {n+1}/{len(text)}]
|
86 |
+
{text[n]}
|
87 |
+
[END PART {n+1}/{len(text)}]
|
88 |
+
ALL PARTS SENT. Now you can continue processing the request.
|
89 |
+
"""
|
90 |
+
yield prompt
|
91 |
+
|
92 |
+
def send_ontology(self):
|
93 |
+
ontology = ""
|
94 |
+
if len(self.ontologies) > 0:
|
95 |
+
for k,v in self.ontologies.items():
|
96 |
+
ontology+=v+"\n"
|
97 |
+
print("Sending Ontology in Parts")
|
98 |
+
for i in self.ChatGPTTextSplitter(ontology):
|
99 |
+
print(self.llm_api(i))
|
100 |
+
else:
|
101 |
+
raise ValueError("No loaded ontology to send.")
|
102 |
+
def llm_api(self,prompt,model="gpt-3.5-turbo"):
|
103 |
+
messages = [{
|
104 |
+
"role":"user",
|
105 |
+
"content":prompt
|
106 |
+
}]
|
107 |
+
res = openai.ChatCompletion.create(model=model,messages=messages,temperature=0)
|
108 |
+
return res.choices[0].message['content']
|
109 |
+
|
110 |
+
def generate_rule(self,onto=None):
|
111 |
+
"""Raw rule string of AEO."""
|
112 |
+
v = """Remember make a json-ld format example that only uses classes and properties terms from Adversary Engagement Ontology, Unified Cyber Ontology.
|
113 |
+
|
114 |
+
Each engagement:Narrative has property:
|
115 |
+
engagement:hasStoryline connects to an engagement:Storyline
|
116 |
+
Each engagement:Storyline has property:
|
117 |
+
engagement:hasEvent connects to a uco-types:Thread
|
118 |
+
Each uco-types:Thread has properties:
|
119 |
+
co:element contains all engagement:PlannedEvents
|
120 |
+
co:item contains all uco-types:ThreadItem one each for each engagement:PlannedEvent.
|
121 |
+
co:size
|
122 |
+
uco-types:threadOriginItem is the uco-types:ThreadItem for the first engagement:PlannedEvent
|
123 |
+
uco-types:threadTerminalItem is the uco-types:ThreadItem for the last engagement:PlannedEvent
|
124 |
+
Each co:size has properties:
|
125 |
+
@type as xsd:nonNegativeInteger
|
126 |
+
@value which is the number of uco-types:ThreadItem
|
127 |
+
Each uco-types:ThreadItem has property:
|
128 |
+
co:itemContent is the engagement:PlannedEvent
|
129 |
+
optional uco-types:threadNextItem is the next uco-types:ThreadItem for the next engagement:PlannedEvent if there is one,
|
130 |
+
optional uco-types:threadPreviousItem is the previous uco-types:ThreadItem for the previous engagement:PlannedEvent if there is one
|
131 |
+
Each engagement:PlannedEvent has property:
|
132 |
+
engagement:eventContext connects to one engagement action has property @type one of the following:
|
133 |
+
engagement:Access
|
134 |
+
engagement:Alert
|
135 |
+
engagement:Beacon
|
136 |
+
engagement:Deploy
|
137 |
+
engagement:Obfuscate
|
138 |
+
engagement:Respond
|
139 |
+
Each engagement action has properties:
|
140 |
+
@type is the action
|
141 |
+
uco-core:performer
|
142 |
+
uco-core:object connects to one of the following engagement deception object denoted as "EDO" objects:
|
143 |
+
engagement:Honeypot
|
144 |
+
engagement:Honeytoken
|
145 |
+
engagement:Breadcrumb
|
146 |
+
engagement:BreadcrumbTrail
|
147 |
+
engagement:LureObject
|
148 |
+
engagement:HoneyObject
|
149 |
+
engagement:Decoy
|
150 |
+
engagement:DataSource
|
151 |
+
Each "EDO" object has properties:
|
152 |
+
engagement:hasCharacterization connects to a uco-core:UcoObject
|
153 |
+
objective:hasObjective with @type objective:Objective and @id with one of the following instances:
|
154 |
+
objective:CommandAndControl
|
155 |
+
objective:CredentialAccess
|
156 |
+
objective:DevelopResource
|
157 |
+
objective:Discover
|
158 |
+
objective:EscalatePrivilege
|
159 |
+
objective:Evade
|
160 |
+
objective:Execute
|
161 |
+
objective:Exfilitrate
|
162 |
+
objective:GainInitialAccess
|
163 |
+
objective:Impact
|
164 |
+
objective:MoveLaterally
|
165 |
+
objective:Persist
|
166 |
+
objective:Reconnaissance
|
167 |
+
objective:Affect
|
168 |
+
objective:Collect
|
169 |
+
objective:Detect
|
170 |
+
objective:Direct
|
171 |
+
objective:Disrupt
|
172 |
+
objective:Elicit
|
173 |
+
objective:Expose
|
174 |
+
objective:Motivate
|
175 |
+
objective:Plan
|
176 |
+
objective:Prepare
|
177 |
+
objective:Prevent
|
178 |
+
objective:Reassure
|
179 |
+
objective:Analyze
|
180 |
+
objective:Deny
|
181 |
+
objective:ElicitBehavior
|
182 |
+
objective:Lure
|
183 |
+
objective:TimeSink
|
184 |
+
objective:Track
|
185 |
+
objective:Trap
|
186 |
+
uco-core:name is the objective
|
187 |
+
All people have property:
|
188 |
+
@type is uco-identity:Person
|
189 |
+
uco-core:hasFacet that connects to one of the following:
|
190 |
+
uco-identity:SimpleNameFacet which has the property:
|
191 |
+
uco-identity:familyName
|
192 |
+
uco-identity:givenName
|
193 |
+
Each uco-core:Role has properties:
|
194 |
+
@id is the role
|
195 |
+
uco-core:name is the role
|
196 |
+
Each uco-core:Role there is a uco-core:Relationship with properties:
|
197 |
+
uco-core:kindofRelationship is "has_Role"
|
198 |
+
uco-core:source connects to the person who has the role
|
199 |
+
uco-core:target connects to uco-core:Role
|
200 |
+
Each engagement:BreadcrumbTrail has property:
|
201 |
+
engagement:hasBreadcrumb connects to uco-types:Thread
|
202 |
+
This uco-types:Thread has property:
|
203 |
+
co:element contains all engagement:Breadcrumb that belong to this engagement:BreadcrumbTrail
|
204 |
+
co:item contains all uco-types:ThreadItem one each for each engagement:Breadcrumb
|
205 |
+
co:size
|
206 |
+
uco-types:threadOriginItem is the uco-types:ThreadItem for the first engagement:Breadcrumb belonging to this engagement:BreadcrumbTrail
|
207 |
+
uco-types:threadTerminalItem is the uco-types:ThreadItem for the last engagement:Breadcrumb belonging to this engagement:BreadcrumbTrail
|
208 |
+
Each engagement:Breadcrumb has the properties:
|
209 |
+
engagement:hasCharacterization which connects to a uco-core:UcoObject with the property:
|
210 |
+
uco-core:description which describes the object characterizing the breadcrumb
|
211 |
+
All classes must include property:
|
212 |
+
@type is the class
|
213 |
+
@id is a unique identifier
|
214 |
+
|
215 |
+
If namespace "engagement" prefix is used then https://ontology.adversaryengagement.org/ae/engagement#
|
216 |
+
If namespace "objective" prefix is used then https://ontology.adversaryengagement.org/ae/objective#
|
217 |
+
If namespace "role" prefix is used then https://ontology.adversaryengagement.org/ae/role#
|
218 |
+
If namespace "identity" prefix is used then https://ontology.adversaryengagement.org/ae/identity#
|
219 |
+
If namespace "uco-core" prefix is used then https://ontology.unifiedcyberontology.org/uco/core#
|
220 |
+
If namespace "uco-types" prefix is used then https://ontology.unifiedcyberontology.org/uco/types#
|
221 |
+
If namespace "uco-role" prefix is used then https://ontology.unifiedcyberontology.org/uco/role#
|
222 |
+
"""
|
223 |
+
return v
|
224 |
+
|
225 |
+
def generate_continue(self):
|
226 |
+
v = """
|
227 |
+
continue
|
228 |
+
"""
|
229 |
+
return v
|
230 |
+
|
231 |
+
def raw_prompt(self,description):
|
232 |
+
|
233 |
+
def run(val):
|
234 |
+
prompt = f"""Give me a full json-ld format example for the following scenario:
|
235 |
+
{description}
|
236 |
+
|
237 |
+
{"".join(val)}
|
238 |
+
"""
|
239 |
+
for i in self.ChatGPTTextSplitter(prompt):
|
240 |
+
res = self.llm_api(i)
|
241 |
+
return res
|
242 |
+
# return json.loads(res)
|
243 |
+
res_val = run(self.generate_rule())
|
244 |
+
#res_val = run(self.generate_rules())
|
245 |
+
try:
|
246 |
+
val = json.loads(res_val)
|
247 |
+
return val
|
248 |
+
except:
|
249 |
+
#the response was cut off, prompt for the continuation.
|
250 |
+
data = []
|
251 |
+
data.append(res_val)
|
252 |
+
while True:
|
253 |
+
res = self.llm_api(self.generate_continue())
|
254 |
+
data.append(res)
|
255 |
+
try:
|
256 |
+
full = "".join(data)
|
257 |
+
return json.loads(full)
|
258 |
+
except:
|
259 |
+
pass
|
260 |
+
|
261 |
+
return None
|
262 |
+
|
263 |
+
def get_ns(self,string):
|
264 |
+
return string.split(":")[0]
|
265 |
+
|
266 |
+
|
267 |
+
def prompt(self,description):
|
268 |
+
res = self.raw_prompt(description)
|
269 |
+
|
270 |
+
#include only relevent namespaces
|
271 |
+
prefixes = []
|
272 |
+
|
273 |
+
def is_nested(LIST):
|
274 |
+
if type(LIST) == list:
|
275 |
+
for JSON in LIST:
|
276 |
+
for key in JSON.keys():
|
277 |
+
if type(JSON[key]) == dict:
|
278 |
+
is_nested(JSON[key])
|
279 |
+
if '@type' in JSON.keys():
|
280 |
+
prefixes.append(self.get_ns(JSON['@type']))
|
281 |
+
else:
|
282 |
+
JSON = LIST
|
283 |
+
for key in JSON.keys():
|
284 |
+
if type(JSON[key]) == dict:
|
285 |
+
is_nested(JSON[key])
|
286 |
+
if '@type' in JSON.keys():
|
287 |
+
prefixes.append(self.get_ns(JSON['@type']))
|
288 |
+
|
289 |
+
|
290 |
+
is_nested(res['@graph'])
|
291 |
+
prefixes = set(prefixes)
|
292 |
+
|
293 |
+
new_prefixes = {}
|
294 |
+
for prefix in prefixes:
|
295 |
+
if prefix in res['@context']:
|
296 |
+
new_prefixes[prefix] = res['@context'][prefix]
|
297 |
+
|
298 |
+
res['@context'] = new_prefixes
|
299 |
+
|
300 |
+
return res
|
lureGeneration/LureGenerator.py
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import openai
|
3 |
+
import json
|
4 |
+
import rdflib
|
5 |
+
|
6 |
+
class LureObject:
|
7 |
+
def __init__(self):
|
8 |
+
self.lure_name = ""
|
9 |
+
self.type = "" #honeytoken, honeypot
|
10 |
+
self.content = ""
|
11 |
+
|
12 |
+
|
13 |
+
class LureGenerator:
|
14 |
+
def __init__(self):
|
15 |
+
self.lure = []
|
16 |
+
|
17 |
+
def ChatGPTTextSplitter(self,text):
|
18 |
+
"""Splits text in smaller subblocks to feed to the LLM"""
|
19 |
+
prompt = f"""The total length of content that I want to send you is too large to send in only one piece.
|
20 |
+
|
21 |
+
For sending you that content, I will follow this rule:
|
22 |
+
|
23 |
+
[START PART 1/10]
|
24 |
+
this is the content of the part 1 out of 10 in total
|
25 |
+
[END PART 1/10]
|
26 |
+
|
27 |
+
Then you just answer: "Instructions Sent."
|
28 |
+
|
29 |
+
And when I tell you "ALL PARTS SENT", then you can continue processing the data and answering my requests.
|
30 |
+
"""
|
31 |
+
if type(text) == str:
|
32 |
+
textsize = 12000
|
33 |
+
blocksize = int(len(text) / textsize)
|
34 |
+
if blocksize > 0:
|
35 |
+
yield prompt
|
36 |
+
|
37 |
+
for b in range(1,blocksize+1):
|
38 |
+
if b < blocksize+1:
|
39 |
+
prompt = f"""Do not answer yet. This is just another part of the text I want to send you. Just receive and acknowledge as "Part {b}/{blocksize} received" and wait for the next part.
|
40 |
+
[START PART {b}/{blocksize}]
|
41 |
+
{text[(b-1)*textsize:b*textsize]}
|
42 |
+
[END PART {b}/{blocksize}]
|
43 |
+
Remember not answering yet. Just acknowledge you received this part with the message "Part {b}/{blocksize} received" and wait for the next part.
|
44 |
+
"""
|
45 |
+
yield prompt
|
46 |
+
else:
|
47 |
+
prompt = f"""
|
48 |
+
[START PART {b}/{blocksize}]
|
49 |
+
{text[(b-1)*textsize:b*textsize]}
|
50 |
+
[END PART {b}/{blocksize}]
|
51 |
+
ALL PARTS SENT. Now you can continue processing the request.
|
52 |
+
"""
|
53 |
+
yield prompt
|
54 |
+
else:
|
55 |
+
yield text
|
56 |
+
elif type(text) == list:
|
57 |
+
yield prompt
|
58 |
+
|
59 |
+
for n,block in enumerate(text):
|
60 |
+
if n+1 < len(text):
|
61 |
+
prompt = f"""Do not answer yet. This is just another part of the text I want to send you. Just receive and acknowledge as "Part {n+1}/{len(text)} received" and wait for the next part.
|
62 |
+
[START PART {n+1}/{len(text)}]
|
63 |
+
{text[n]}
|
64 |
+
[END PART {n+1}/{len(text)}]
|
65 |
+
Remember not answering yet. Just acknowledge you received this part with the message "Part {n+1}/{len(text)} received" and wait for the next part.
|
66 |
+
"""
|
67 |
+
yield prompt
|
68 |
+
else:
|
69 |
+
prompt = f"""
|
70 |
+
[START PART {n+1}/{len(text)}]
|
71 |
+
{text[n]}
|
72 |
+
[END PART {n+1}/{len(text)}]
|
73 |
+
ALL PARTS SENT. Now you can continue processing the request.
|
74 |
+
"""
|
75 |
+
yield prompt
|
76 |
+
|
77 |
+
|
78 |
+
def llm_api(self,prompt,model="gpt-3.5-turbo"):
|
79 |
+
messages = [{
|
80 |
+
"role":"user",
|
81 |
+
"content":prompt
|
82 |
+
}]
|
83 |
+
res = openai.ChatCompletion.create(model=model,messages=messages,temperature=0)
|
84 |
+
return res.choices[0].message['content']
|
85 |
+
|
86 |
+
def generate_rule(self,deceptionObject,role):
|
87 |
+
v = f"""Generate examples of {deceptionObject} that would be perceived valuable by an adversary about a person who has the role {role} and lure them to a specific location on the network. Generate json-format objects from the examples and return a json-format object containing all json-format objects.
|
88 |
+
"""
|
89 |
+
return v
|
90 |
+
def generate_rule2(self,deceptionObject,role,jsn):
|
91 |
+
v = f"""Generate the detailed contents of an example of what an adversary would see if they accessed this {deceptionObject}: {jsn}
|
92 |
+
"""
|
93 |
+
return v
|
94 |
+
|
95 |
+
def generate_continue(self):
|
96 |
+
v = """
|
97 |
+
continue
|
98 |
+
"""
|
99 |
+
return v
|
100 |
+
|
101 |
+
def raw_prompt(self,LureType,Role):
|
102 |
+
def run(val):
|
103 |
+
prompt = "".join(val)
|
104 |
+
for i in self.ChatGPTTextSplitter(prompt):
|
105 |
+
res = self.llm_api(i)
|
106 |
+
return res
|
107 |
+
res_val = run(self.generate_rule(LureType,Role))
|
108 |
+
return res_val
|
109 |
+
def raw_content(self,LureType,Role,jsn):
|
110 |
+
def run(val):
|
111 |
+
prompt = "".join(val)
|
112 |
+
for i in self.ChatGPTTextSplitter(prompt):
|
113 |
+
res = self.llm_api(i)
|
114 |
+
return res
|
115 |
+
res_val = run(self.generate_rule2(LureType,Role,jsn))
|
116 |
+
return res_val
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
+
def generate(self,LureType,Role:str = ""):
|
121 |
+
|
122 |
+
assert LureType in ['honeytoken','honeypot','honeyfile']
|
123 |
+
res = self.raw_prompt(LureType,Role)
|
124 |
+
|
125 |
+
self.sketch = res
|
126 |
+
|
127 |
+
try:
|
128 |
+
jsn = json.loads(res)
|
129 |
+
except:
|
130 |
+
raise ValueError("Failed to parse json-format.")
|
131 |
+
|
132 |
+
key = list(jsn.keys())
|
133 |
+
if len(key) == 1:
|
134 |
+
for n,example in enumerate(list(jsn[key[0]])):
|
135 |
+
lure = LureObject()
|
136 |
+
lure.json = example
|
137 |
+
lure.lure_name = key[0]+"_"+str(n)
|
138 |
+
lure.content = self.raw_content(LureType,Role,example)
|
139 |
+
lure.type = LureType
|
140 |
+
lure.userRole = Role
|
141 |
+
|
142 |
+
self.lure.append(lure)
|
143 |
+
|
144 |
+
return self.lure
|
lureGeneration/__init__.py
ADDED
File without changes
|
lureGeneration/__pycache__/LureGenerator.cpython-310.pyc
ADDED
Binary file (5.67 kB). View file
|
|
lureGeneration/__pycache__/LureGenerator.cpython-39.pyc
ADDED
Binary file (5.69 kB). View file
|
|
lureGeneration/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (174 Bytes). View file
|
|
lureGeneration/__pycache__/__init__.cpython-39.pyc
ADDED
Binary file (147 Bytes). View file
|
|
pages/1_AEO_Example_Generator.py
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import openai
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
st.title('AEO Example Generator')
|
8 |
+
|
9 |
+
about = ''' Adversary Engagement Ontology (AEO) is a candidate ontology to the Unified Cyber Ontology (UCO), a community effort for the ontological standardization of cyber domain concepts and objects under a unifying framework, and is part of the Cyber Domain Ontology (CDO). Community efforts and development has always been manual labor intensive in regards to ontology changes, ontology example generation for adopters, documentation generation. Large Language Models (LLMs) have been shown to be capable of automating many tasks or aiding in human expert decision-making. We demonstrate how foundational LLMs such as ChatGPT and GPT4 can assist in ontology example generation, ontology development, and overall be used in automation tooling for structured but tedious tasks.
|
10 |
+
This space can be used to create an example of how to setup the AEO instance. It uses the power of OpenAI's ChatGPT.
|
11 |
+
The generator currently uses strictly prewritten rules of AEO, discussion on an automation process is still early .
|
12 |
+
he generator currently is bounded by prompt size limits.
|
13 |
+
|
14 |
+
There are some known work arounds but none are functionally implemented yet.
|
15 |
+
|
16 |
+
Official GitHub: https://github.com/UNHSAILLab/Adversary-Engagement-Ontology
|
17 |
+
'''
|
18 |
+
st.markdown(about)
|
19 |
+
|
20 |
+
openai_key = st.text_input("Enter your OpenAI key", type="password")
|
21 |
+
openai.api_key = openai_key
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
from aeo_ex_generator.aeo_example_generator import ExampleGenerator
|
27 |
+
ex = ExampleGenerator()
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
# Prompt Examples
|
32 |
+
st.subheader("Prompts Examples")
|
33 |
+
with st.expander("Example-1"):
|
34 |
+
st.write("""
|
35 |
+
Use one engagement:Narrative
|
36 |
+
Use one engagement:Storyline
|
37 |
+
Use the following people:
|
38 |
+
Bob Smith is a defender role
|
39 |
+
Mary Jane is an adversary role
|
40 |
+
Use three planned events:
|
41 |
+
Planned Event one - Bob Smith deploys a honeyobject enviroment and a honeytoken file containing fake user credentials called "user-creds.dmp". The objective is to direct and elicit. He also deploys a honeypot with the objective to detect and trap.
|
42 |
+
Planned Event two - The honeypot beacons to the dataTarget called CanaryTokenAlert, the performer is the honeypot, the object is the CanaryTokenAlert.
|
43 |
+
Planned Event three - CanaryTokenAlert dataSource alerts Bob Smith that the second honeypot was accessed. The performer is the CanaryTokenAlert, the object is Bob Smith
|
44 |
+
""")
|
45 |
+
with st.expander("Example-2"):
|
46 |
+
st.write("""
|
47 |
+
Use one engagement:Narrative
|
48 |
+
Use one engagement:Storyline
|
49 |
+
Use the following people:
|
50 |
+
John White is a defender role
|
51 |
+
Use three planned events:
|
52 |
+
Planned Event one - John White deploys a breadcrumbtrail consisting of four breadcrumbs. The objective is to direct. He also deploys a honeypot with the objective to trap.
|
53 |
+
Planned Event two - The honeypot beacons to the dataTarget called CommandControlCenter, the performer is the honeypot, the object is the CommandControlCenter.
|
54 |
+
Planned Event three - CommandControlCenter dataSource alerts John White that the honeypot was accessed. The performer is the CommandControlCenter, the object is John White
|
55 |
+
""")
|
56 |
+
|
57 |
+
|
58 |
+
st.subheader("Write a prompt to generate the example.")
|
59 |
+
user_input = st.text_area("Enter your description here ", "", height=200)
|
60 |
+
|
61 |
+
# call your function
|
62 |
+
# result = foo(user_input)
|
63 |
+
if user_input:
|
64 |
+
e = ex.prompt(user_input, jsn=True)
|
65 |
+
result = e['@context']
|
66 |
+
# display result
|
67 |
+
st.subheader('Prefix namespaces mentioned in the example:')
|
68 |
+
st.text_area("", e['@context'], height=200)
|
69 |
+
#st.json(e['@context'])
|
70 |
+
st.subheader('Full example:')
|
71 |
+
try:
|
72 |
+
st.json(e)
|
73 |
+
except:
|
74 |
+
st.text_area("", e, height=400)
|
75 |
+
|
76 |
+
|
pages/2_Auto_Generate_Plan_and_Personas.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from aeo_ex_generator.aeo_example_generator import ExampleGenerator
|
2 |
+
|
3 |
+
import openai
|
4 |
+
import os
|
5 |
+
import streamlit as st
|
6 |
+
|
7 |
+
import streamlit as st
|
8 |
+
|
9 |
+
st.subheader("This space will autognerate the plans and the personas")
|
10 |
+
|
11 |
+
OpenAI_Key = st.text_input(" Please enter your OpenAI key here to continue")
|
12 |
+
# only continue if the key is given
|
13 |
+
if OpenAI_Key:
|
14 |
+
st.write("Please wait, it will take a while to generate. ")
|
15 |
+
os.environ['OPENAI_API_KEY'] = OpenAI_Key
|
16 |
+
openai.api_key =os.environ['OPENAI_API_KEY']
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
ex = ExampleGenerator() #declare the instance
|
21 |
+
e = ex.auto_generate()
|
22 |
+
|
23 |
+
st.write(ex.description) #the description is cached in this variable
|
24 |
+
|
25 |
+
st.subheader('Prefix Namespaces')
|
26 |
+
st.write(e['@context']) #here are the prefix namespaces mentioned in the example
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
result = [i for i in e['@graph']]
|
31 |
+
st.subheader('Full example:')
|
32 |
+
try:
|
33 |
+
st.json(result)
|
34 |
+
except:
|
35 |
+
st.text_area("", result, height=400)
|
36 |
+
|
37 |
+
if result:
|
38 |
+
st.subheader("Auto generate specific plan")
|
39 |
+
keywords = st.text_area("Enter keywords to keep in the plan","breadcrumbtrail")
|
40 |
+
nkeywords= st.text_area("You can pass keywords to exclude from the example generation", "honeypot")
|
41 |
+
personas = ex.generate_personas()
|
42 |
+
st.subheader("Person based on the existing description provided in the deception plan")
|
43 |
+
st.write( ex.persona_descriptions)
|
pages/3_Lure_Generation.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from lureGeneration.LureGenerator import LureGenerator
|
2 |
+
import openai
|
3 |
+
import os
|
4 |
+
import streamlit as st
|
5 |
+
|
6 |
+
import streamlit as st
|
7 |
+
|
8 |
+
st.subheader("In this example you can Lure based on AEO ")
|
9 |
+
|
10 |
+
OpenAI_Key = st.text_input(" Please enter your OpenAI key here to continue")
|
11 |
+
# only continue if the key is given
|
12 |
+
if OpenAI_Key:
|
13 |
+
os.environ['OPENAI_API_KEY'] = OpenAI_Key
|
14 |
+
openai.api_key =os.environ['OPENAI_API_KEY']
|
15 |
+
|
16 |
+
# ['honeytoken','honeypot','honeyfile']
|
17 |
+
honey_type = st.text_area(" Please enter one of the type: ['honeytoken','honeypot','honeyfile'] ","honeyfile", height=50)
|
18 |
+
# Description
|
19 |
+
description = st.text_area("Please enter the description. ", "CEO of a critical mining company", height=50)
|
20 |
+
ex = LureGenerator() #declare the instance
|
21 |
+
e = ex.generate(honey_type,description)
|
22 |
+
|
23 |
+
response = ex.lure[0].content
|
24 |
+
json_ld = ex.lure[0].json
|
25 |
+
st.subheader('Content')
|
26 |
+
st.write(response)
|
27 |
+
|
28 |
+
st.subheader('JSON-LD Description')
|
29 |
+
st.write(json_ld)
|
pages/4_AutoEngage.py
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
#from dotenv import load_dotenv
|
4 |
+
from langchain.document_loaders import PyPDFLoader
|
5 |
+
from langchain.document_loaders import UnstructuredMarkdownLoader
|
6 |
+
from langchain.document_loaders import TextLoader
|
7 |
+
from langchain.embeddings import OpenAIEmbeddings
|
8 |
+
from langchain.vectorstores import Chroma
|
9 |
+
from langchain.chat_models import ChatOpenAI
|
10 |
+
from langchain.chains import ConversationalRetrievalChain
|
11 |
+
from langchain.text_splitter import CharacterTextSplitter
|
12 |
+
from langchain.agents.agent_toolkits import create_retriever_tool
|
13 |
+
from langchain.agents.agent_toolkits import create_conversational_retrieval_agent
|
14 |
+
from langchain.chat_models import ChatOpenAI
|
15 |
+
|
16 |
+
import streamlit as st
|
17 |
+
|
18 |
+
st.write("""In this space you need to provide the description of the engagement
|
19 |
+
and it will automatically generate the deception strategy and itemized
|
20 |
+
action along with the JSON-LD description.""")
|
21 |
+
|
22 |
+
|
23 |
+
OpenAI_Key = st.text_input(" Please enter your OpenAI key here to continue")
|
24 |
+
# only continue if the key is given
|
25 |
+
if OpenAI_Key:
|
26 |
+
os.environ['OPENAI_API_KEY'] = OpenAI_Key
|
27 |
+
vectordb = Chroma(persist_directory="./data", embedding_function=OpenAIEmbeddings())
|
28 |
+
|
29 |
+
retriever = vectordb.as_retriever()
|
30 |
+
|
31 |
+
tool = create_retriever_tool(
|
32 |
+
retriever,
|
33 |
+
"search_AEO",
|
34 |
+
"Searches and returns documents regarding adversary engagement."
|
35 |
+
)
|
36 |
+
tools = [tool]
|
37 |
+
|
38 |
+
|
39 |
+
llm = ChatOpenAI(model_name="gpt-4", temperature = 0)
|
40 |
+
agent_executor = create_conversational_retrieval_agent(llm, tools, verbose=True)
|
41 |
+
# result = agent_executor({"input": "What is the point of the engagement matrix?"})
|
42 |
+
|
43 |
+
# Creating High Level Deception and denial strategy
|
44 |
+
example= """ You are part of a small business called MineralRUs Inc., which is a small, yet critical mining company in New Hampshire specializing in rare earth elements.
|
45 |
+
Your main clients are from particular sectors of technology and defense industries, and are considered to be critical infrastructure. Therefore, your business and its operation is essential to the integrity of supply chains enabling those critical infrastructure.
|
46 |
+
MineralRUs Inc. maintains paper-based record of their key intellectual property and operational procedures, which are stored in a physical safe. This fact is known by only a select few in the company.
|
47 |
+
Your business has a small, unorganized computer network with only generic security infrastructure, and the company does not have the resources to employ an in-house information security team. Instead, a very small team is tasked with maintaining Operational Technology (OT) systems on the network.
|
48 |
+
Your company has recently received an advisory from federal authorities, warning businesses in your industry about the rapidly growing threat of cyber espionage by state-sponsored Advanced Persistent Threats (APTs). In response, your company decides to engage an external cybersecurity provider to assist with timely incident response and prevention. The external provider recommends the employment of active adversary engagement plans, and asks you to develop a high-level deception and denial strategy.
|
49 |
+
"""
|
50 |
+
user_input = st.text_area("Enter your engagement strategy: ", example, height=400)
|
51 |
+
prompt_1 = user_input + "### Instruction: You are an expert in Mitre's Attack Framework. Please create a high-level deception and denial strategy for the given scenario."
|
52 |
+
|
53 |
+
st.subheader('High Level Deception and Denial Strategy ')
|
54 |
+
result = agent_executor({"input":prompt_1 })
|
55 |
+
|
56 |
+
st.write(result['output'])
|
57 |
+
|
58 |
+
if result:
|
59 |
+
st.subheader('Itemized Action Plan')
|
60 |
+
prompt_2 = """### Instruction: I am giving you the high level deception and denial strategy.
|
61 |
+
Please create a specific itemized action plan for the below strategy. ### Scenario""" + result['output']
|
62 |
+
result_2 = agent_executor({"input":prompt_2 })
|
63 |
+
|
64 |
+
st.write(result_2['output'])
|
65 |
+
|
66 |
+
if result_2:
|
67 |
+
st.subheader('JSON-LD Description')
|
68 |
+
prompt_3 = """### Instruction: Please use AEO ontology to map the plan given below to the JSON-LD description. ### Plan: """ + result_2['output']
|
69 |
+
result_3 = agent_executor({'input': prompt_3})
|
70 |
+
|
71 |
+
st.write(result_3['output'])
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
rdflib==7.0.0
|
2 |
+
openai==0.27.6
|
3 |
+
tiktoken
|
4 |
+
chromadb
|
5 |
+
langchain
|
6 |
+
pypdf
|
7 |
+
streamlit
|
8 |
+
unstructured
|
9 |
+
marker
|
10 |
+
rdflib
|