Skip to content

Commit

Permalink
removing old epss not object
Browse files Browse the repository at this point in the history
  • Loading branch information
himynamesdave committed Nov 29, 2024
1 parent 4495912 commit 28cf092
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"type": "note",
"type": "report",
"spec_version": "2.1",
"id": "note--8d62e369-463f-59d7-825b-09185aed39dc",
"id": "report--03081179-3df6-542e-b377-b43a5d542d0a",
"created_by_ref": "identity--e1db4e59-c7f9-5ec0-bd55-10004728a167",
"created": "2020-01-01T00:00:00.000Z",
"modified": "2020-01-01T00:00:00.000Z",
"content": "EPSS Score for CVE-XXX-XXXX",
"name": "EPSS Scores: CVE-XXX-XXXX",
"published": "2020-01-01T00:00:00Z",
"object_refs": [
"vulnerability--20b0177f-7b3c-527c-b88c-fca16a0ebf5d"
],
Expand All @@ -14,7 +15,7 @@
"marking-definition--60c0f466-511a-5419-9f7e-4814e696da40"
],
"extensions": {
"extension-definition--efd26d23-d37d-5cf2-ac95-a101e46ce11d": {
"extension-definition--f80cce10-5ac0-58d1-9e7e-b4ed0cc4dbb9": {
"extension_type": "toplevel-property-extension"
}
},
Expand Down
28 changes: 14 additions & 14 deletions extension-definitions/extension-definition-bundle.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "bundle",
"id": "bundle--3c25d54b-662b-51ea-950e-51f36e72f510",
"id": "bundle--8854f478-e3e7-57af-99e9-e90f373876d8",
"objects": [
{
"type": "extension-definition",
Expand Down Expand Up @@ -185,19 +185,16 @@
{
"type": "extension-definition",
"spec_version": "2.1",
"id": "extension-definition--efd26d23-d37d-5cf2-ac95-a101e46ce11d",
"id": "extension-definition--f19f3291-6a84-5674-b311-d75a925d5bd9",
"created_by_ref": "identity--9779a2db-f98c-5f4b-8d08-8ee04e02dbb5",
"created": "2020-01-01T00:00:00.000Z",
"modified": "2020-01-01T00:00:00.000Z",
"name": "Note SDO EPSS Scoring Properties",
"description": "This extension adds new properties to Note SDOs to capture EPSS scores for CVEs.",
"schema": "https://raw.githubusercontent.com/muchdogesec/stix2extensions/main/schemas/properties/note-epss-scoring.json",
"name": "Bank Account",
"description": "This extension creates a new SCO that can be used to represent bank account details.",
"schema": "https://raw.githubusercontent.com/muchdogesec/stix2extensions/main/schemas/scos/bank-account.json",
"version": "1.0",
"extension_types": [
"toplevel-property-extension"
],
"extension_properties": [
"x_epss"
"new-sco"
],
"object_marking_refs": [
"marking-definition--94868c89-83c2-464b-929b-a1a8aa3c8487",
Expand All @@ -207,16 +204,19 @@
{
"type": "extension-definition",
"spec_version": "2.1",
"id": "extension-definition--f19f3291-6a84-5674-b311-d75a925d5bd9",
"id": "extension-definition--f80cce10-5ac0-58d1-9e7e-b4ed0cc4dbb9",
"created_by_ref": "identity--9779a2db-f98c-5f4b-8d08-8ee04e02dbb5",
"created": "2020-01-01T00:00:00.000Z",
"modified": "2020-01-01T00:00:00.000Z",
"name": "Bank Account",
"description": "This extension creates a new SCO that can be used to represent bank account details.",
"schema": "https://raw.githubusercontent.com/muchdogesec/stix2extensions/main/schemas/scos/bank-account.json",
"name": "Report SDO EPSS Scoring Properties",
"description": "This extension adds new properties to Report SDOs to capture EPSS scores for CVEs.",
"schema": "https://raw.githubusercontent.com/muchdogesec/stix2extensions/main/schemas/properties/report-epss-scoring.json",
"version": "1.0",
"extension_types": [
"new-sco"
"toplevel-property-extension"
],
"extension_properties": [
"x_epss"
],
"object_marking_refs": [
"marking-definition--94868c89-83c2-464b-929b-a1a8aa3c8487",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"type": "extension-definition",
"spec_version": "2.1",
"id": "extension-definition--efd26d23-d37d-5cf2-ac95-a101e46ce11d",
"id": "extension-definition--f80cce10-5ac0-58d1-9e7e-b4ed0cc4dbb9",
"created_by_ref": "identity--9779a2db-f98c-5f4b-8d08-8ee04e02dbb5",
"created": "2020-01-01T00:00:00.000Z",
"modified": "2020-01-01T00:00:00.000Z",
"name": "Note SDO EPSS Scoring Properties",
"description": "This extension adds new properties to Note SDOs to capture EPSS scores for CVEs.",
"schema": "https://raw.githubusercontent.com/muchdogesec/stix2extensions/main/schemas/properties/note-epss-scoring.json",
"name": "Report SDO EPSS Scoring Properties",
"description": "This extension adds new properties to Report SDOs to capture EPSS scores for CVEs.",
"schema": "https://raw.githubusercontent.com/muchdogesec/stix2extensions/main/schemas/properties/report-epss-scoring.json",
"version": "1.0",
"extension_types": [
"toplevel-property-extension"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from uuid import UUID

from stix2 import Note
from stix2extensions._extensions import note_epss_scoring_ExtensionDefinitionSMO
from stix2 import Report
from stix2extensions._extensions import report_epss_scoring_ExtensionDefinitionSMO

# create the directories

Expand All @@ -30,16 +30,17 @@
created="2020-01-01T00:00:00.000Z"
modified="2020-01-01T00:00:00.000Z"

# Create NoteSDO object
# Create ReportSDO object

### note--8d62e369-463f-59d7-825b-09185aed39dc
### report--03081179-3df6-542e-b377-b43a5d542d0a

example_NoteSDO = Note(
id="note--"+ str(uuid.uuid5(namespace, f"A demo EPSS Note")),
example_ReportSDO = Report(
id="report--"+ str(uuid.uuid5(namespace, f"A demo EPSS Report")),
created_by_ref=created_by_ref,
created=created,
modified=modified,
content="EPSS Score for CVE-XXX-XXXX",
published=created,
name="EPSS Scores: CVE-XXX-XXXX",
object_refs=[
"vulnerability--20b0177f-7b3c-527c-b88c-fca16a0ebf5d"
],
Expand All @@ -60,7 +61,7 @@
}
],
extensions={
note_epss_scoring_ExtensionDefinitionSMO.id: {
report_epss_scoring_ExtensionDefinitionSMO.id: {
"extension_type": "toplevel-property-extension"
}
}
Expand All @@ -72,12 +73,12 @@
### Creating FileSystemStore and adding MarkingDefinitionSMO for each directory

fs_directories = {
"tmp_object_store": example_NoteSDO
"tmp_object_store": example_ReportSDO
}

for directory, note_sdo in fs_directories.items():
for directory, report_sdo in fs_directories.items():
fs_store = stix2.FileSystemStore(directory)
fs_store.add([note_sdo])
fs_store.add([report_sdo])

# Now move those files into the standardised locations for easy download

Expand All @@ -89,6 +90,6 @@
if not os.path.exists(directory):
os.makedirs(directory)

shutil.move("tmp_object_store/note/note--" + str(uuid.uuid5(namespace, f"A demo EPSS Note")) + "/20200101000000000.json", "example_objects/properties/note--" + str(uuid.uuid5(namespace, f"A demo EPSS Note")) + ".json")
shutil.move("tmp_object_store/report/report--" + str(uuid.uuid5(namespace, f"A demo EPSS Report")) + "/20200101000000000.json", "example_objects/properties/report--" + str(uuid.uuid5(namespace, f"A demo EPSS Report")) + ".json")

shutil.rmtree("tmp_object_store")
4 changes: 2 additions & 2 deletions generators/smos/extension-definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
user_agent_ExtensionDefinitionSMO,
vulnerability_scoring_ExtensionDefinitionSMO,
indicator_vulnerable_cpes_ExtensionDefinitionSMO,
note_epss_scoring_ExtensionDefinitionSMO,
report_epss_scoring_ExtensionDefinitionSMO,
software_cpe_properties_ExtensionDefinitionSMO
)

Expand All @@ -46,7 +46,7 @@
generator_properties = Generator("extension-definitions/properties")
generator_properties.add_item("vulnerability-scoring", vulnerability_scoring_ExtensionDefinitionSMO)
generator_properties.add_item("indicator-vulnerable-cpes", indicator_vulnerable_cpes_ExtensionDefinitionSMO)
generator_properties.add_item("note-epss-scoring", note_epss_scoring_ExtensionDefinitionSMO)
generator_properties.add_item("report-epss-scoring", report_epss_scoring_ExtensionDefinitionSMO)
generator_properties.add_item("software-cpe-properties", software_cpe_properties_ExtensionDefinitionSMO)

# Save all items
Expand Down
2 changes: 1 addition & 1 deletion schemas/properties/indicator-vulnerable-cpes.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "object",
"allOf": [
{
"$ref": "https://github.com/oasis-open/cti-stix2-json-schemas/blob/master/schemas/sdos/indicator.json"
"$ref": "https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/refs/heads/master/schemas/sdos/indicator.json"
},
{
"properties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$id": "https://raw.githubusercontent.com/muchdogesec/stix2extensions/main/schemas/properties/note-epss-scoring.json",
"$id": "https://raw.githubusercontent.com/muchdogesec/stix2extensions/main/schemas/properties/report-epss-scoring.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "note-epss-scoring",
"description": "This extension adds new properties to Note SDOs to capture EPSS scores for CVEs.",
"title": "report-epss-scoring",
"description": "This extension adds new properties to Report SDOs to capture EPSS scores for CVEs.",
"type": "object",
"allOf": [
{
"$ref": "https://github.com/oasis-open/cti-stix2-json-schemas/blob/master/schemas/sdos/note.json"
"$ref": "https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/refs/heads/master/schemas/sdos/report.json"
},
{
"properties": {
Expand All @@ -24,7 +24,7 @@
},
"required": ["extension_type"]
},
"required": ["extension-definition--efd26d23-d37d-5cf2-ac95-a101e46ce11d"]
"required": ["extension-definition--f80cce10-5ac0-58d1-9e7e-b4ed0cc4dbb9"]
}
},
"x_epss": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/properties/vulnerability-scoring.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "object",
"allOf": [
{
"$ref": "https://github.com/oasis-open/cti-stix2-json-schemas/blob/master/schemas/sdos/vulnerability.json"
"$ref": "https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/refs/heads/master/schemas/sdos/vulnerability.json"
},
{
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/scos/bank-account.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "object",
"allOf": [
{
"$ref": "https://github.com/oasis-open/cti-stix2-json-schemas/blob/master/schemas/common/cyber-observable-core.json"
"$ref": "https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/refs/heads/master/schemas/common/cyber-observable-core.json"
},
{
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/scos/bank-card.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "object",
"allOf": [
{
"$ref": "https://github.com/oasis-open/cti-stix2-json-schemas/blob/master/schemas/common/cyber-observable-core.json"
"$ref": "https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/refs/heads/master/schemas/common/cyber-observable-core.json"
},
{
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/scos/cryptocurrency-transaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "object",
"allOf": [
{
"$ref": "https://github.com/oasis-open/cti-stix2-json-schemas/blob/master/schemas/common/cyber-observable-core.json"
"$ref": "https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/refs/heads/master/schemas/common/cyber-observable-core.json"
},
{
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/scos/cryptocurrency-wallet.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "object",
"allOf": [
{
"$ref": "https://github.com/oasis-open/cti-stix2-json-schemas/blob/master/schemas/common/cyber-observable-core.json"
"$ref": "https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/refs/heads/master/schemas/common/cyber-observable-core.json"
},
{
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/scos/phone-number.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "object",
"allOf": [
{
"$ref": "https://github.com/oasis-open/cti-stix2-json-schemas/blob/master/schemas/common/cyber-observable-core.json"
"$ref": "https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/refs/heads/master/schemas/common/cyber-observable-core.json"
},
{
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/scos/user-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "object",
"allOf": [
{
"$ref": "https://github.com/oasis-open/cti-stix2-json-schemas/blob/master/schemas/common/cyber-observable-core.json"
"$ref": "https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/refs/heads/master/schemas/common/cyber-observable-core.json"
},
{
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/sdos/weakness.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "object",
"allOf": [
{
"$ref": "https://github.com/oasis-open/cti-stix2-json-schemas/blob/master/schemas/common/core.json"
"$ref": "https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/refs/heads/master/schemas/common/core.json"
},
{
"properties": {
Expand Down
12 changes: 6 additions & 6 deletions stix2extensions/_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,16 @@
object_marking_refs=object_marking_refs
)

### Note EPSS Scoring SMO
### Report EPSS Scoring SMO

note_epss_scoring_ExtensionDefinitionSMO = ExtensionDefinition(
id="extension-definition--" + str(uuid.uuid5(namespace, f"note-epss-scoring")), # extension-definition--efd26d23-d37d-5cf2-ac95-a101e46ce11d
report_epss_scoring_ExtensionDefinitionSMO = ExtensionDefinition(
id="extension-definition--" + str(uuid.uuid5(namespace, f"report-epss-scoring")), # extension-definition--f80cce10-5ac0-58d1-9e7e-b4ed0cc4dbb9
created_by_ref=created_by_ref,
created=created,
modified=modified,
name="Note SDO EPSS Scoring Properties",
description="This extension adds new properties to Note SDOs to capture EPSS scores for CVEs.",
schema=schema_base+"properties/note-epss-scoring.json",
name="Report SDO EPSS Scoring Properties",
description="This extension adds new properties to Report SDOs to capture EPSS scores for CVEs.",
schema=schema_base+"properties/report-epss-scoring.json",
version="1.0",
extension_types=[
"toplevel-property-extension"
Expand Down

0 comments on commit 28cf092

Please sign in to comment.