panther_analysis_tool 1.0.0__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.
- panther_analysis_tool-1.0.0/LICENSE.txt +203 -0
- panther_analysis_tool-1.0.0/PKG-INFO +420 -0
- panther_analysis_tool-1.0.0/README.md +334 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/__init__.py +0 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/analysis_utils.py +571 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/__init__.py +0 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/client.py +624 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/errors.py +25 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/async_bulk_upload.graphql +5 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/async_bulk_upload_status.graphql +35 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/bulk_upload.graphql +31 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/create_or_update_schema.graphql +14 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/create_perf_test.graphql +39 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/delete_detections.graphql +6 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/delete_saved_queries.graphql +6 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/feature_flags.graphql +8 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/generate_enriched_event.graphql +5 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/get_rule_body.graphql +14 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/get_version.graphql +5 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/introspection_query.graphql +88 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/list_schemas.graphql +16 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/metrics.graphql +9 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/replay.graphql +37 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/stop_replay.graphql +47 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/test_correlation_rule.graphql +9 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/transpile_filters.graphql +5 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/transpile_sdl.graphql +5 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/validate_bulk_upload.graphql +5 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/graphql/validate_bulk_upload_status.graphql +12 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/lambda_client.py +341 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/mocks.py +101 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/backend/public_api_client.py +707 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/cli_output.py +67 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/command/__init__.py +0 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/command/benchmark.py +287 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/command/bulk_delete.py +173 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/command/check_connection.py +17 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/command/standard_args.py +28 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/command/validate.py +45 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/constants.py +108 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/destination.py +10 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/detection_schemas/__init__.py +0 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/detection_schemas/analysis_config_schema.json +1659 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/directory.py +26 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/enriched_event.py +82 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/enriched_event_generator.py +216 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/immutable.py +184 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/log_schemas/__init__.py +0 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/log_schemas/user_defined.py +351 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/main.py +2491 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/schema_regexs.py +359 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/schemas.py +320 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/testing.py +238 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/util.py +294 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/validation.py +145 -0
- panther_analysis_tool-1.0.0/panther_analysis_tool/zip_chunker.py +195 -0
- panther_analysis_tool-1.0.0/pyproject.toml +160 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity granting the License.
|
|
13
|
+
|
|
14
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
15
|
+
other entities that control, are controlled by, or are under common
|
|
16
|
+
control with such entity. For the purposes of this definition,
|
|
17
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
18
|
+
direction or management of such entity, whether by contract or
|
|
19
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
20
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
21
|
+
|
|
22
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
23
|
+
exercising permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
26
|
+
including but not limited to software source code, documentation
|
|
27
|
+
source, and configuration files.
|
|
28
|
+
|
|
29
|
+
"Object" form shall mean any form resulting from mechanical
|
|
30
|
+
transformation or translation of a Source form, including but
|
|
31
|
+
not limited to compiled object code, generated documentation,
|
|
32
|
+
and conversions to other media types.
|
|
33
|
+
|
|
34
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
35
|
+
Object form, made available under the License, as indicated by a
|
|
36
|
+
copyright notice that is included in or attached to the work
|
|
37
|
+
(which shall not include Communication related to the current
|
|
38
|
+
License).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based upon (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and derivative works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control
|
|
57
|
+
systems, and issue tracking systems that are managed by, or on behalf
|
|
58
|
+
of, the Licensor for the purpose of discussing and improving the Work,
|
|
59
|
+
but excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to use, reproduce, modify, distribute, prepare
|
|
70
|
+
Derivative Works of, and publicly perform and display the Work and such
|
|
71
|
+
Derivative Works in all media and formats whether now known or
|
|
72
|
+
hereafter devised.
|
|
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" 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 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 notice 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. Disclaimer of Warranty. Unless required by applicable law or
|
|
140
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
141
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
142
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
143
|
+
implied, including, without limitation, any warranties or conditions
|
|
144
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
145
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
146
|
+
appropriateness of using or redistributing the Work and assume any
|
|
147
|
+
risks associated with Your exercise of permissions under this License.
|
|
148
|
+
|
|
149
|
+
7. Limitation of Liability. In no event and under no legal theory,
|
|
150
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
151
|
+
unless required by applicable law (such as deliberate and grossly
|
|
152
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
153
|
+
liable to You for damages, including any direct, indirect, special,
|
|
154
|
+
incidental, or consequential damages of any character arising as a
|
|
155
|
+
result of this License or out of the use or inability to use the
|
|
156
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
157
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
158
|
+
other commercial damages or losses), even if such Contributor
|
|
159
|
+
has been advised of the possibility of such damages.
|
|
160
|
+
|
|
161
|
+
8. Accepting Warranty or Support. You may choose to offer, and to
|
|
162
|
+
charge a fee for, warranty, support, indemnity or other liability
|
|
163
|
+
obligations and/or rights consistent with this License. However, in
|
|
164
|
+
accepting such obligations, You may act only on Your own behalf and on
|
|
165
|
+
Your sole responsibility, not on behalf of any other Contributor, and
|
|
166
|
+
only if You agree to indemnify, defend, and hold each Contributor
|
|
167
|
+
harmless for any liability incurred by, or claims asserted against,
|
|
168
|
+
such Contributor by reason of your accepting any such warranty or support.
|
|
169
|
+
|
|
170
|
+
9. Acceptance and Termination. Nothing in this License shall be deemed
|
|
171
|
+
to create any relationship of agency, partnership, or joint venture
|
|
172
|
+
between Licensor and You. This License does not grant permission to
|
|
173
|
+
use the trade names, trademarks, service marks, or product names of the
|
|
174
|
+
Licensor, except as required for reasonable and customary use in
|
|
175
|
+
describing the origin of the Work and reproducing the content of
|
|
176
|
+
the NOTICE file.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright [yyyy] [name of copyright owner]
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: panther_analysis_tool
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Panther command line interface for writing, testing, and packaging policies/rules.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Keywords: Security,CLI
|
|
7
|
+
Author: Panther Labs Inc
|
|
8
|
+
Author-email: pypi@runpanther.io
|
|
9
|
+
Requires-Python: >=3.11, <4.0
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Topic :: Security
|
|
15
|
+
Requires-Dist: aiohappyeyeballs (==2.4.6)
|
|
16
|
+
Requires-Dist: aiohttp (==3.11.12)
|
|
17
|
+
Requires-Dist: aiosignal (==1.3.2)
|
|
18
|
+
Requires-Dist: anyio (==4.8.0)
|
|
19
|
+
Requires-Dist: appdirs (==1.4.4)
|
|
20
|
+
Requires-Dist: async-timeout (==5.0.1)
|
|
21
|
+
Requires-Dist: attrs (==25.1.0)
|
|
22
|
+
Requires-Dist: backoff (==2.2.1)
|
|
23
|
+
Requires-Dist: boto3 (==1.28.44)
|
|
24
|
+
Requires-Dist: botocore (==1.31.44)
|
|
25
|
+
Requires-Dist: certifi (==2024.7.4)
|
|
26
|
+
Requires-Dist: chardet (==5.2.0)
|
|
27
|
+
Requires-Dist: charset-normalizer (==3.4.1)
|
|
28
|
+
Requires-Dist: click (==8.1.8)
|
|
29
|
+
Requires-Dist: colorama (==0.4.6)
|
|
30
|
+
Requires-Dist: contextlib2 (==21.6.0)
|
|
31
|
+
Requires-Dist: decorator (==5.1.1)
|
|
32
|
+
Requires-Dist: diff-cover (==9.2.0)
|
|
33
|
+
Requires-Dist: dill (==0.3.7)
|
|
34
|
+
Requires-Dist: dynaconf (==3.2.2)
|
|
35
|
+
Requires-Dist: exceptiongroup (==1.2.2)
|
|
36
|
+
Requires-Dist: frozenlist (==1.5.0)
|
|
37
|
+
Requires-Dist: gql[aiohttp] (==3.5.0)
|
|
38
|
+
Requires-Dist: graphql-core (==3.2.3)
|
|
39
|
+
Requires-Dist: idna (==3.7)
|
|
40
|
+
Requires-Dist: iniconfig (==2.0.0)
|
|
41
|
+
Requires-Dist: jinja2 (==3.1.6)
|
|
42
|
+
Requires-Dist: jmespath (==1.0.1)
|
|
43
|
+
Requires-Dist: jsonlines (==4.0.0)
|
|
44
|
+
Requires-Dist: jsonpath-ng (==1.5.3)
|
|
45
|
+
Requires-Dist: jsonschema (==4.23.0)
|
|
46
|
+
Requires-Dist: jsonschema-specifications (==2024.10.1)
|
|
47
|
+
Requires-Dist: markupsafe (==3.0.2)
|
|
48
|
+
Requires-Dist: multidict (==6.1.0)
|
|
49
|
+
Requires-Dist: nested-lookup (==0.2.25)
|
|
50
|
+
Requires-Dist: packaging (==23.1)
|
|
51
|
+
Requires-Dist: panther-core (==0.12.1)
|
|
52
|
+
Requires-Dist: pathspec (==0.12.1)
|
|
53
|
+
Requires-Dist: pluggy (==1.5.0)
|
|
54
|
+
Requires-Dist: ply (==3.11)
|
|
55
|
+
Requires-Dist: policyuniverse (==1.5.1.20230817)
|
|
56
|
+
Requires-Dist: propcache (==0.2.1)
|
|
57
|
+
Requires-Dist: pygments (==2.19.1)
|
|
58
|
+
Requires-Dist: pytest (==8.3.4)
|
|
59
|
+
Requires-Dist: python-dateutil (==2.8.2)
|
|
60
|
+
Requires-Dist: pyyaml (==6.0.2)
|
|
61
|
+
Requires-Dist: referencing (==0.36.2)
|
|
62
|
+
Requires-Dist: regex (==2024.11.6)
|
|
63
|
+
Requires-Dist: requests (==2.32.4)
|
|
64
|
+
Requires-Dist: rpds-py (==0.22.3)
|
|
65
|
+
Requires-Dist: ruamel-yaml (==0.17.32)
|
|
66
|
+
Requires-Dist: ruamel-yaml-clib (==0.2.7)
|
|
67
|
+
Requires-Dist: s3transfer (==0.6.2)
|
|
68
|
+
Requires-Dist: schema (==0.7.5)
|
|
69
|
+
Requires-Dist: semver (==2.13.0)
|
|
70
|
+
Requires-Dist: setuptools (>=78.1.1)
|
|
71
|
+
Requires-Dist: six (==1.16.0)
|
|
72
|
+
Requires-Dist: sniffio (==1.3.1)
|
|
73
|
+
Requires-Dist: sqlfluff (==2.3.1)
|
|
74
|
+
Requires-Dist: tblib (==3.0.0)
|
|
75
|
+
Requires-Dist: toml (==0.10.2)
|
|
76
|
+
Requires-Dist: tomli (==2.2.1)
|
|
77
|
+
Requires-Dist: tqdm (==4.67.1)
|
|
78
|
+
Requires-Dist: typing-extensions (==4.7.1)
|
|
79
|
+
Requires-Dist: urllib3 (==1.26.19)
|
|
80
|
+
Requires-Dist: wrapt (==1.15.0)
|
|
81
|
+
Requires-Dist: yarl (==1.18.3)
|
|
82
|
+
Project-URL: Downloads, https://github.com/panther-labs/panther_analysis_tool/archive/v1.0.0.tar.gz
|
|
83
|
+
Project-URL: Homepage, https://github.com/panther-labs/panther_analysis_tool
|
|
84
|
+
Description-Content-Type: text/markdown
|
|
85
|
+
|
|
86
|
+
# Panther Analysis Tool
|
|
87
|
+
|
|
88
|
+
[Panther Analysis Tool](https://github.com/panther-labs/panther_analysis_tool)
|
|
89
|
+
is a Python application for testing, packaging, and deploying Panther
|
|
90
|
+
Detections.
|
|
91
|
+
|
|
92
|
+
For further details, see [Quick Start](https://docs.panther.com/quick-start) and
|
|
93
|
+
[Panther Documentation](https://docs.panther.com/).
|
|
94
|
+
|
|
95
|
+
## Installation
|
|
96
|
+
|
|
97
|
+
### From PyPi
|
|
98
|
+
|
|
99
|
+
Use pip to install
|
|
100
|
+
[panther_analysis_tool package](https://pypi.org/project/panther-analysis-tool/)
|
|
101
|
+
from PyPi:
|
|
102
|
+
|
|
103
|
+
```shell
|
|
104
|
+
pip3 install panther_analysis_tool
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Or without a virtual environment:
|
|
108
|
+
|
|
109
|
+
```shell
|
|
110
|
+
make deps
|
|
111
|
+
pip3 install -e .
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### From source
|
|
115
|
+
|
|
116
|
+
```shell
|
|
117
|
+
make install
|
|
118
|
+
pipenv run -- pip3 install -e .
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Usage
|
|
122
|
+
|
|
123
|
+
### Help
|
|
124
|
+
|
|
125
|
+
Show available commands and their options:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
$ panther_analysis_tool -h
|
|
129
|
+
usage: panther_analysis_tool [-h] [--version] [--debug] [--skip-version-check] {release,test,publish,upload,delete,update-custom-schemas,test-lookup-table,validate,zip,check-connection,benchmark,enrich-test-data} ...
|
|
130
|
+
|
|
131
|
+
Panther Analysis Tool: A command line tool for managing Panther policies and rules.
|
|
132
|
+
|
|
133
|
+
positional arguments:
|
|
134
|
+
{release,test,publish,upload,delete,update-custom-schemas,test-lookup-table,validate,zip,check-connection,benchmark,enrich-test-data}
|
|
135
|
+
release Create release assets for repository containing panther detections. Generates a file called panther-analysis-all.zip and optionally generates panther-analysis-all.sig
|
|
136
|
+
test Validate analysis specifications and run policy and rule tests.
|
|
137
|
+
publish Publishes a new release, generates the release assets, and uploads them. Generates a file called panther-analysis-all.zip and optionally generates panther-analysis-all.sig
|
|
138
|
+
upload Upload specified policies and rules to a Panther deployment.
|
|
139
|
+
delete Delete policies, rules, or saved queries from a Panther deployment
|
|
140
|
+
update-custom-schemas
|
|
141
|
+
Update or create custom schemas on a Panther deployment.
|
|
142
|
+
test-lookup-table Validate a Lookup Table spec file.
|
|
143
|
+
validate Validate your bulk uploads against your panther instance
|
|
144
|
+
zip Create an archive of local policies and rules for uploading to Panther.
|
|
145
|
+
check-connection Check your Panther API connection
|
|
146
|
+
benchmark Performance test one rule against one of its log types. The rule must be the only item in the working directory or specified by --path, --ignore-files, and --filter. This feature is an extension
|
|
147
|
+
of Data Replay and is subject to the same limitations.
|
|
148
|
+
enrich-test-data Enrich test data with additional enrichments from the Panther API.
|
|
149
|
+
|
|
150
|
+
optional arguments:
|
|
151
|
+
-h, --help show this help message and exit
|
|
152
|
+
--version show program's version number and exit
|
|
153
|
+
--debug
|
|
154
|
+
--skip-version-check
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Test
|
|
158
|
+
|
|
159
|
+
Run tests for a given path:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
$ panther_analysis_tool test --path tests/fixtures/valid_policies/
|
|
163
|
+
[INFO]: Testing analysis packs in tests/fixtures/valid_policies/
|
|
164
|
+
|
|
165
|
+
AWS.IAM.MFAEnabled
|
|
166
|
+
[PASS] Root MFA not enabled fails compliance
|
|
167
|
+
[PASS] User MFA not enabled fails compliance
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Run a specific unit test of a rule:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
$ panther_analysis_tool test --filter RuleID=AWS.IAM.AccessKeyCompromised --test-names "An AWS Access Key was Uploaded to Github"
|
|
174
|
+
[INFO]: Testing analysis items in .
|
|
175
|
+
|
|
176
|
+
AWS.IAM.AccessKeyCompromised
|
|
177
|
+
[PASS] An AWS Access Key was Uploaded to Github
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Run specific unit tests of a rule:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
$ panther_analysis_tool test --filter RuleID=AWS.CloudTrail.Stopped --test-names "CloudTrail Was Stopped" "Error Stopping CloudTrail"
|
|
184
|
+
[INFO]: Testing analysis items in .
|
|
185
|
+
|
|
186
|
+
[PASS] CloudTrail Was Stopped
|
|
187
|
+
...
|
|
188
|
+
[PASS] Error Stopping CloudTrail
|
|
189
|
+
[PASS] [rule] false
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
### Upload
|
|
194
|
+
|
|
195
|
+
Create packages to upload through the Panther UI:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
$ panther_analysis_tool zip --path tests/fixtures/valid_policies/ --out tmp
|
|
199
|
+
[INFO]: Testing analysis packs in tests/fixtures/valid_policies/
|
|
200
|
+
|
|
201
|
+
AWS.IAM.MFAEnabled
|
|
202
|
+
[PASS] Root MFA not enabled fails compliance
|
|
203
|
+
[PASS] User MFA not enabled fails compliance
|
|
204
|
+
|
|
205
|
+
[INFO]: Zipping analysis packs in tests/fixtures/valid_policies/ to tmp
|
|
206
|
+
[INFO]: <current working directory>/tmp/panther-analysis-2020-03-23T12-48-18.zip
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Or upload packages directly into Panther:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
$ panther_analysis_tool upload --path tests/fixtures/valid_policies/ --out tmp
|
|
213
|
+
[INFO]: Testing analysis packs in tests/fixtures/valid_policies/
|
|
214
|
+
|
|
215
|
+
AWS.IAM.MFAEnabled
|
|
216
|
+
[PASS] Root MFA not enabled fails compliance
|
|
217
|
+
[PASS] User MFA not enabled fails compliance
|
|
218
|
+
|
|
219
|
+
AWS.IAM.BetaTest
|
|
220
|
+
[PASS] Root MFA not enabled fails compliance
|
|
221
|
+
[PASS] User MFA not enabled fails compliance
|
|
222
|
+
|
|
223
|
+
AWS.CloudTrail.MFAEnabled
|
|
224
|
+
[PASS] Root MFA not enabled fails compliance
|
|
225
|
+
[PASS] User MFA not enabled fails compliance
|
|
226
|
+
|
|
227
|
+
[INFO]: Zipping analysis packs in tests/fixtures/valid_policies/ to tmp
|
|
228
|
+
[INFO]: Found credentials in environment variables.
|
|
229
|
+
[INFO]: Uploading pack to Panther
|
|
230
|
+
[INFO]: Upload success.
|
|
231
|
+
[INFO]: API Response:
|
|
232
|
+
{
|
|
233
|
+
"modifiedPolicies": 0,
|
|
234
|
+
"modifiedRules": 0,
|
|
235
|
+
"newPolicies": 2,
|
|
236
|
+
"newRules": 1,
|
|
237
|
+
"totalPolicies": 2,
|
|
238
|
+
"totalRules": 1
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Filtering
|
|
243
|
+
|
|
244
|
+
The `test`, `zip`, and `upload` commands all support filtering. Filtering works
|
|
245
|
+
by passing the `--filter` argument with a list of filters specified in the
|
|
246
|
+
format `KEY=VALUE1,VALUE2`. The keys can be any valid field in a policy or rule.
|
|
247
|
+
When using a filter, only anaylsis that matches each filter specified will be
|
|
248
|
+
considered. For example, the following command will test only items with the
|
|
249
|
+
AnalysisType as `policy` AND severity as `High`:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
$ panther_analysis_tool test --path tests/fixtures/valid_policies --filter AnalysisType=policy Severity=High
|
|
253
|
+
[INFO]: Testing analysis packs in tests/fixtures/valid_policies
|
|
254
|
+
|
|
255
|
+
AWS.IAM.BetaTest
|
|
256
|
+
[PASS] Root MFA not enabled fails compliance
|
|
257
|
+
[PASS] User MFA not enabled fails compliance
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Alternately, the following command will test items with the AnalysisType
|
|
261
|
+
`policy` OR `rule`, AND the severity `High`:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
$ panther_analysis_tool test --path tests/fixtures/valid_policies --filter AnalysisType=policy,rule Severity=High
|
|
265
|
+
[INFO]: Testing analysis packs in tests/fixtures/valid_policies
|
|
266
|
+
|
|
267
|
+
AWS.IAM.BetaTest
|
|
268
|
+
[PASS] Root MFA not enabled fails compliance
|
|
269
|
+
[PASS] User MFA not enabled fails compliance
|
|
270
|
+
|
|
271
|
+
AWS.CloudTrail.MFAEnabled
|
|
272
|
+
[PASS] Root MFA not enabled fails compliance
|
|
273
|
+
[PASS] User MFA not enabled fails compliance
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
When writing policies or rules that refer to the global analysis types, include
|
|
277
|
+
them in the filter. An empty string as a filter value means the filter applies
|
|
278
|
+
only if the field exists. The following command returns an error: the policy
|
|
279
|
+
imports a global, but the global lacks a severity and thus is excluded by the
|
|
280
|
+
filter.
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
$ panther_analysis_tool test --path tests/fixtures/valid_policies --filter AnalysisType=policy,global Severity=Critical
|
|
284
|
+
[INFO]: Testing analysis packs in tests/fixtures/valid_policies
|
|
285
|
+
|
|
286
|
+
AWS.IAM.MFAEnabled
|
|
287
|
+
[ERROR] Error loading module, skipping
|
|
288
|
+
|
|
289
|
+
Invalid: tests/fixtures/valid_policies/example_policy.yml
|
|
290
|
+
No module named 'panther'
|
|
291
|
+
|
|
292
|
+
[ERROR]: [('tests/fixtures/valid_policies/example_policy.yml', ModuleNotFoundError("No module named 'panther'"))]
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
For this query to work, allow for the abscence of the severity field:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
$ panther_analysis_tool test --path tests/fixtures/valid_policies --filter AnalysisType=policy,global Severity=Critical,""
|
|
299
|
+
[INFO]: Testing analysis packs in tests/fixtures/valid_policies
|
|
300
|
+
|
|
301
|
+
AWS.IAM.MFAEnabled
|
|
302
|
+
[PASS] Root MFA not enabled fails compliance
|
|
303
|
+
[PASS] User MFA not enabled fails compliance
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Filters work for the `zip` and `upload` commands in the exact same way they work
|
|
307
|
+
for the `test` command.
|
|
308
|
+
|
|
309
|
+
In addition to filtering, setting a minimum number of unit tests is possible
|
|
310
|
+
with the --minimum-tests flag. Detections lacking the minimum number of tests
|
|
311
|
+
are considered failing. If `--minimum-tests` is set to 2 or greater, the
|
|
312
|
+
requirement becomes that at least one test must return `True` and another must
|
|
313
|
+
return `False`.
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
$ panther_analysis_tool test --path tests/fixtures/valid_policies --minimum-tests 2
|
|
317
|
+
% panther_analysis_tool test --path okta_rules --minimum-tests 2
|
|
318
|
+
[INFO]: Testing analysis packs in okta_rules
|
|
319
|
+
|
|
320
|
+
Okta.AdminRoleAssigned
|
|
321
|
+
[PASS] Admin Access Assigned
|
|
322
|
+
|
|
323
|
+
Okta.BruteForceLogins
|
|
324
|
+
[PASS] Failed login
|
|
325
|
+
|
|
326
|
+
Okta.GeographicallyImprobableAccess
|
|
327
|
+
[PASS] Non Login
|
|
328
|
+
[PASS] Failed Login
|
|
329
|
+
|
|
330
|
+
--------------------------
|
|
331
|
+
Panther CLI Test Summary
|
|
332
|
+
Path: okta_rules
|
|
333
|
+
Passed: 0
|
|
334
|
+
Failed: 3
|
|
335
|
+
Invalid: 0
|
|
336
|
+
|
|
337
|
+
--------------------------
|
|
338
|
+
Failed Tests Summary
|
|
339
|
+
Okta.AdminRoleAssigned
|
|
340
|
+
['Insufficient test coverage, 2 tests required but only 1 found.', 'Insufficient test coverage: expected at least one passing and one failing test.']
|
|
341
|
+
|
|
342
|
+
Okta.BruteForceLogins
|
|
343
|
+
['Insufficient test coverage, 2 tests required but only 1 found.', 'Insufficient test coverage: expected at least one passing and one failing test]
|
|
344
|
+
|
|
345
|
+
Okta.GeographicallyImprobableAccess
|
|
346
|
+
['Insufficient test coverage: expected at least one passing and one failing test.']
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
In this case, even though the rules passed all their tests, they are still
|
|
350
|
+
considered failing because they do not have the correct test coverage.
|
|
351
|
+
|
|
352
|
+
### Delete Rules, Policies, or Saved Queries
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
$ panther_analysis_tool delete
|
|
356
|
+
|
|
357
|
+
usage: panther_analysis_tool delete [-h] [--no-confirm] [--athena-datalake] [--api-token API_TOKEN] [--api-host API_HOST] [--aws-profile AWS_PROFILE] [--analysis-id ANALYSIS_ID [ANALYSIS_ID ...]]
|
|
358
|
+
[--query-id QUERY_ID [QUERY_ID ...]]
|
|
359
|
+
|
|
360
|
+
Delete policies, rules, or saved queries from a Panther deployment
|
|
361
|
+
|
|
362
|
+
optional arguments:
|
|
363
|
+
-h, --help show this help message and exit
|
|
364
|
+
--no-confirm Skip manual confirmation of deletion (default: False)
|
|
365
|
+
--athena-datalake Instance DataLake is backed by Athena (default: False)
|
|
366
|
+
--api-token API_TOKEN
|
|
367
|
+
The Panther API token to use. See: https://docs.panther.com/api-beta (default: None)
|
|
368
|
+
--api-host API_HOST The Panther API host to use. See: https://docs.panther.com/api-beta (default: None)
|
|
369
|
+
--aws-profile AWS_PROFILE
|
|
370
|
+
The AWS profile to use when updating the AWS Panther deployment. (default: None)
|
|
371
|
+
--analysis-id ANALYSIS_ID [ANALYSIS_ID ...]
|
|
372
|
+
Space separated list of Detection IDs (default: [])
|
|
373
|
+
--query-id QUERY_ID [QUERY_ID ...]
|
|
374
|
+
Space separated list of Saved Queries (default: [])
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Pass a space-separated list of Analysis IDs (RuleID or PolicyID) or QueryIDs.
|
|
378
|
+
Use the --no-confirm flag to bypass confirmation prompts. Rules and their
|
|
379
|
+
associated saved queries will be matched and deleted. The default configuration
|
|
380
|
+
targets a Snowflake datalake; for an Athena datalake, use the --athena-datalake
|
|
381
|
+
flag.
|
|
382
|
+
|
|
383
|
+
## Configuration File
|
|
384
|
+
|
|
385
|
+
Panther Analysis Tool will also read options from a configuration file
|
|
386
|
+
`.panther_settings.yml` in the current working directory. An example
|
|
387
|
+
configuration file is included in this repo,
|
|
388
|
+
[example_panther_config.yml](example_panther_config.yml), that contains example
|
|
389
|
+
syntax for supported options.
|
|
390
|
+
|
|
391
|
+
Options in the configuration file take precedence over command-line options. For
|
|
392
|
+
instance, if minimum_tests: 2 is set in the configuration file and
|
|
393
|
+
--minimum-tests 1 is specified on the command line, the minimum number of tests
|
|
394
|
+
will be 2.
|
|
395
|
+
|
|
396
|
+
## Contributing
|
|
397
|
+
|
|
398
|
+
All contributions are welcome. Prior to submitting pull requests, consult the
|
|
399
|
+
[contributing guidelines](https://github.com/panther-labs/panther-analysis/blob/master/CONTRIBUTING.md).
|
|
400
|
+
For steps to open a pull request from a fork, refer to
|
|
401
|
+
[GitHub's guide](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
|
|
402
|
+
|
|
403
|
+
### Local Development
|
|
404
|
+
|
|
405
|
+
To develop with the panther_analysis_tool locally, prepare two repositories:
|
|
406
|
+
this one and another containing the panther analysis content for PAT testing.
|
|
407
|
+
|
|
408
|
+
From your [panther_analysis](https://github.com/panther-labs/panther-analysis)
|
|
409
|
+
content repository, install as editable (and test, for example):
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
pipenv install --editable ../relative/path/to/panther_analysis_tool
|
|
413
|
+
pipenv run panther_analysis_tool test
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
## License
|
|
417
|
+
|
|
418
|
+
This repository is licensed under the AGPL-3.0
|
|
419
|
+
[license](https://github.com/panther-labs/panther-analysis/blob/master/LICENSE).
|
|
420
|
+
|