pymisp 2.5.3__py3-none-any.whl → 2.5.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pymisp might be problematic. Click here for more details.
- CHANGELOG.txt +5380 -0
- examples/__init__.py +0 -0
- examples/add_attributes_from_csv.py +74 -0
- examples/add_email_object.py +29 -0
- examples/add_fail2ban_object.py +86 -0
- examples/add_feed.py +25 -0
- examples/add_file_object.py +47 -0
- examples/add_filetype_object_from_csv.py +53 -0
- examples/add_generic_object.py +26 -0
- examples/add_github_user.py +65 -0
- examples/add_gitlab_user.py +56 -0
- examples/add_named_attribute.py +25 -0
- examples/add_organisations.py +57 -0
- examples/add_ssh_authorized_keys.py +29 -0
- examples/add_user.py +22 -0
- examples/add_vehicle_object.py +22 -0
- examples/addtag2.py +45 -0
- examples/asciidoc_generator.py +114 -0
- examples/cache_all.py +10 -0
- examples/copyTagsFromAttributesToEvent.py +68 -0
- examples/copy_list.py +93 -0
- examples/create_events.py +26 -0
- examples/cytomic_orion.py +549 -0
- examples/del.py +22 -0
- examples/delete_user.py +16 -0
- examples/edit_organisation.py +20 -0
- examples/edit_user.py +20 -0
- examples/falsepositive_disabletoids.py +136 -0
- examples/fetch_events_feed.py +15 -0
- examples/fetch_warninglist_hits.py +38 -0
- examples/freetext.py +22 -0
- examples/generate_file_objects.py +78 -0
- examples/generate_meta_feed.py +15 -0
- examples/get.py +37 -0
- examples/get_csv.py +37 -0
- examples/get_network_activity.py +187 -0
- examples/last.py +48 -0
- examples/load_csv.py +94 -0
- examples/lookup.py +28 -0
- examples/misp2cef.py +71 -0
- examples/misp2clamav.py +52 -0
- examples/openioc_to_misp.py +27 -0
- examples/proofpoint_tap.py +203 -0
- examples/proofpoint_vap.py +65 -0
- examples/search.py +48 -0
- examples/search_attributes_yara.py +40 -0
- examples/search_sighting.py +42 -0
- examples/server_sync_check_conn.py +32 -0
- examples/sharing_groups.py +15 -0
- examples/show_sightings.py +168 -0
- examples/stats_report.py +405 -0
- examples/sync_sighting.py +171 -0
- examples/tags.py +25 -0
- examples/test_sign.py +19 -0
- examples/trustar_misp.py +59 -0
- examples/up.py +21 -0
- examples/upload.py +60 -0
- examples/users_list.py +15 -0
- examples/vmray_automation.py +281 -0
- examples/vt_to_misp.py +182 -0
- examples/warninglists.py +22 -0
- examples/yara.py +38 -0
- examples/yara_dump.py +98 -0
- pymisp/api.py +33 -5
- pymisp/data/misp-objects/objects/android-app/definition.json +8 -2
- pymisp/data/misp-objects/objects/instagram-account/definition.json +66 -0
- pymisp/data/misp-objects/objects/lnk/definition.json +13 -1
- pymisp/data/misp-objects/objects/rmm/definition.json +88 -0
- pymisp/data/misp-objects/objects/spambee-report/definition.json +54 -0
- pymisp/data/misp-objects/objects/target-system/definition.json +2 -2
- pymisp/data/misp-objects/objects/vulnerability/definition.json +5 -4
- pymisp/data/misp-objects/relationships/definition.json +17 -1
- pymisp/data/misp-objects/schema_objects.json +1 -1
- pymisp/mispevent.py +95 -23
- {pymisp-2.5.3.dist-info → pymisp-2.5.7.dist-info}/METADATA +23 -28
- {pymisp-2.5.3.dist-info → pymisp-2.5.7.dist-info}/RECORD +144 -30
- {pymisp-2.5.3.dist-info → pymisp-2.5.7.dist-info}/WHEEL +1 -1
- tests/57c4445b-c548-4654-af0b-4be3950d210f.json +1 -0
- tests/__init__.py +0 -0
- tests/csv_testfiles/invalid_fieldnames.csv +11 -0
- tests/csv_testfiles/valid_fieldnames.csv +4 -0
- tests/email_testfiles/mail_1.eml.zip +0 -0
- tests/email_testfiles/mail_1.msg +0 -0
- tests/email_testfiles/mail_1_bom.eml +858 -0
- tests/email_testfiles/mail_1_headers_only.eml +28 -0
- tests/email_testfiles/mail_2.eml +32 -0
- tests/email_testfiles/mail_3.eml +170 -0
- tests/email_testfiles/mail_3.msg +0 -0
- tests/email_testfiles/mail_4.msg +0 -0
- tests/email_testfiles/mail_5.msg +0 -0
- tests/email_testfiles/mail_multiple_to.eml +15 -0
- tests/email_testfiles/source +1 -0
- tests/git-vuln-finder-quagga.json +1493 -0
- tests/misp_event.json +76 -0
- tests/mispevent_testfiles/attribute.json +21 -0
- tests/mispevent_testfiles/attribute_del.json +23 -0
- tests/mispevent_testfiles/def_param.json +53 -0
- tests/mispevent_testfiles/event.json +8 -0
- tests/mispevent_testfiles/event_obj_attr_tag.json +57 -0
- tests/mispevent_testfiles/event_obj_def_param.json +62 -0
- tests/mispevent_testfiles/event_obj_tag.json +29 -0
- tests/mispevent_testfiles/event_tags.json +18 -0
- tests/mispevent_testfiles/existing_event.json +4599 -0
- tests/mispevent_testfiles/existing_event_edited.json +4601 -0
- tests/mispevent_testfiles/galaxy.json +25 -0
- tests/mispevent_testfiles/malware.json +19 -0
- tests/mispevent_testfiles/malware_exist.json +163 -0
- tests/mispevent_testfiles/misp_custom_obj.json +38 -0
- tests/mispevent_testfiles/overwrite_file/definition.json +457 -0
- tests/mispevent_testfiles/proposals.json +35 -0
- tests/mispevent_testfiles/shadow.json +148 -0
- tests/mispevent_testfiles/sighting.json +5 -0
- tests/mispevent_testfiles/simple.json +2 -0
- tests/mispevent_testfiles/test_object_template/definition.json +29 -0
- tests/new_misp_event.json +34 -0
- tests/reportlab_testfiles/HTML_event.json +1 -0
- tests/reportlab_testfiles/galaxy_1.json +1250 -0
- tests/reportlab_testfiles/image_event.json +2490 -0
- tests/reportlab_testfiles/japanese_test.json +156 -0
- tests/reportlab_testfiles/japanese_test_heavy.json +318 -0
- tests/reportlab_testfiles/long_event.json +3730 -0
- tests/reportlab_testfiles/mainly_objects_1.json +1092 -0
- tests/reportlab_testfiles/mainly_objects_2.json +977 -0
- tests/reportlab_testfiles/sighting_1.json +305 -0
- tests/reportlab_testfiles/sighting_2.json +221 -0
- tests/reportlab_testfiles/to_delete1.json +804 -0
- tests/reportlab_testfiles/to_delete2.json +1 -0
- tests/reportlab_testfiles/to_delete3.json +1 -0
- tests/reportlab_testfiles/very_long_event.json +1006 -0
- tests/reportlab_testoutputs/to_delete1.json.pdf +391 -0
- tests/reportlab_testoutputs/to_delete2.json.pdf +506 -0
- tests/reportlab_testoutputs/to_delete3.json.pdf +277 -0
- tests/search_index_result.json +69 -0
- tests/sharing_groups.json +98 -0
- tests/stix1.xml-utf8 +110 -0
- tests/stix2.json +1 -0
- tests/test_analyst_data.py +123 -0
- tests/test_emailobject.py +157 -0
- tests/test_fileobject.py +20 -0
- tests/test_mispevent.py +473 -0
- tests/test_reportlab.py +431 -0
- tests/testlive_comprehensive.py +3734 -0
- tests/testlive_sync.py +474 -0
- pymisp/data/misp-objects/.git +0 -1
- pymisp/data/misp-objects/.gitchangelog.rc +0 -289
- pymisp/data/misp-objects/.github/workflows/codeql.yml +0 -41
- pymisp/data/misp-objects/.github/workflows/nosetests.yml +0 -39
- pymisp/data/misp-objects/.travis.yml +0 -16
- pymisp/data/misp-objects/LICENSE-software-only.md +0 -661
- pymisp/data/misp-objects/LICENSE.md +0 -36
- pymisp/data/misp-objects/README.md +0 -566
- pymisp/data/misp-objects/docs/time-related-objects.ods +0 -0
- pymisp/data/misp-objects/docs/time-related-objects.pdf +0 -0
- pymisp/data/misp-objects/jq_all_the_things.sh +0 -29
- pymisp/data/misp-objects/tools/adoc_objects.py +0 -145
- pymisp/data/misp-objects/tools/alfred_links_to_relarelationships.py +0 -48
- pymisp/data/misp-objects/tools/list_of_objects.py +0 -50
- pymisp/data/misp-objects/tools/updated.sh +0 -6
- pymisp/data/misp-objects/tools/validate_opposites.sh +0 -17
- pymisp/data/misp-objects/unique_uuid.py +0 -16
- pymisp/data/misp-objects/validate_all.sh +0 -38
- {pymisp-2.5.3.dist-info → pymisp-2.5.7.dist-info}/LICENSE +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Seeds sponge, from moreutils
|
|
4
|
-
|
|
5
|
-
#Validate all Jsons first
|
|
6
|
-
for dir in `find . -name "*.json"`
|
|
7
|
-
do
|
|
8
|
-
echo validating ${dir}
|
|
9
|
-
# python3 -c "import json; f_in = open('${dir}'); data = json.load(f_in); f_in.close(); f_out = open('${dir}', 'w'); json.dump(data, f_out, indent=2, sort_keys=True, ensure_ascii=False); f_out.close();"
|
|
10
|
-
cat ${dir} | jq . >/dev/null
|
|
11
|
-
rc=$?
|
|
12
|
-
if [[ $rc != 0 ]]; then exit $rc; fi
|
|
13
|
-
cat ${dir} | jq -r .uuid | uuidparse
|
|
14
|
-
done
|
|
15
|
-
|
|
16
|
-
set -e
|
|
17
|
-
set -x
|
|
18
|
-
|
|
19
|
-
# Seeds sponge, from moreutils
|
|
20
|
-
|
|
21
|
-
for dir in objects/*/definition.json
|
|
22
|
-
do
|
|
23
|
-
cat ${dir} | jq -S -j . | sponge ${dir}
|
|
24
|
-
done
|
|
25
|
-
|
|
26
|
-
cat relationships/definition.json | jq -S -j . | sponge relationships/definition.json
|
|
27
|
-
|
|
28
|
-
cat schema_objects.json | jq . | sponge schema_objects.json
|
|
29
|
-
cat schema_relationships.json | jq . | sponge schema_relationships.json
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# A simple converter of MISP objects to asciidoctor format
|
|
6
|
-
# Copyright (C) 2017-2019 Alexandre Dulaunoy
|
|
7
|
-
#
|
|
8
|
-
# This program is free software: you can redistribute it and/or modify
|
|
9
|
-
# it under the terms of the GNU Affero General Public License as
|
|
10
|
-
# published by the Free Software Foundation, either version 3 of the
|
|
11
|
-
# License, or (at your option) any later version.
|
|
12
|
-
#
|
|
13
|
-
# This program is distributed in the hope that it will be useful,
|
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
# GNU Affero General Public License for more details.
|
|
17
|
-
#
|
|
18
|
-
# You should have received a copy of the GNU Affero General Public License
|
|
19
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import os
|
|
23
|
-
import json
|
|
24
|
-
import argparse
|
|
25
|
-
|
|
26
|
-
thisDir = os.path.dirname(__file__)
|
|
27
|
-
|
|
28
|
-
objects = []
|
|
29
|
-
|
|
30
|
-
pathObjects = os.path.join(thisDir, '../objects')
|
|
31
|
-
|
|
32
|
-
for f in os.listdir(pathObjects):
|
|
33
|
-
objectName = f
|
|
34
|
-
objects.append(objectName)
|
|
35
|
-
|
|
36
|
-
objects.sort()
|
|
37
|
-
|
|
38
|
-
argParser = argparse.ArgumentParser(description='Generate documentation from MISP objects', epilog='Available objects are {0}'.format(objects))
|
|
39
|
-
argParser.add_argument('-v', action='store_true', help='Verbose mode')
|
|
40
|
-
args = argParser.parse_args()
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def header(adoc=False):
|
|
44
|
-
if adoc is False:
|
|
45
|
-
return False
|
|
46
|
-
doc = adoc
|
|
47
|
-
dedication = "\n[dedication]\n== Funding and Support\nThe MISP project is financially and resource supported by https://www.circl.lu/[CIRCL Computer Incident Response Center Luxembourg ].\n\nimage:{images-misp}logo.png[CIRCL logo]\n\nA CEF (Connecting Europe Facility) funding under CEF-TC-2016-3 - Cyber Security has been granted from 1st September 2017 until 31th August 2019 as ***Improving MISP as building blocks for next-generation information sharing***.\n\nimage:{images-misp}en_cef.png[CEF funding]\n\nIf you are interested to co-fund projects around MISP, feel free to get in touch with us.\n\n"
|
|
48
|
-
doc = doc + ":toc: right\n"
|
|
49
|
-
doc = doc + ":toclevels: 1\n"
|
|
50
|
-
doc = doc + ":toc-title: MISP Objects\n"
|
|
51
|
-
doc = doc + ":icons: font\n"
|
|
52
|
-
doc = doc + ":sectanchors:\n"
|
|
53
|
-
doc = doc + ":sectlinks:\n"
|
|
54
|
-
doc = doc + ":images-cdn: https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/logos/\n"
|
|
55
|
-
doc = doc + ":images-misp: https://www.misp-project.org/assets/images/\n"
|
|
56
|
-
doc = doc + "\n= MISP Objects\n\n"
|
|
57
|
-
doc = doc + "= Introduction\n"
|
|
58
|
-
doc = doc + "\nimage::{images-cdn}misp-logo.png[MISP logo]\n"
|
|
59
|
-
doc = doc + "The MISP threat sharing platform is a free and open source software helping information sharing of threat intelligence including cyber security indicators, financial fraud or counter-terrorism information. The MISP project includes multiple sub-projects to support the operational requirements of analysts and improve the overall quality of information shared.\n\n"
|
|
60
|
-
doc = doc + ""
|
|
61
|
-
doc = "{}{}".format(doc, "\nMISP objects are used in MISP (starting from version 2.4.80) system and can be used by other information sharing tool. MISP objects are in addition to MISP attributes to allow advanced combinations of attributes. The creation of these objects and their associated attributes are based on real cyber security use-cases and existing practices in information sharing. The objects are just shared like any other attributes in MISP even if the other MISP instances don't have the template of the object.\n")
|
|
62
|
-
doc = doc + "The following document is generated from the machine-readable JSON describing the https://github.com/MISP/misp-objects[MISP objects]."
|
|
63
|
-
doc = doc + "\n\n"
|
|
64
|
-
doc = doc + "<<<\n"
|
|
65
|
-
doc = doc + dedication
|
|
66
|
-
doc = doc + "<<<\n"
|
|
67
|
-
doc = doc + "= MISP objects\n"
|
|
68
|
-
return doc
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def asciidoc(content=False, adoc=None, t='title', title=''):
|
|
72
|
-
|
|
73
|
-
adoc = adoc + "\n"
|
|
74
|
-
output = ""
|
|
75
|
-
if t == 'title':
|
|
76
|
-
output = '== ' + content
|
|
77
|
-
elif t == 'info':
|
|
78
|
-
content = content.rstrip('.')
|
|
79
|
-
output = "\n{}.\n\n{} {} {}{}/definition.json[*this location*] {}.\n".format(content, 'NOTE: ', title, 'is a MISP object available in JSON format at https://github.com/MISP/misp-objects/blob/main/objects/', title.lower(), ' The JSON format can be freely reused in your application or automatically enabled in https://www.github.com/MISP/MISP[MISP]')
|
|
80
|
-
elif t == 'author':
|
|
81
|
-
output = '\nauthors:: {}\n'.format(' - '.join(content))
|
|
82
|
-
elif t == 'value':
|
|
83
|
-
output = '=== ' + content
|
|
84
|
-
elif t == 'description':
|
|
85
|
-
content = content.rstrip('.')
|
|
86
|
-
output = '\n{}\n'.format(content)
|
|
87
|
-
elif t == 'attributes':
|
|
88
|
-
# output = '\n{}\n'.format
|
|
89
|
-
# output = '[cols=\",a\"]\n'
|
|
90
|
-
output = output + '|===\n'
|
|
91
|
-
output = output + '|Object attribute | MISP attribute type | Description | Disable correlation | Multiple\n'
|
|
92
|
-
adoc = adoc + output
|
|
93
|
-
for v in content['attributes']:
|
|
94
|
-
disableCorrelation = 'icon:minus[] '
|
|
95
|
-
description = 'icon:minus[] '
|
|
96
|
-
multiple = 'icon:minus[] '
|
|
97
|
-
if 'disable_correlation' in content['attributes'][v]:
|
|
98
|
-
if content['attributes'][v]['disable_correlation']:
|
|
99
|
-
disableCorrelation = 'icon:check[] '
|
|
100
|
-
if 'multiple' in content['attributes'][v]:
|
|
101
|
-
if content['attributes'][v]['multiple']:
|
|
102
|
-
multiple = 'icon:check[] '
|
|
103
|
-
if 'description' in content['attributes'][v]:
|
|
104
|
-
if content['attributes'][v]['description']:
|
|
105
|
-
description = '{}'.format(content['attributes'][v]['description'])
|
|
106
|
-
if 'values_list' in content['attributes'][v]:
|
|
107
|
-
values = content['attributes'][v]['values_list']
|
|
108
|
-
description = '{} {}'.format(content['attributes'][v]['description'], values)
|
|
109
|
-
if 'sane_default' in content['attributes'][v]:
|
|
110
|
-
values = content['attributes'][v]['sane_default']
|
|
111
|
-
description = '{} {}'.format(content['attributes'][v]['description'], values)
|
|
112
|
-
output = '\n| {} | {} a| {} a| {} a| {}\n'.format(v, content['attributes'][v]['misp-attribute'], description, disableCorrelation, multiple)
|
|
113
|
-
adoc = adoc + output
|
|
114
|
-
output = '\n|===\n'
|
|
115
|
-
adoc = adoc + output
|
|
116
|
-
return adoc
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
adoc = ""
|
|
120
|
-
print(header(adoc=adoc))
|
|
121
|
-
|
|
122
|
-
for mispobject in objects:
|
|
123
|
-
fullPathClusters = os.path.join(pathObjects, '{}/{}'.format(mispobject, 'definition.json'))
|
|
124
|
-
with open(fullPathClusters) as fp:
|
|
125
|
-
c = json.load(fp)
|
|
126
|
-
title = c['name']
|
|
127
|
-
adoc = asciidoc(content=title, adoc=adoc, t='title')
|
|
128
|
-
adoc = asciidoc(content=c['description'], adoc=adoc, t='info', title=title)
|
|
129
|
-
adoc = asciidoc(content=c, adoc=adoc, t='attributes', title=title)
|
|
130
|
-
|
|
131
|
-
with open('../relationships/definition.json') as filerelationships:
|
|
132
|
-
rel = json.load(filerelationships)
|
|
133
|
-
|
|
134
|
-
output = '== Relationships\n'
|
|
135
|
-
output = output + '\n{}\n'.format(rel['description'])
|
|
136
|
-
output = output + '\nRelationships are part of MISP object and available in JSON format at https://github.com/MISP/misp-objects/blob/main/relationships/definition.json[this location]. The JSON format can be freely reused in your application or automatically enabled in https://www.github.com/MISP/MISP[MISP].\n'
|
|
137
|
-
output = output + '|===\n'
|
|
138
|
-
output = output + '|Name of relationship | Description | Format\n'
|
|
139
|
-
for relationship in rel['values']:
|
|
140
|
-
output = output + '\n| {} | {} | {}\n'.format(relationship['name'], relationship['description'], str(relationship['format']))
|
|
141
|
-
output = output + '\n|===\n'
|
|
142
|
-
adoc = adoc + output
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
print(adoc)
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
import json
|
|
6
|
-
|
|
7
|
-
name_ontology = 'alfred'
|
|
8
|
-
|
|
9
|
-
relationships_path = Path('..', 'relationships', 'definition.json')
|
|
10
|
-
|
|
11
|
-
with open(relationships_path) as f:
|
|
12
|
-
relationships = json.load(f)
|
|
13
|
-
|
|
14
|
-
rel_fast_lookup = {entry['name']: entry for entry in relationships['values']}
|
|
15
|
-
|
|
16
|
-
ontology_path = Path('alfred-ontology.json')
|
|
17
|
-
|
|
18
|
-
with open(ontology_path) as f:
|
|
19
|
-
ontology = json.load(f)
|
|
20
|
-
|
|
21
|
-
links = ontology['data']['linkTypes']
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
for linktype in links:
|
|
25
|
-
link_name = linktype['name'].lower().replace('_', '-')
|
|
26
|
-
link_description = linktype['description']
|
|
27
|
-
if link_name in rel_fast_lookup:
|
|
28
|
-
if rel_fast_lookup[link_name]['description'] != link_description:
|
|
29
|
-
print(link_name)
|
|
30
|
-
print('\t MISP:', rel_fast_lookup[link_name]['description'])
|
|
31
|
-
print('\t Alfred:', link_description)
|
|
32
|
-
for entry in relationships['values']:
|
|
33
|
-
if entry['name'] == link_name:
|
|
34
|
-
if name_ontology not in entry['format']:
|
|
35
|
-
entry['format'].append(name_ontology)
|
|
36
|
-
break
|
|
37
|
-
# Update the fast lookup to avoid duplicates.
|
|
38
|
-
rel_fast_lookup = {entry['name']: entry for entry in relationships['values']}
|
|
39
|
-
else:
|
|
40
|
-
if link_name not in rel_fast_lookup:
|
|
41
|
-
linktype['name'] = link_name
|
|
42
|
-
linktype['format'] = [name_ontology]
|
|
43
|
-
relationships['values'].append(linktype)
|
|
44
|
-
else:
|
|
45
|
-
print("Duplicate", link_name)
|
|
46
|
-
|
|
47
|
-
with open(relationships_path, 'w') as f:
|
|
48
|
-
json.dump(relationships, f, indent=2)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# A simple converter of MISP objects to asciidoctor format
|
|
6
|
-
# Copyright (C) 2017-2021 Alexandre Dulaunoy
|
|
7
|
-
#
|
|
8
|
-
# This program is free software: you can redistribute it and/or modify
|
|
9
|
-
# it under the terms of the GNU Affero General Public License as
|
|
10
|
-
# published by the Free Software Foundation, either version 3 of the
|
|
11
|
-
# License, or (at your option) any later version.
|
|
12
|
-
#
|
|
13
|
-
# This program is distributed in the hope that it will be useful,
|
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
# GNU Affero General Public License for more details.
|
|
17
|
-
#
|
|
18
|
-
# You should have received a copy of the GNU Affero General Public License
|
|
19
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import os
|
|
23
|
-
import json
|
|
24
|
-
import argparse
|
|
25
|
-
|
|
26
|
-
thisDir = os.path.dirname(__file__)
|
|
27
|
-
|
|
28
|
-
objects = []
|
|
29
|
-
|
|
30
|
-
pathObjects = os.path.join(thisDir, '../objects')
|
|
31
|
-
|
|
32
|
-
for f in os.listdir(pathObjects):
|
|
33
|
-
objectName = f
|
|
34
|
-
objects.append(objectName)
|
|
35
|
-
|
|
36
|
-
objects.sort()
|
|
37
|
-
|
|
38
|
-
argParser = argparse.ArgumentParser(description='Generate list of MISP object templates', epilog='Available objects are {0}'.format(objects))
|
|
39
|
-
argParser.add_argument('-v', action='store_true', help='Verbose mode')
|
|
40
|
-
args = argParser.parse_args()
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
for mispobject in objects:
|
|
44
|
-
fullPathClusters = os.path.join(pathObjects, '{}/{}'.format(mispobject, 'definition.json'))
|
|
45
|
-
with open(fullPathClusters) as fp:
|
|
46
|
-
c = json.load(fp)
|
|
47
|
-
if not c['description'].endswith('.'):
|
|
48
|
-
c['description'] = c['description'] + "."
|
|
49
|
-
v = "- [objects/{}](https://github.com/MISP/misp-objects/blob/main/objects/{}/definition.json) - {}".format(c['name'], c['name'], c['description'])
|
|
50
|
-
print(v)
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
opposites=$(cat relationships/definition.json | grep '"opposite"' | cut -d ':' -f 2 | tr -d ' ' | tr -d '"')
|
|
4
|
-
|
|
5
|
-
for opposite in $opposites
|
|
6
|
-
do
|
|
7
|
-
cat relationships/definition.json | grep '"name": "'$opposite'"' >/dev/null 2>&1
|
|
8
|
-
res=$?
|
|
9
|
-
if [ "$res" -eq 1 ]
|
|
10
|
-
then
|
|
11
|
-
echo "'$opposite' not found"
|
|
12
|
-
exit 1
|
|
13
|
-
fi
|
|
14
|
-
done
|
|
15
|
-
|
|
16
|
-
echo "OK, all opposites seem to point to existing relationships"
|
|
17
|
-
exit 0
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
from glob import glob
|
|
5
|
-
import json
|
|
6
|
-
from typing import Dict
|
|
7
|
-
|
|
8
|
-
all_uuids: Dict[str, str] = {}
|
|
9
|
-
for definition in glob('./objects/*/definition.json'):
|
|
10
|
-
with open(definition, 'r') as f:
|
|
11
|
-
d = json.load(f)
|
|
12
|
-
uuid = d['uuid']
|
|
13
|
-
name = d['name']
|
|
14
|
-
if all_uuids.get(uuid):
|
|
15
|
-
raise Exception('Same uuid for {} and {} ({})'.format(name, all_uuids.get(uuid), uuid))
|
|
16
|
-
all_uuids[uuid] = name
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
set -e
|
|
4
|
-
set -x
|
|
5
|
-
|
|
6
|
-
./jq_all_the_things.sh
|
|
7
|
-
|
|
8
|
-
diffs=`git status --porcelain | wc -l`
|
|
9
|
-
|
|
10
|
-
if ! [ $diffs -eq 0 ]; then
|
|
11
|
-
echo "ERROR: Please make sure you run ./jq_all_the_things.sh before doing a PR."
|
|
12
|
-
exit 1
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
# remove the exec flag on the json files
|
|
16
|
-
find -name "*.json" -exec chmod -x "{}" \;
|
|
17
|
-
|
|
18
|
-
diffs=`git status --porcelain | wc -l`
|
|
19
|
-
|
|
20
|
-
if ! [ $diffs -eq 0 ]; then
|
|
21
|
-
echo "ERROR: Please make sure you run remove the executable flag on the json files before doing a PR: find -name "*.json" -exec chmod -x \"{}\" \\;"
|
|
22
|
-
exit 1
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
for dir in objects/*/definition.json
|
|
27
|
-
do
|
|
28
|
-
echo -n "${dir}: "
|
|
29
|
-
jsonschema -i ${dir} schema_objects.json
|
|
30
|
-
echo ''
|
|
31
|
-
done
|
|
32
|
-
|
|
33
|
-
jsonschema -i relationships/definition.json schema_relationships.json
|
|
34
|
-
./tools/validate_opposites.sh
|
|
35
|
-
|
|
36
|
-
./unique_uuid.py
|
|
37
|
-
|
|
38
|
-
echo "Success: All is fine, please go ahead.".
|
|
File without changes
|