Skip to content

Commit

Permalink
Using stix data
Browse files Browse the repository at this point in the history
  • Loading branch information
OllieJC committed Jul 23, 2021
1 parent f737efa commit 455db1a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
12 changes: 11 additions & 1 deletion css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ select.form-novelty {
.four-five { grid-area: four-five; background-color: #fec6c6; }
.five-five { grid-area: five-five; background-color: #fec6c6; }

.b-example-divider {
.vertical-divider {
flex-shrink: 0;
width: 1.5rem;
min-height: 100vh;
Expand All @@ -137,6 +137,16 @@ select.form-novelty {
box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
}

.horizontal-divider {
flex-shrink: 0;
width: 100%;
height: 1.5rem;
background-color: rgba(0, 0, 0, .1);
border: solid rgba(0, 0, 0, .15);
border-width: 1px 0;
box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
}

.bi {
vertical-align: -.125em;
pointer-events: none;
Expand Down
15 changes: 14 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
</ul>
</div>

<div class="b-example-divider"></div>
<div class="vertical-divider"></div>

<div class="main-window">
<div id="window-threatbox" class="window-hidden">
Expand Down Expand Up @@ -318,6 +318,19 @@ <h1 class="label-threatactors"></h1>
</div>
<div id="window-threatactorlibrary" class="window-hidden">
<h1 class="label-threatactorlibrary"></h1>

<div id="actorlibrary">
<div>
<h3>APT1</h3>
<p>Test</p>
<hr/>
</div>
<div>
<h3>APT2</h3>
<p>Test</p>
<hr/>
</div>
</div>
</div>
<div id="window-settings" class="window-hidden">
<h1 class="label-settings"></h1>
Expand Down
31 changes: 31 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import json

from stix2 import FileSystemSource, Filter
from stix2.utils import get_type_from_id

# create FileSystemSource
fs_source = FileSystemSource("../cti/enterprise-attack")


rels = fs_source.query(Filter("type", "=", "relationship"))

isets = fs_source.query(Filter("type", "=", "intrusion-set"))
groups = []
for iset in isets:
z = dict(iset).copy()
z["attack-patterns"] = []

for rel in rels:
if (
get_type_from_id(rel.source_ref) == "intrusion-set"
and get_type_from_id(rel.target_ref) == "attack-pattern"
and iset.id == rel.source_ref
):
z["attack-patterns"].append(dict(rel))

groups.append(z)

# TODO: techniques!

print(len(groups))
print(json.dumps(groups[0], indent=2, default=str))

0 comments on commit 455db1a

Please sign in to comment.