arango-cve-processor 0.0.2__tar.gz

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.
Files changed (51) hide show
  1. arango_cve_processor-0.0.2/.env.example +5 -0
  2. arango_cve_processor-0.0.2/.env.markdown +30 -0
  3. arango_cve_processor-0.0.2/.github/workflows/create-release.yml +71 -0
  4. arango_cve_processor-0.0.2/.gitignore +164 -0
  5. arango_cve_processor-0.0.2/LICENSE +202 -0
  6. arango_cve_processor-0.0.2/PKG-INFO +149 -0
  7. arango_cve_processor-0.0.2/README.md +129 -0
  8. arango_cve_processor-0.0.2/arango_cve_processor/__init__.py +0 -0
  9. arango_cve_processor-0.0.2/arango_cve_processor/__main__.py +88 -0
  10. arango_cve_processor-0.0.2/arango_cve_processor/config.py +31 -0
  11. arango_cve_processor-0.0.2/arango_cve_processor/managers/__init__.py +6 -0
  12. arango_cve_processor-0.0.2/arango_cve_processor/managers/base_manager.py +206 -0
  13. arango_cve_processor-0.0.2/arango_cve_processor/managers/cve_attack.py +25 -0
  14. arango_cve_processor-0.0.2/arango_cve_processor/managers/cve_capec.py +68 -0
  15. arango_cve_processor-0.0.2/arango_cve_processor/managers/cve_cwe.py +68 -0
  16. arango_cve_processor-0.0.2/arango_cve_processor/managers/cve_epss.py +168 -0
  17. arango_cve_processor-0.0.2/arango_cve_processor/managers/cve_kev.py +95 -0
  18. arango_cve_processor-0.0.2/arango_cve_processor/tools/epss.py +79 -0
  19. arango_cve_processor-0.0.2/arango_cve_processor/tools/retriever.py +72 -0
  20. arango_cve_processor-0.0.2/arango_cve_processor/tools/utils.py +104 -0
  21. arango_cve_processor-0.0.2/arango_cve_processor.py +3 -0
  22. arango_cve_processor-0.0.2/docs/README.md +50 -0
  23. arango_cve_processor-0.0.2/docs/arango_cve_processor.png +0 -0
  24. arango_cve_processor-0.0.2/docs/cve-attack.md +85 -0
  25. arango_cve_processor-0.0.2/docs/cve-capec.md +85 -0
  26. arango_cve_processor-0.0.2/docs/cve-cwe.md +105 -0
  27. arango_cve_processor-0.0.2/docs/cve-epss.md +86 -0
  28. arango_cve_processor-0.0.2/docs/cve-kev.md +76 -0
  29. arango_cve_processor-0.0.2/pyproject.toml +32 -0
  30. arango_cve_processor-0.0.2/requirements.txt +27 -0
  31. arango_cve_processor-0.0.2/tests/NOTES.md +691 -0
  32. arango_cve_processor-0.0.2/tests/README.md +118 -0
  33. arango_cve_processor-0.0.2/tests/files/base_cves.json +174 -0
  34. arango_cve_processor-0.0.2/tests/files/base_cves_update_1.json +166 -0
  35. arango_cve_processor-0.0.2/tests/files/base_cves_update_2.json +151 -0
  36. arango_cve_processor-0.0.2/tests/test_01_00_cve_cwe.py +119 -0
  37. arango_cve_processor-0.0.2/tests/test_01_01_cve_cwe_update_1.py +95 -0
  38. arango_cve_processor-0.0.2/tests/test_01_02_cve_cwe_update_2.py +95 -0
  39. arango_cve_processor-0.0.2/tests/test_02_00_cve_capec.py +137 -0
  40. arango_cve_processor-0.0.2/tests/test_03_00_cve_attack.py +129 -0
  41. arango_cve_processor-0.0.2/tests/test_04_00_cve_epss.py +98 -0
  42. arango_cve_processor-0.0.2/tests/test_05_00_cve_kev.py +96 -0
  43. arango_cve_processor-0.0.2/tests/test_06_00_cve_cli_arg_cve_cwe.py +118 -0
  44. arango_cve_processor-0.0.2/tests/test_06_01_cve_cli_arg_cve_kev.py +97 -0
  45. arango_cve_processor-0.0.2/tests/test_07_00_modified_min.py +117 -0
  46. arango_cve_processor-0.0.2/tests/test_08_00_created_min.py +117 -0
  47. arango_cve_processor-0.0.2/tests/test_09_00_ignore_embedded_relationships_f.py +80 -0
  48. arango_cve_processor-0.0.2/tests/test_10_00_ignore_embedded_relationships_t.py +79 -0
  49. arango_cve_processor-0.0.2/tests/test_11_00_cve_id_flag.py +81 -0
  50. arango_cve_processor-0.0.2/tests/upload.py +37 -0
  51. arango_cve_processor-0.0.2/utilities/QUICKSTART.md +9 -0
@@ -0,0 +1,5 @@
1
+ ARANGODB_HOST_URL=
2
+ ARANGODB_USERNAME=
3
+ ARANGODB_PASSWORD=
4
+ CTIBUTLER_BASE_URL=
5
+ CTIBUTLER_API_KEY=
@@ -0,0 +1,30 @@
1
+ # Environment file info
2
+
3
+ If you're running in production, you should set these securely.
4
+
5
+ However, if you just want to experiment, set the following values
6
+
7
+ ## ArangoDB settings
8
+
9
+ Note, this code assumes an ArangoDB server is running and the user specified in the `.env` file has access to read and write the database entered at the command line and that it has the following collection names;
10
+
11
+ * `nvd_cve_vertex_collection`/`nvd_cve_edge_collection`
12
+
13
+ [These utilities in stix2arango will do this automatically for you](https://github.com/muchdogesec/stix2arango/tree/main/utilities/arango_cve_processor).
14
+
15
+ The ArangoDB settings you need to configure are:
16
+
17
+ * `ARANGODB_HOST_URL`: `'http://127.0.0.1:8529'`
18
+ * If you are running ArangoDB remotely, make sure to include the port used.
19
+ * `ARANGODB_USERNAME`: `root`
20
+ * Change this if needed (needs to have r/w access to the database and collections)
21
+ * `ARANGODB_PASSWORD`: USE PASSWORD OF ARANGODB_USERNAME
22
+
23
+ ## CTIBUTLER
24
+
25
+ Arango CVE Processor requires [ctibutler](https://github.com/muchdogesec/ctibutler) to lookup ATT&CK, CAPEC, and CWE relationships.
26
+
27
+ * `CTIBUTLER_BASE_URL`: `'http://api.ctibutler.com'` (recommended)
28
+ * If you are running CTI Butler locally, be sure to set `'http://host.docker.internal:8006/api/'` in the `.env` file otherwise you will run into networking errors.
29
+ * `CTIBUTLER_API_KEY`:
30
+ * If using `'http://api.ctibutler.com'`, [get your API key here](http://app.ctibutler.com). Not required if running locally.
@@ -0,0 +1,71 @@
1
+ name: Create Release
2
+ run-name: Creating release
3
+
4
+ on:
5
+ workflow_dispatch:
6
+ push:
7
+ branches:
8
+ - 'main'
9
+
10
+ jobs:
11
+ create-release:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write
15
+ id-token: write
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.11"
24
+
25
+ - name: Install build dependencies
26
+ run: python3 -m pip install build hatchling
27
+
28
+ - name: Extract version from pyproject.toml
29
+ id: get-version
30
+ run: |
31
+ VERSION=$(python -m hatchling version)
32
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
33
+
34
+ - name: Build package
35
+ run: python3 -m build
36
+
37
+ - name: Determine release tag
38
+ id: release-tag
39
+ run: |
40
+ if [[ "${{ github.ref_name }}" == "main" ]]; then
41
+ echo "tag=${{ steps.get-version.outputs.version }}" >> $GITHUB_OUTPUT
42
+ else
43
+ echo "tag=${{ steps.get-version.outputs.version }}-beta-$(date +"%Y-%m-%d-%H-%M-%S")" >> $GITHUB_OUTPUT
44
+ fi
45
+
46
+ - name: Create GitHub Release
47
+ env:
48
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49
+ run: |
50
+ TAG="${{ steps.release-tag.outputs.tag }}"
51
+ gh release create "$TAG" --repo "${{ github.repository }}" --notes ""
52
+ gh release upload "$TAG" dist/** --repo "${{ github.repository }}"
53
+
54
+ - name: Clean up old beta releases (keep latest 10)
55
+ if: github.ref_name != 'main'
56
+ env:
57
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58
+ run: |
59
+ gh release list --limit 100 --repo "${{ github.repository }}" --json tagName,createdAt \
60
+ | jq -r '.[] | select(.tagName | test("-beta-")) | [.tagName, .createdAt] | @tsv' \
61
+ | sort -k2 -r \
62
+ | tail -n +11 \
63
+ | cut -f1 \
64
+ | while read old_tag; do
65
+ echo "Deleting old beta release: $old_tag"
66
+ gh release delete "$old_tag" --repo "${{ github.repository }}" --cleanup-tag --yes
67
+ done
68
+
69
+ - name: Publish package distributions to PyPI
70
+ if: github.ref_name == 'main'
71
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,164 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ #.idea/
163
+ .DS_Store
164
+ arango_cve_processor-venv/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2020 DOGESEC (https://www.dogesec.com/)
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: arango_cve_processor
3
+ Version: 0.0.2
4
+ Summary: A package containing the stix definitions for custom objects used at dogesec
5
+ Project-URL: Homepage, https://github.com/muchdogesec/arango_cve_processor
6
+ Project-URL: Issues, https://github.com/muchdogesec/arango_cve_processor/issues
7
+ Author-email: DOGESEC <support@dogesec.com>
8
+ License-File: LICENSE
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.9
13
+ Requires-Dist: jsonschema>=4.22.0; python_version >= '3.8'
14
+ Requires-Dist: python-arango>=7.9.1; python_version >= '3.8'
15
+ Requires-Dist: requests>=2.32.4; python_version >= '3.7'
16
+ Requires-Dist: stix2
17
+ Requires-Dist: stix2arango
18
+ Requires-Dist: tqdm>=4.66.4; python_version >= '3.7'
19
+ Description-Content-Type: text/markdown
20
+
21
+ # Arango CVE Processor
22
+
23
+ ## Before you get started
24
+
25
+ Arango CVE Processor is built into [Vulmatch](https://github.com/muchdogesec/vulmatch) which also handles the download of CVE objects (what you need for ACVEP to work). As such, [Vulmatch](https://github.com/muchdogesec/vulmatch) is probably better suited to what you're looking for.
26
+
27
+ ## tl;dr
28
+
29
+ ![](docs/arango_cve_processor.png)
30
+
31
+ A small script that enriches CVEs to other sources with all data stored as STIX 2.1 objects.
32
+
33
+ [![arango_cve_processor](https://img.youtube.com/vi/J_LbAzoUpd4/0.jpg)](https://www.youtube.com/watch?v=J_LbAzoUpd4)
34
+
35
+ [Watch the demo](https://www.youtube.com/watch?v=J_LbAzoUpd4).
36
+
37
+ ## Overview
38
+
39
+ Here at DOGESEC we work with a lot of CVE data across our products. [cve2stix](https://github.com/muchdogesec/cve2stix) generates core STIX 2.1 Vulnerability objects from CVE data.
40
+
41
+ However, we have lots of other sources (EPSS, KEV, ATT&CK...) that we want to enrich this data with.
42
+
43
+ We built Arango CVE Processor to handle the generation and maintenance of these enrichments.
44
+
45
+ In short, Arango CVE Processor is a script that;
46
+
47
+ 1. reads the ingested CVE STIX data in ArangoDB
48
+ 2. creates STIX objects to represent the relationships between CVE and other datasets
49
+
50
+ ## Usage
51
+
52
+ ### Install the script
53
+
54
+ ```shell
55
+ # clone the latest code
56
+ git clone https://github.com/muchdogesec/arango_cve_processor
57
+ # create a venv
58
+ cd arango_cve_processor
59
+ python3 -m venv arango_cve_processor-venv
60
+ source arango_cve_processor-venv/bin/activate
61
+ # install requirements
62
+ pip3 install -r requirements.txt
63
+ ````
64
+
65
+ ### Configuration options
66
+
67
+ Arango CVE Processor has various settings that are defined in an `.env` file.
68
+
69
+ To create a template for the file:
70
+
71
+ ```shell
72
+ cp .env.example .env
73
+ ```
74
+
75
+ To see more information about how to set the variables, and what they do, read the `.env.markdown` file.
76
+
77
+ ### Run
78
+
79
+ ```shell
80
+ python3 arango_cve_processor.py \
81
+ --database DATABASE \
82
+ --relationship RELATIONSHIP \
83
+ --ignore_embedded_relationships BOOLEAN \
84
+ --modified_min DATE \
85
+ --cve_id CVE-NNNN-NNNN CVE-NNNN-NNNN
86
+ ```
87
+
88
+ Where;
89
+
90
+ * `--database` (required): the arangoDB database name where the objects you want to link are found. It must contain the collections `nvd_cve_vertex_collection` and `nvd_cve_edge_collection`
91
+ * `--relationship` (optional, dictionary): you can apply updates to certain relationships at run time. Default is all. Note, you should ensure your `database` contains all the required seeded data. User can select from;
92
+ * `cve-cwe`
93
+ * `cve-capec`
94
+ * `cve-attack`
95
+ * `cve-epss`
96
+ * `cve-kev`
97
+ * `--ignore_embedded_relationships` (optional, boolean). Default is `false`. if `true` passed, this will stop any embedded relationships from being generated. This is a stix2arango feature where STIX SROs will also be created for `_ref` and `_refs` properties inside each object (e.g. if `_ref` property = `identity--1234` and SRO between the object with the `_ref` property and `identity--1234` will be created). See stix2arango docs for more detail if required, essentially this a wrapper for the same `--ignore_embedded_relationships` setting implemented by stix2arango
98
+ * `--ignore_embedded_relationships_sro` (optional): boolean, if `true` passed, will stop any embedded relationships from being generated from SRO objects (`type` = `relationship`). Default is `false`
99
+ * `--ignore_embedded_relationships_smo` (optional): boolean, if `true` passed, will stop any embedded relationships from being generated from SMO objects (`type` = `marking-definition`, `extension-definition`, `language-content`). Default is `false`
100
+ * `--modified_min` (optional, date in format `YYYY-MM-DD`). By default arango_cve_processor will consider all CVEs in the database specified with the property `_is_latest==true` (that is; the latest version of the object). Using this flag with a modified time value will further filter the results processed by arango_cve_processor to STIX objects with a `modified` time >= to the value specified. This is useful when you don't want to process data for very old CVEs in the database.
101
+ * `--created_min` (optional, date in format `YYYY-MM-DD`). Same as `modified_min` but considers `created` date.
102
+ * `--cve_id` (optional, CVE ID): will only process the relationships for the CVE passed, otherwise all CVEs will be considered.
103
+
104
+ ### Examples
105
+
106
+ Process CVE -> CWE relationships for all CVEs modified after 2023-01-01 and only created embedded relationships from SDOs and SCOs...
107
+
108
+ ```shell
109
+ python3 arango_cve_processor.py \
110
+ --database arango_cve_processor_standard_tests_database \
111
+ --relationship cve-cwe \
112
+ --modified_min 2024-02-01 \
113
+ --ignore_embedded_relationships true \
114
+ --ignore_embedded_relationships_sro true \
115
+ --ignore_embedded_relationships_smo true
116
+ ```
117
+
118
+ Get all EPSS scores for CVEs
119
+
120
+ ```shell
121
+ python3 arango_cve_processor.py \
122
+ --database arango_cve_processor_standard_tests_database \
123
+ --relationship cve-epss \
124
+ --ignore_embedded_relationships false \
125
+ --ignore_embedded_relationships_sro true \
126
+ --ignore_embedded_relationships_smo true
127
+ ```
128
+
129
+ ## Backfilling data
130
+
131
+ [stix2arango contains a set of utility scripts that can be used to backfill all the datasources required for this test](https://github.com/muchdogesec/stix2arango/tree/main/utilities).
132
+
133
+ ## How it works
134
+
135
+ If you would like to know how the logic of this script works in detail, please consult the `/docs` directory.
136
+
137
+ ## Useful supporting tools
138
+
139
+ * To generate STIX 2.1 extensions: [stix2 Python Lib](https://stix2.readthedocs.io/en/latest/)
140
+ * STIX 2.1 specifications for objects: [STIX 2.1 docs](https://docs.oasis-open.org/cti/stix/v2.1/stix-v2.1.html)
141
+ * [ArangoDB docs](https://www.arangodb.com/docs/stable/)
142
+
143
+ ## Support
144
+
145
+ [Minimal support provided via the DOGESEC community](https://community.dogesec.com/).
146
+
147
+ ## License
148
+
149
+ [Apache 2.0](/LICENSE).