-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[client] Improve STIX2 bundle splitter (#736)
- Loading branch information
1 parent
fe0a730
commit 3f6fbb4
Showing
12 changed files
with
70,700 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import uuid | ||
|
||
from stix2.canonicalization.Canonicalize import canonicalize | ||
|
||
|
||
def external_reference_generate_id(url=None, source_name=None, external_id=None): | ||
if url is not None: | ||
data = {"url": url} | ||
elif source_name is not None and external_id is not None: | ||
data = {"source_name": source_name, "external_id": external_id} | ||
else: | ||
return None | ||
data = canonicalize(data, utf8=False) | ||
id = str(uuid.uuid5(uuid.UUID("00abedb4-aa42-466c-9c01-fed23315a9b7"), data)) | ||
return "external-reference--" + id | ||
|
||
|
||
def kill_chain_phase_generate_id(phase_name, kill_chain_name): | ||
data = {"phase_name": phase_name, "kill_chain_name": kill_chain_name} | ||
data = canonicalize(data, utf8=False) | ||
id = str(uuid.uuid5(uuid.UUID("00abedb4-aa42-466c-9c01-fed23315a9b7"), data)) | ||
return "kill-chain-phase--" + id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.