contentctl 3.6.0__py3-none-any.whl → 4.0.2__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.
Files changed (142) hide show
  1. contentctl/actions/build.py +89 -0
  2. contentctl/actions/detection_testing/DetectionTestingManager.py +48 -49
  3. contentctl/actions/detection_testing/GitService.py +148 -230
  4. contentctl/actions/detection_testing/infrastructures/DetectionTestingInfrastructure.py +14 -24
  5. contentctl/actions/detection_testing/infrastructures/DetectionTestingInfrastructureContainer.py +43 -17
  6. contentctl/actions/detection_testing/views/DetectionTestingView.py +3 -2
  7. contentctl/actions/detection_testing/views/DetectionTestingViewFile.py +0 -8
  8. contentctl/actions/doc_gen.py +1 -1
  9. contentctl/actions/initialize.py +28 -65
  10. contentctl/actions/inspect.py +260 -0
  11. contentctl/actions/new_content.py +106 -13
  12. contentctl/actions/release_notes.py +168 -144
  13. contentctl/actions/reporting.py +24 -13
  14. contentctl/actions/test.py +39 -20
  15. contentctl/actions/validate.py +25 -48
  16. contentctl/contentctl.py +196 -754
  17. contentctl/enrichments/attack_enrichment.py +69 -19
  18. contentctl/enrichments/cve_enrichment.py +28 -13
  19. contentctl/helper/link_validator.py +24 -26
  20. contentctl/helper/utils.py +7 -3
  21. contentctl/input/director.py +139 -201
  22. contentctl/input/new_content_questions.py +63 -61
  23. contentctl/input/sigma_converter.py +1 -2
  24. contentctl/input/ssa_detection_builder.py +16 -7
  25. contentctl/input/yml_reader.py +4 -3
  26. contentctl/objects/abstract_security_content_objects/detection_abstract.py +487 -154
  27. contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py +155 -51
  28. contentctl/objects/alert_action.py +40 -0
  29. contentctl/objects/atomic.py +212 -0
  30. contentctl/objects/baseline.py +44 -43
  31. contentctl/objects/baseline_tags.py +69 -20
  32. contentctl/objects/config.py +857 -125
  33. contentctl/objects/constants.py +0 -1
  34. contentctl/objects/correlation_search.py +1 -1
  35. contentctl/objects/data_source.py +2 -4
  36. contentctl/objects/deployment.py +61 -21
  37. contentctl/objects/deployment_email.py +2 -2
  38. contentctl/objects/deployment_notable.py +4 -4
  39. contentctl/objects/deployment_phantom.py +2 -2
  40. contentctl/objects/deployment_rba.py +3 -4
  41. contentctl/objects/deployment_scheduling.py +2 -3
  42. contentctl/objects/deployment_slack.py +2 -2
  43. contentctl/objects/detection.py +1 -5
  44. contentctl/objects/detection_tags.py +210 -119
  45. contentctl/objects/enums.py +312 -24
  46. contentctl/objects/integration_test.py +1 -1
  47. contentctl/objects/integration_test_result.py +0 -2
  48. contentctl/objects/investigation.py +62 -53
  49. contentctl/objects/investigation_tags.py +30 -6
  50. contentctl/objects/lookup.py +80 -31
  51. contentctl/objects/macro.py +29 -45
  52. contentctl/objects/mitre_attack_enrichment.py +29 -5
  53. contentctl/objects/observable.py +3 -7
  54. contentctl/objects/playbook.py +60 -30
  55. contentctl/objects/playbook_tags.py +45 -8
  56. contentctl/objects/security_content_object.py +1 -5
  57. contentctl/objects/ssa_detection.py +8 -4
  58. contentctl/objects/ssa_detection_tags.py +19 -26
  59. contentctl/objects/story.py +142 -44
  60. contentctl/objects/story_tags.py +46 -33
  61. contentctl/objects/unit_test.py +7 -2
  62. contentctl/objects/unit_test_attack_data.py +10 -19
  63. contentctl/objects/unit_test_baseline.py +1 -1
  64. contentctl/objects/unit_test_old.py +4 -3
  65. contentctl/objects/unit_test_result.py +5 -3
  66. contentctl/objects/unit_test_ssa.py +31 -0
  67. contentctl/output/api_json_output.py +202 -130
  68. contentctl/output/attack_nav_output.py +20 -9
  69. contentctl/output/attack_nav_writer.py +3 -3
  70. contentctl/output/ba_yml_output.py +3 -3
  71. contentctl/output/conf_output.py +125 -391
  72. contentctl/output/conf_writer.py +169 -31
  73. contentctl/output/jinja_writer.py +2 -2
  74. contentctl/output/json_writer.py +17 -5
  75. contentctl/output/new_content_yml_output.py +8 -7
  76. contentctl/output/svg_output.py +17 -27
  77. contentctl/output/templates/analyticstories_detections.j2 +8 -4
  78. contentctl/output/templates/analyticstories_investigations.j2 +1 -1
  79. contentctl/output/templates/analyticstories_stories.j2 +6 -6
  80. contentctl/output/templates/app.conf.j2 +2 -2
  81. contentctl/output/templates/app.manifest.j2 +2 -2
  82. contentctl/output/templates/detection_coverage.j2 +6 -8
  83. contentctl/output/templates/doc_detection_page.j2 +2 -2
  84. contentctl/output/templates/doc_detections.j2 +2 -2
  85. contentctl/output/templates/doc_stories.j2 +1 -1
  86. contentctl/output/templates/es_investigations_investigations.j2 +1 -1
  87. contentctl/output/templates/es_investigations_stories.j2 +1 -1
  88. contentctl/output/templates/header.j2 +2 -1
  89. contentctl/output/templates/macros.j2 +6 -10
  90. contentctl/output/templates/savedsearches_baselines.j2 +5 -5
  91. contentctl/output/templates/savedsearches_detections.j2 +36 -33
  92. contentctl/output/templates/savedsearches_investigations.j2 +4 -4
  93. contentctl/output/templates/transforms.j2 +4 -4
  94. contentctl/output/yml_writer.py +2 -2
  95. contentctl/templates/app_template/README.md +7 -0
  96. contentctl/{output/templates/splunk_app → templates/app_template}/default/data/ui/nav/default.xml +1 -0
  97. contentctl/templates/app_template/lookups/mitre_enrichment.csv +638 -0
  98. contentctl/templates/deployments/{00_default_anomaly.yml → escu_default_configuration_anomaly.yml} +1 -2
  99. contentctl/templates/deployments/{00_default_baseline.yml → escu_default_configuration_baseline.yml} +1 -2
  100. contentctl/templates/deployments/{00_default_correlation.yml → escu_default_configuration_correlation.yml} +2 -2
  101. contentctl/templates/deployments/{00_default_hunting.yml → escu_default_configuration_hunting.yml} +2 -2
  102. contentctl/templates/deployments/{00_default_ttp.yml → escu_default_configuration_ttp.yml} +1 -2
  103. contentctl/templates/detections/anomalous_usage_of_7zip.yml +0 -1
  104. contentctl/templates/stories/cobalt_strike.yml +0 -1
  105. {contentctl-3.6.0.dist-info → contentctl-4.0.2.dist-info}/METADATA +36 -15
  106. contentctl-4.0.2.dist-info/RECORD +168 -0
  107. contentctl/actions/detection_testing/DataManipulation.py +0 -149
  108. contentctl/actions/generate.py +0 -91
  109. contentctl/helper/config_handler.py +0 -75
  110. contentctl/input/baseline_builder.py +0 -66
  111. contentctl/input/basic_builder.py +0 -58
  112. contentctl/input/detection_builder.py +0 -370
  113. contentctl/input/investigation_builder.py +0 -42
  114. contentctl/input/new_content_generator.py +0 -95
  115. contentctl/input/playbook_builder.py +0 -68
  116. contentctl/input/story_builder.py +0 -106
  117. contentctl/objects/app.py +0 -214
  118. contentctl/objects/repo_config.py +0 -163
  119. contentctl/objects/test_config.py +0 -630
  120. contentctl/output/templates/macros_detections.j2 +0 -7
  121. contentctl/output/templates/splunk_app/README.md +0 -7
  122. contentctl-3.6.0.dist-info/RECORD +0 -176
  123. /contentctl/{output/templates/splunk_app → templates/app_template}/README/essoc_story_detail.txt +0 -0
  124. /contentctl/{output/templates/splunk_app → templates/app_template}/README/essoc_summary.txt +0 -0
  125. /contentctl/{output/templates/splunk_app → templates/app_template}/README/essoc_usage_dashboard.txt +0 -0
  126. /contentctl/{output/templates/splunk_app → templates/app_template}/default/analytic_stories.conf +0 -0
  127. /contentctl/{output/templates/splunk_app → templates/app_template}/default/app.conf +0 -0
  128. /contentctl/{output/templates/splunk_app → templates/app_template}/default/commands.conf +0 -0
  129. /contentctl/{output/templates/splunk_app → templates/app_template}/default/content-version.conf +0 -0
  130. /contentctl/{output/templates/splunk_app → templates/app_template}/default/data/ui/views/escu_summary.xml +0 -0
  131. /contentctl/{output/templates/splunk_app → templates/app_template}/default/data/ui/views/feedback.xml +0 -0
  132. /contentctl/{output/templates/splunk_app → templates/app_template}/default/distsearch.conf +0 -0
  133. /contentctl/{output/templates/splunk_app → templates/app_template}/default/usage_searches.conf +0 -0
  134. /contentctl/{output/templates/splunk_app → templates/app_template}/default/use_case_library.conf +0 -0
  135. /contentctl/{output/templates/splunk_app → templates/app_template}/metadata/default.meta +0 -0
  136. /contentctl/{output/templates/splunk_app → templates/app_template}/static/appIcon.png +0 -0
  137. /contentctl/{output/templates/splunk_app → templates/app_template}/static/appIconAlt.png +0 -0
  138. /contentctl/{output/templates/splunk_app → templates/app_template}/static/appIconAlt_2x.png +0 -0
  139. /contentctl/{output/templates/splunk_app → templates/app_template}/static/appIcon_2x.png +0 -0
  140. {contentctl-3.6.0.dist-info → contentctl-4.0.2.dist-info}/LICENSE.md +0 -0
  141. {contentctl-3.6.0.dist-info → contentctl-4.0.2.dist-info}/WHEEL +0 -0
  142. {contentctl-3.6.0.dist-info → contentctl-4.0.2.dist-info}/entry_points.txt +0 -0
@@ -2,6 +2,7 @@ name: ESCU Default Configuration Anomaly
2
2
  id: a9e210c6-9f50-4f8b-b60e-71bb26e4f216
3
3
  date: '2021-12-21'
4
4
  author: Patrick Bareiss
5
+ type: Anomaly
5
6
  description: This configuration file applies to all detections of type anomaly.
6
7
  These detections will use Risk Based Alerting.
7
8
  scheduling:
@@ -12,5 +13,3 @@ scheduling:
12
13
  alert_action:
13
14
  rba:
14
15
  enabled: 'true'
15
- tags:
16
- type: Anomaly
@@ -2,11 +2,10 @@ name: ESCU Default Configuration Baseline
2
2
  id: 0f7ee854-1aad-4bef-89c5-5c402b488510
3
3
  date: '2021-12-21'
4
4
  author: Patrick Bareiss
5
+ type: Baseline
5
6
  description: This configuration file applies to all detections of type baseline.
6
7
  scheduling:
7
8
  cron_schedule: 10 0 * * *
8
9
  earliest_time: -1450m@m
9
10
  latest_time: -10m@m
10
11
  schedule_window: auto
11
- tags:
12
- type: Baseline
@@ -2,6 +2,7 @@ name: ESCU Default Configuration Correlation
2
2
  id: 36ba498c-46e8-4b62-8bde-67e984a40fb4
3
3
  date: '2021-12-21'
4
4
  author: Patrick Bareiss
5
+ type: Correlation
5
6
  description: This configuration file applies to all detections of type Correlation.
6
7
  These correlations will generate Notable Events.
7
8
  scheduling:
@@ -16,5 +17,4 @@ alert_action:
16
17
  nes_fields:
17
18
  - user
18
19
  - dest
19
- tags:
20
- type: 'Correlation'
20
+
@@ -2,11 +2,11 @@ name: ESCU Default Configuration Hunting
2
2
  id: cc5895e8-3420-4ab7-af38-cf87a28f9c3b
3
3
  date: '2021-12-21'
4
4
  author: Patrick Bareiss
5
+ type: Hunting
5
6
  description: This configuration file applies to all detections of type hunting.
6
7
  scheduling:
7
8
  cron_schedule: 0 * * * *
8
9
  earliest_time: -70m@m
9
10
  latest_time: -10m@m
10
11
  schedule_window: auto
11
- tags:
12
- type: Hunting
12
+
@@ -2,6 +2,7 @@ name: ESCU Default Configuration TTP
2
2
  id: b81cd059-a3e8-4c03-96ca-e168c50ff70b
3
3
  date: '2021-12-21'
4
4
  author: Patrick Bareiss
5
+ type: TTP
5
6
  description: This configuration file applies to all detections of type TTP.
6
7
  These detections will use Risk Based Alerting and generate Notable Events.
7
8
  scheduling:
@@ -18,5 +19,3 @@ alert_action:
18
19
  - dest
19
20
  rba:
20
21
  enabled: 'true'
21
- tags:
22
- type: TTP
@@ -32,7 +32,6 @@ references:
32
32
  tags:
33
33
  analytic_story:
34
34
  - Cobalt Strike
35
- - NOBELIUM Group
36
35
  asset_type: Endpoint
37
36
  confidence: 80
38
37
  impact: 80
@@ -51,7 +51,6 @@ references:
51
51
  - https://github.com/MichaelKoczwara/Awesome-CobaltStrike-Defence
52
52
  - https://github.com/zer0yu/Awesome-CobaltStrike
53
53
  tags:
54
- analytic_story: Cobalt Strike
55
54
  category:
56
55
  - Adversary Tactics
57
56
  product:
@@ -1,33 +1,33 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: contentctl
3
- Version: 3.6.0
3
+ Version: 4.0.2
4
4
  Summary: Splunk Content Control Tool
5
5
  License: Apache 2.0
6
6
  Author: STRT
7
7
  Author-email: research@splunk.com
8
- Requires-Python: >=3.9,<4.0
8
+ Requires-Python: >=3.11,<4.0
9
9
  Classifier: License :: Other/Proprietary License
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
11
  Classifier: Programming Language :: Python :: 3.11
14
12
  Classifier: Programming Language :: Python :: 3.12
15
13
  Requires-Dist: Jinja2 (>=3.1.2,<4.0.0)
16
- Requires-Dist: PyYAML (>=6.0,<7.0)
14
+ Requires-Dist: PyYAML (>=6.0.1,<7.0.0)
17
15
  Requires-Dist: attackcti (>=0.3.7,<0.4.0)
18
- Requires-Dist: bottle (>=0.12.23,<0.13.0)
19
- Requires-Dist: docker (>=6.0.1,<7.0.0)
20
- Requires-Dist: gitpython (>=3.1.29,<4.0.0)
16
+ Requires-Dist: bottle (>=0.12.25,<0.13.0)
17
+ Requires-Dist: docker (>=6.1.3,<7.0.0)
18
+ Requires-Dist: gitpython (>=3.1.43,<4.0.0)
21
19
  Requires-Dist: pycvesearch (>=1.2,<2.0)
22
- Requires-Dist: pydantic (>=1.10.11,<2.0.0)
23
- Requires-Dist: pysigma (>=0.10.5,<0.11.0)
20
+ Requires-Dist: pydantic (>=2.5.1,<3.0.0)
21
+ Requires-Dist: pygit2 (>=1.14.1,<2.0.0)
22
+ Requires-Dist: pysigma (>=0.10.8,<0.11.0)
24
23
  Requires-Dist: pysigma-backend-splunk (>=1.0.3,<2.0.0)
25
- Requires-Dist: questionary (>=1.10.0,<2.0.0)
26
- Requires-Dist: requests (>=2.28.1,<3.0.0)
24
+ Requires-Dist: questionary (>=2.0.1,<3.0.0)
25
+ Requires-Dist: requests (>=2.31.0,<3.0.0)
27
26
  Requires-Dist: semantic-version (>=2.10.0,<3.0.0)
28
- Requires-Dist: splunk-sdk (>=1.7.2,<2.0.0)
29
- Requires-Dist: tqdm (>=4.65.0,<5.0.0)
30
- Requires-Dist: validators (>=0.20.0,<0.21.0)
27
+ Requires-Dist: splunk-sdk (>=2.0.1,<3.0.0)
28
+ Requires-Dist: tqdm (>=4.66.1,<5.0.0)
29
+ Requires-Dist: tyro (>=0.8.3,<0.9.0)
30
+ Requires-Dist: validators (>=0.22.0,<0.23.0)
31
31
  Requires-Dist: xmltodict (>=0.13.0,<0.14.0)
32
32
  Description-Content-Type: text/markdown
33
33
 
@@ -211,7 +211,28 @@ contentctl test's default mode allows it to quickly test all content with requir
211
211
  6. **docs** - Create documentation as Markdown
212
212
  7. **reporting** - Create different reporting files such as a Mitre ATT&CK overlay
213
213
 
214
+ # Shell tab-complete
214
215
 
216
+ Leveraging the tab completion featureset of the CLI library we're using, you can generate tab completions for `contentctl` automatically, for zsh, bash, and tcsh. For additional details, you can view the docs for the library [here.](https://brentyi.github.io/tyro/tab_completion/)
217
+
218
+ ### Zsh
219
+ If you already have a location for your ZSH tab completions, you only need to run the generation line and can skip the folder creation, configuring the rest to fit with your shell config.
220
+
221
+ ```zsh
222
+ mkdir -p ~/.zfunc
223
+ contentctl --tyro-write-completion zsh ~/.zfunc/_contentctl
224
+ echo "fpath+=~/.zfunc" >> ~/.zshrc
225
+ echo "autoload -Uz compinit && compinit" >> ~/.zshrc
226
+ source ~/.zshrc
227
+ ```
228
+
229
+ ### Bash
230
+
231
+ ```bash
232
+ completion_dir=${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions/
233
+ mkdir -p $completion_dir
234
+ contentctl --tyro-write-completion bash ${completion_dir}/_contentctl
235
+ ```
215
236
 
216
237
  # Acronyms
217
238
  | Acronym | Meaning| Description |
@@ -0,0 +1,168 @@
1
+ contentctl/__init__.py,sha256=IMjkMO3twhQzluVTo8Z6rE7Eg-9U79_LGKMcsWLKBkY,22
2
+ contentctl/actions/acs_deploy.py,sha256=mf3uk495H1EU_LNN-TiOsYCo18HMGoEBMb6ojeTr0zw,1418
3
+ contentctl/actions/apav_deploy.py,sha256=vjq-24zCLRvNyS0FSLyE4L2b4etG-qo4OM6Z9P0NYK4,2999
4
+ contentctl/actions/api_deploy.py,sha256=h8r_CjsQo4RXzBN4Q8DqoPh6e7JfNDoXdcxT1nrsaRQ,6965
5
+ contentctl/actions/build.py,sha256=BVc-1E63zeUQ9wWAHTC_fLNvfEK5YT3Z6_QLiE72TQs,4765
6
+ contentctl/actions/convert.py,sha256=0KBWLxvP1hSPXpExePqpOQPRvlQLamvPLyQqeTIWNbk,704
7
+ contentctl/actions/detection_testing/DetectionTestingManager.py,sha256=zg8JasDjCpSC-yhseEyUwO8qbDJIUJbhlus9Li9ZAnA,8818
8
+ contentctl/actions/detection_testing/GitService.py,sha256=Rm5Usc0EZk87rk1W8eKyED6b5CdD0YUQZMjkPfk3ztU,8666
9
+ contentctl/actions/detection_testing/generate_detection_coverage_badge.py,sha256=N5mznaeErVak3mOBwsd0RDBFJO3bku0EZvpayCyU-uk,2259
10
+ contentctl/actions/detection_testing/infrastructures/DetectionTestingInfrastructure.py,sha256=VFhSHdw_0N6ol668hDkaj7yFjPsZqBoFNC8FKzWKICc,53141
11
+ contentctl/actions/detection_testing/infrastructures/DetectionTestingInfrastructureContainer.py,sha256=HVGWCXy0GQeBqu2cVJn5H-I8GY8rwgkkc53ilO1TfZA,6846
12
+ contentctl/actions/detection_testing/infrastructures/DetectionTestingInfrastructureServer.py,sha256=Q1ZfCYOp54O39bgTScZMInkmZiU-bGAM9Hiwr2mq5ms,370
13
+ contentctl/actions/detection_testing/progress_bar.py,sha256=OK9oRnPlzPAswt9KZNYID-YLHxqaYPY821kIE4-rCeA,3244
14
+ contentctl/actions/detection_testing/views/DetectionTestingView.py,sha256=yneZxGnpMvkbWPCTFSWM6hoTCA-JndTMctgTGsLGNNU,7013
15
+ contentctl/actions/detection_testing/views/DetectionTestingViewCLI.py,sha256=Mos0VV2CTSHtIqMPLwtEJlMEU7LE7TXFjM6GUA1G6hM,2050
16
+ contentctl/actions/detection_testing/views/DetectionTestingViewFile.py,sha256=OJgmQgoVnzy7p1MN9bDyKGUhFWKzQc6ejc4F87uZG1I,1123
17
+ contentctl/actions/detection_testing/views/DetectionTestingViewWeb.py,sha256=6mecacXFoTJxcHiRZSnlHos5Hca1jdedEEZfiIAhaJg,4706
18
+ contentctl/actions/doc_gen.py,sha256=YNc1VYA0ikL1hWDHYjfEOmUkfhy8PEIdvTyC4ZLxQRY,863
19
+ contentctl/actions/initialize.py,sha256=2h3_A68mNWcyZjbrKF-OeQXBi5p4Zu3z74K7QxEtII4,1749
20
+ contentctl/actions/initialize_old.py,sha256=0qXbW_fNDvkcnEeL6Zpte8d-hpTu1REyzHsXOCY-YB8,9333
21
+ contentctl/actions/inspect.py,sha256=31v7hISc8B8w5tyMnBPSDb3AHRpm-K9rn-WqJRegzBQ,12628
22
+ contentctl/actions/new_content.py,sha256=s2ovk-F-T_Z1O_bi0DgLHrkersD9AsDNW2Y66lY4jbg,5792
23
+ contentctl/actions/release_notes.py,sha256=akkFfLhsJuaPUyjsb6dLlKt9cUM-JApAjTFQMbYoXeM,13115
24
+ contentctl/actions/reporting.py,sha256=MJEmvmoA1WnSFZEU9QM6daL_W94oOX0WXAcX1qAM2As,1583
25
+ contentctl/actions/test.py,sha256=JXW1CR-tTM2kJ-U5NRG8quY3JlnOb4OmCBgX24XYWJ0,4896
26
+ contentctl/actions/validate.py,sha256=-yZuhFBzqZvtT5FOFO4o4-U72tv6urrAG9QCFwqX4os,2363
27
+ contentctl/contentctl.py,sha256=qiowJPiIdMkh8KkbiYhDyVBc1sKJTBKEXhZDwMC-mAk,10083
28
+ contentctl/enrichments/attack_enrichment.py,sha256=EkEloG3hMmPTloPyYiVkhq3iT_BieXaJmprJ5stfyRw,6732
29
+ contentctl/enrichments/cve_enrichment.py,sha256=r5a2DVpbz7wBW8iU4-OhXmSmJQ28JnFDQJt8XZ96MVo,3934
30
+ contentctl/enrichments/splunk_app_enrichment.py,sha256=zDNHFLZTi2dJ1gdnh0sHkD6F1VtkblqFnhacFcCMBfc,3418
31
+ contentctl/helper/link_validator.py,sha256=-XorhxfGtjLynEL1X4hcpRMiyemogf2JEnvLwhHq80c,7139
32
+ contentctl/helper/logger.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ contentctl/helper/utils.py,sha256=iZ6keMdTCs1XySiDVoGIGkMSxD_eDUphwEW-VUYA6vM,15659
34
+ contentctl/input/backend_splunk_ba.py,sha256=Y70tJqgaUM0nzfm2SiGMof4HkhY84feqf-xnRx1xPb4,5861
35
+ contentctl/input/director.py,sha256=CNAzSpO2fjjnhyezOGn9u5QiKq3Xqq7rHI-X9LrpyCo,10716
36
+ contentctl/input/new_content_questions.py,sha256=eV6iHQ9-xCdlDJ0PgUEb0Zfokfmu62sYQnIGjShsf6k,5718
37
+ contentctl/input/sigma_converter.py,sha256=ATFNW7boNngp5dmWM7Gr4rMZrUKjvKW2_qu28--FdiU,19391
38
+ contentctl/input/ssa_detection_builder.py,sha256=43B7q4A8MEMjUU-FR7UapO80deW6BooV9WYzZWxcvgI,8377
39
+ contentctl/input/yml_reader.py,sha256=oaal24UP8rDXkCmN5I3GnIheZrsgkhbKOlzXtyhB474,1475
40
+ contentctl/objects/abstract_security_content_objects/detection_abstract.py,sha256=YRbDXBFk_To77jyCkUqhswLV4n9IwJGTSDaiAnI7sFU,30167
41
+ contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py,sha256=cdBb7Yb3vYkD8xRKMWPG8Aq7oAKfw9fRIBGvjYw8zT0,8065
42
+ contentctl/objects/alert_action.py,sha256=E9gjCn5C31h0sN7k90KNe4agRxFFSnMW_Z-Ri_3YQss,1335
43
+ contentctl/objects/atomic.py,sha256=a_G_iliAm86BunpAAG86aAL3LAEGpd9Crp7t7-PxYvI,8979
44
+ contentctl/objects/base_test.py,sha256=6hCL9K-N_jJx1zLbuZQCsB93_XWj6JcGGs2PbbjzJWo,1028
45
+ contentctl/objects/base_test_result.py,sha256=dPupudgeXW64Emk9YJfS5JhUXbZwpEZrrx_DiqbRgvU,4752
46
+ contentctl/objects/baseline.py,sha256=x9vXa45kT2Qu7xQ0icPLvVJLFF6Hrj9svqdbuKtHzDc,2248
47
+ contentctl/objects/baseline_tags.py,sha256=JLdlCUc_DEccMQD6f-sa2qD8pcxYiwMUT_sRZEhW7ZA,2978
48
+ contentctl/objects/config.py,sha256=lwiEJu9M3KVP8krH3ieI-4Yke-nI1dRYbStouLmHIWo,43708
49
+ contentctl/objects/constants.py,sha256=1LjiK9A7t0aHHkJz2mrW-DImdW1P98GPssTwmwNNI_M,3468
50
+ contentctl/objects/correlation_search.py,sha256=B97vCt2Ew7PGgqd5Y9l6RD3DJdy51Eh7Gzkxxs2xqZ0,36891
51
+ contentctl/objects/data_source.py,sha256=ELNsNsarVHJgytPTcaGZOoWgub2v_-Q0xtc_-xUM8yg,405
52
+ contentctl/objects/deployment.py,sha256=Qc6M4yeOvxjqFKR8sfjd4CG06AbVheTOqP1mwqo4t8s,2651
53
+ contentctl/objects/deployment_email.py,sha256=Zu9cXZdfOP6noa_mZpiK1GrYCTgi3Mim94iLGjE674c,147
54
+ contentctl/objects/deployment_notable.py,sha256=QhOI7HEkUuuqk0fum9SD8IpYBlbwIsJUff8s3kCKKj4,198
55
+ contentctl/objects/deployment_phantom.py,sha256=EmRlPKpEij4vqUJgACqK_zcGBmHV8xXczkJi-FxMDio,207
56
+ contentctl/objects/deployment_rba.py,sha256=YFLSKzLU7s8Bt1cJkSBWlfCsc_2MfgiwyaDijQOVlFE,125
57
+ contentctl/objects/deployment_scheduling.py,sha256=bQjbJHNaUGdU1VAGV8-nFOHzHutbIlt7FZpUvR1CV4Y,198
58
+ contentctl/objects/deployment_slack.py,sha256=P6z8OLHDKcDWx7nbKWasqBc3dFRatGcpO2GtmxzVV8I,135
59
+ contentctl/objects/detection.py,sha256=3W41cXf3ECjWuPqWrseqSLC3PAA7O5_nENWWM6MPK0Y,620
60
+ contentctl/objects/detection_tags.py,sha256=dYCa4SfoqRiSOwYpbWo93vLGPxy6V9pArCZMWb5fxZs,10238
61
+ contentctl/objects/enums.py,sha256=2gLRtJ-dHW_xMFdbjOp0LaX_fEV0V-YAZn2JY9gUzJ8,14030
62
+ contentctl/objects/integration_test.py,sha256=W_VksBN_cRo7DTXdr1aLujjS9mgkEp0uvoNpmL0dVnQ,1273
63
+ contentctl/objects/integration_test_result.py,sha256=DrIZRRlILSHGcsK_Rlm3KJLnbKPtIen8uEPFi4ZdJ8s,370
64
+ contentctl/objects/investigation.py,sha256=JRoZxc_qi1fu_VFTRaxOc3B7zzSzCfEURsNzWPUCrtY,2620
65
+ contentctl/objects/investigation_tags.py,sha256=nFpMRKBVBsW21YW_vy2G1lXaSARX-kfFyrPoCyE77Q8,1280
66
+ contentctl/objects/lookup.py,sha256=P8YbzdDAj_MsTBJTEsym35zhQjiN9Eq0MlfON-qvuTM,4556
67
+ contentctl/objects/macro.py,sha256=qUnS1UuGrq2nXj49N2qmwzZDJwyfTCqu3KSZMB6CfWk,2451
68
+ contentctl/objects/mitre_attack_enrichment.py,sha256=bWrMG-Xj3knmULR5q2YZk7mloJBdQUzU1moZfEw9lQM,1073
69
+ contentctl/objects/notable_action.py,sha256=ValkblBaG-60TF19y_vSnNzoNZ3eg48wIfr0qZxyKTA,1605
70
+ contentctl/objects/observable.py,sha256=-nbVASkwyLpstWQk9Za1Hyjg0etGHiZArg7doEOS02k,1156
71
+ contentctl/objects/playbook.py,sha256=hSYYpdMhctgpp7uwaPciFqu1yuFI4M1NHy1WBBLyvzM,2469
72
+ contentctl/objects/playbook_tags.py,sha256=NrhTGcgoYSGEZggrfebko0GBOXN9x05IadRUUL_CVfQ,1436
73
+ contentctl/objects/risk_analysis_action.py,sha256=bySNQX5SBIR8L7SDnlTQr_Jn29YqrPFZtSc0KxQox4Y,4288
74
+ contentctl/objects/risk_object.py,sha256=yY4NmEwEKaRl4sLzCRZb1n8kdpV3HzYbQVQ1ClQWYHw,904
75
+ contentctl/objects/security_content_object.py,sha256=j8KNDwSMfZsSIzJucC3NuZo0SlFVpqHfDc6y3-YHjHI,234
76
+ contentctl/objects/ssa_detection.py,sha256=-G6tXfVVlZgPWS64hIIy3M-aMePANAuQvdpXPlgUyUs,5873
77
+ contentctl/objects/ssa_detection_tags.py,sha256=u8annjzo3MYZ-16wyFnuR8qJJzRa4LEhdprMIrQ47G0,5224
78
+ contentctl/objects/story.py,sha256=LQLCCK_3DkP2x8fQOzcnV0d18_gsVFeS06DEK-qaBUE,4526
79
+ contentctl/objects/story_tags.py,sha256=_OSUQ-uC3wCQMO2w6mqdqe-Wd_PhcpEANf-_xg_jyS0,2169
80
+ contentctl/objects/test_group.py,sha256=Yb1sqGom6SkVL8B3czPndz8w3CK8WdwZ39V_cn0_JZQ,2600
81
+ contentctl/objects/threat_object.py,sha256=S8B7RQFfLxN_g7yKPrDTuYhIy9JvQH3YwJ_T5LUZIa4,711
82
+ contentctl/objects/unit_test.py,sha256=5EDsPNUct1UY5OtfX-VwFzhET83OmLA6XcaQiZWL1Uo,1655
83
+ contentctl/objects/unit_test_attack_data.py,sha256=ZmHA83O8i9VZveDAliNp_XVKOuH5ytGN9l3X8v8jm4o,480
84
+ contentctl/objects/unit_test_baseline.py,sha256=XHvOm7qLYfqrP6uC5U_pfgw_pf8-S2RojuNmbo6lXlM,227
85
+ contentctl/objects/unit_test_old.py,sha256=IfvytHG4ZnUhsvXgdczECZbiwv6YLViYdsk9AqeDBjQ,199
86
+ contentctl/objects/unit_test_result.py,sha256=POQfvvPpSw-jQzINBz1_IszUMJ4Wbopu8HRS1Qe6P2M,2940
87
+ contentctl/objects/unit_test_ssa.py,sha256=RURqXb3e0CuI5nNX8PvFucxatAvMmGSUDngVbqNpoiY,653
88
+ contentctl/output/api_json_output.py,sha256=n3OTd5z-Vkmsn7ny6QCAar_jSMNuuJfzAQa7xq_9if4,9085
89
+ contentctl/output/attack_nav_output.py,sha256=95iKV8U9BMMgqh6cCOw1S89Ln73xmJGgJPHTYR0L7hA,2304
90
+ contentctl/output/attack_nav_writer.py,sha256=64ILZLmNbh2XLmbopgENkeo6t-4SRRG8xZXBmtpNd4g,2219
91
+ contentctl/output/ba_yml_output.py,sha256=Lrk13Q9-f71i3c0oNrT50G94PxdogG4k4-MI-rTMOAo,5950
92
+ contentctl/output/conf_output.py,sha256=qCRT77UKNFCe4AufeBV8Uz9lkPqgpGzU1Y149RuEnis,10147
93
+ contentctl/output/conf_writer.py,sha256=2TaCAPEtU-bMa7A2m7xOxh93PMpzIdhwiHiPLUCeCB4,8281
94
+ contentctl/output/detection_writer.py,sha256=AzxbssNLmsNIOaYKotew5-ONoyq1cQpKSGy3pe191B0,960
95
+ contentctl/output/doc_md_output.py,sha256=gf7osH1uSrC6js3D_I72g4uDe9TaB3tsvtqCHi5znp0,3238
96
+ contentctl/output/finding_report_writer.py,sha256=Me6FtvDbmSSRqYr5rtrtuc5YVze48PyPbrjyAXJ-V4A,3935
97
+ contentctl/output/jinja_writer.py,sha256=bdiqr9FaXYxth4wZ1A52zTMAS5stHNGpezTkaS5pres,1119
98
+ contentctl/output/json_writer.py,sha256=Z-iVLnZb8tzYATxbQtXax0dz572lVPFMNVTx-vWbnog,1007
99
+ contentctl/output/new_content_yml_output.py,sha256=ktZ9miHluqkw8jD-pn-62bjVp1sQqqQ7B53xy18DHU8,2321
100
+ contentctl/output/svg_output.py,sha256=T2p4S085MKj5VPZKvo4tWBVOmYme32J9L7kMEBm3SwQ,2751
101
+ contentctl/output/templates/analyticstories_detections.j2,sha256=MYefoyWAq4b7dth3OlbMWNhFnH3_nnMKaOfw0lMkxT4,917
102
+ contentctl/output/templates/analyticstories_investigations.j2,sha256=7bwt_6U3dr9hbxOUkp0a1KnRJohNgC7GE1zRg_N_awI,515
103
+ contentctl/output/templates/analyticstories_stories.j2,sha256=w_MIadmsynoO_tCmofZj3_5TEmxeHnQEPJuhYaqqc-4,668
104
+ contentctl/output/templates/app.conf.j2,sha256=Y9vDwdU1yRTQZ7jBQWLFo0XAEerN_6IXrkXdS3xkcuM,737
105
+ contentctl/output/templates/app.manifest.j2,sha256=n9TBpikEOD-HQzsad4Fmd0iH5cosRQ12SiXXYZhcO0g,1063
106
+ contentctl/output/templates/collections.j2,sha256=rDpAcqM6hRiyCQPgfRh8KcL41Mrqsc97krQ-JPFhSBQ,181
107
+ contentctl/output/templates/content-version.j2,sha256=2-it0TF5BvqUcmUXVFB4DEh0I01igQGDxZNJpdtDFIA,54
108
+ contentctl/output/templates/detection_count.j2,sha256=9U3o-P_ECkMknsooj_L3B9GZqjnsbaEzr59s3-DOK0I,670
109
+ contentctl/output/templates/detection_coverage.j2,sha256=guE4fow9BqGoCCrQ3b6-EZqWJcThb58V9khuIH7nhT0,631
110
+ contentctl/output/templates/doc_detection_page.j2,sha256=kATedDq0Z8tzxKiD3nD0_-7YiOrjssUMYSDenRYTh6A,1012
111
+ contentctl/output/templates/doc_detections.j2,sha256=QKP2u22bFQFSG6I_Iw1_wR7uza-OXI70roSCbEijLiE,6596
112
+ contentctl/output/templates/doc_navigation.j2,sha256=h25ITC3xcAM17uZGIyyDFURmEdYtQSPvNeWN3RH7j4Q,1471
113
+ contentctl/output/templates/doc_navigation_pages.j2,sha256=ptfjbD4F0Ob7dze9at2q5gqOslcbL3eteUO1zsblDJo,203
114
+ contentctl/output/templates/doc_playbooks.j2,sha256=CWsnm8F097oYT8anW3CE7JaX1haAJTfylThP1ic0UIw,1681
115
+ contentctl/output/templates/doc_playbooks_page.j2,sha256=2d5UNDSOxyMtxKGxGHzJ2Ny_UrqTq267NO1h-lmNduc,679
116
+ contentctl/output/templates/doc_stories.j2,sha256=0J3dAbfSZz-Ma1-C9B6vYPKGwrxoZryYoudy3wUIT4s,1827
117
+ contentctl/output/templates/doc_story_page.j2,sha256=jrf-As8GbqLarRoiDipfM9ZUVRl_bhdNsy-XaCrBaXE,874
118
+ contentctl/output/templates/es_investigations_investigations.j2,sha256=M4beFAFrkdhOIda2uYOXOxm9eBTdtSrTg07ke8FcELs,1013
119
+ contentctl/output/templates/es_investigations_stories.j2,sha256=3_adGXuyMR6v-k3uc6_ht13UqX1AI4HagRdokwW0tqk,388
120
+ contentctl/output/templates/finding_report.j2,sha256=DS9ElRGeyz7UFPiTXiqbhUzOrT4eN8oetdBheQJRFck,1753
121
+ contentctl/output/templates/header.j2,sha256=3usV7jm1q6J-QNnQrZzII9cN0XEGQjg_eVKrEQwfOG0,201
122
+ contentctl/output/templates/macros.j2,sha256=SLcQQ5X7TZS8j-2qP06BTXqdIcnwoYqTAaBLX2Dge7Y,390
123
+ contentctl/output/templates/panel.j2,sha256=Cw_W6p-14n6UivVfpS75KKJiJ2VpdGsSBceYsUYe9gk,221
124
+ contentctl/output/templates/savedsearches_baselines.j2,sha256=xr05J9WJSVdwpiBoPWEejZ1hmeqInyDKyDH4kjzHP6U,1743
125
+ contentctl/output/templates/savedsearches_detections.j2,sha256=NpQNRF6GutVpcpt7BaPOFesvZhBsAoI3CHrtYnRnbo4,6805
126
+ contentctl/output/templates/savedsearches_investigations.j2,sha256=aFIDK4NqtsZr3fb4F_tv9UQTQ2Z-n9pkP5rIocPA65Q,1259
127
+ contentctl/output/templates/transforms.j2,sha256=-cSoie0LgJwibtW-GMhc9BQlmS6h1s1Vykm9O2M0f9Y,1456
128
+ contentctl/output/templates/workflow_actions.j2,sha256=DFoZVnCa8dMRHjW2AdpoydBC0THgiH_W-Nx7WI4-uR4,925
129
+ contentctl/output/yml_output.py,sha256=xtTD3f_WWy8O6Joi4S8gG9paot8JpQFRlwt17_ek5B4,2682
130
+ contentctl/output/yml_writer.py,sha256=UsVhIJ-QmDB3B3GKiapMZ_ZBCJt_mefBzVmUwD9WfNw,271
131
+ contentctl/templates/README,sha256=Hg4LI9g_ss8o3u060woDkhunLXHMtKOhuFK2i-xJpuM,133
132
+ contentctl/templates/app_default.yml,sha256=kDeYdJbfMADQPcho8iH1nqgTFrHNt4EXnIJjPHc2unI,6390
133
+ contentctl/templates/app_template/README/essoc_story_detail.txt,sha256=7hFPBfPpRH28TFl7QchKceZLewQqgFjRWDlmxZzwpmo,897
134
+ contentctl/templates/app_template/README/essoc_summary.txt,sha256=u6wYNYBqmmm7Kn_g_Uex8rRzMQ995MUXCavla95Y1dw,2538
135
+ contentctl/templates/app_template/README/essoc_usage_dashboard.txt,sha256=xYUKKVtdgzPyT3mqdTccaBZuwWnC63lbc9zyYpmHN4o,2432
136
+ contentctl/templates/app_template/README.md,sha256=RT-J9bgRSFsEFgNr9qV6yc2LkfUH_uiMJ2RV4NM9Ymo,366
137
+ contentctl/templates/app_template/default/analytic_stories.conf,sha256=zWuCOOl8SiP7Kit2s-de4KRu3HySLtBSXcp1QnJx0ec,168
138
+ contentctl/templates/app_template/default/app.conf,sha256=eTSq1QI4-BgylZJgnNVg5jQCZFXJVNyEJA33lQAgYoc,685
139
+ contentctl/templates/app_template/default/commands.conf,sha256=U2ccwUeGXKKKt5jo14QY5swi-p9_TSJtaNquOkeF3Yk,319
140
+ contentctl/templates/app_template/default/content-version.conf,sha256=TGzX6qLdzRK7x6b0y5AE8ZF59PLU-DrRfS43fVWITqo,34
141
+ contentctl/templates/app_template/default/data/ui/nav/default.xml,sha256=fKN53HZCtNJbQqq_5pP8e5-5m30DRrJittr6q5s6V_0,236
142
+ contentctl/templates/app_template/default/data/ui/views/escu_summary.xml,sha256=jQhkIthPgEEptCJ2wUCj2lWGHBvUl6JGsKkDfONloxI,8635
143
+ contentctl/templates/app_template/default/data/ui/views/feedback.xml,sha256=uM71EMK2uFz8h68nOTNKGnYxob3HhE_caSL6yA-3H-k,696
144
+ contentctl/templates/app_template/default/distsearch.conf,sha256=5fa9bNr9WuVI2_8tTIftvrRwk27Oz3rUoKh6_xlASFw,156
145
+ contentctl/templates/app_template/default/usage_searches.conf,sha256=mFnhAHGhFHIzl8xxA626thnAjyxs5ZQQfur1PP_Xmbg,4257
146
+ contentctl/templates/app_template/default/use_case_library.conf,sha256=zWuCOOl8SiP7Kit2s-de4KRu3HySLtBSXcp1QnJx0ec,168
147
+ contentctl/templates/app_template/lookups/mitre_enrichment.csv,sha256=tifPQjFoQHtvpb78hxSP2fKHnHeehNbZDwUjdvc0aEM,66072
148
+ contentctl/templates/app_template/metadata/default.meta,sha256=tcYHZkDF44ApDoDQ_rp8MCA8cuT3DVd5atHgulR1Tvc,423
149
+ contentctl/templates/app_template/static/appIcon.png,sha256=jcJ1PNdkBX7Kl_y9Tf0SZ55OJYA2PpwjvkVvBt9_OoE,3658
150
+ contentctl/templates/app_template/static/appIconAlt.png,sha256=uRXjoHQQjs0-BxcK-3KNBEdck1adDNTHMvV14xR4W0g,2656
151
+ contentctl/templates/app_template/static/appIconAlt_2x.png,sha256=I0m-CPRqq7ak9NJQZGGmz6Ac4pmzFV_SonOUxOEDOFs,7442
152
+ contentctl/templates/app_template/static/appIcon_2x.png,sha256=XEpqQzDvzuEV5StzD05XRgxwySqHHLes1hMPy2v5Vdk,3657
153
+ contentctl/templates/datamodels_cim.conf,sha256=RB_SCtpQG_KaC_0lKTCKexVOlEq_ShGwpGlg95aqOfs,9381
154
+ contentctl/templates/datamodels_custom.conf,sha256=6BANthXdqg3fYpYmEqiGZnv4cWheNfXz1uQ_I1JePXc,480
155
+ contentctl/templates/deployments/escu_default_configuration_anomaly.yml,sha256=j_H2wovWBj1EKxVwj3mMoJVQnVm-2Imt7xnB9U1Tun4,418
156
+ contentctl/templates/deployments/escu_default_configuration_baseline.yml,sha256=NzUvaotkk7hatx9EBjROFIwsvSOZXgfAJUvGS8JrUMg,334
157
+ contentctl/templates/deployments/escu_default_configuration_correlation.yml,sha256=iWLqvJnUKVhpKaLBc_w_W65d9HVZgOZfGA-RIpxsH6M,519
158
+ contentctl/templates/deployments/escu_default_configuration_hunting.yml,sha256=hHmM8u7zncpb-32Qv74UoNs0HKwZwCMoKAq2ygDJZbo,329
159
+ contentctl/templates/deployments/escu_default_configuration_ttp.yml,sha256=1D-pvzaH1v3_yCZXaY6njmdvV4S2_Ak8uzzCOsnj9XY,548
160
+ contentctl/templates/detections/anomalous_usage_of_7zip.yml,sha256=hkN214ZOqbQPWyYrqgbOrYb4iA0DroG1AnFRhSC_m0M,3323
161
+ contentctl/templates/macros/security_content_ctime.yml,sha256=Gg1YNllHVsX_YB716H1SJLWzxXZEfuJlnsgB2fuyoHU,159
162
+ contentctl/templates/macros/security_content_summariesonly.yml,sha256=9BYUxAl2E4Nwh8K19F3AJS8Ka7ceO6ZDBjFiO3l3LY0,162
163
+ contentctl/templates/stories/cobalt_strike.yml,sha256=rlaXxMN-5k8LnKBLPafBoksyMtlmsPMHPJOjTiMiZ-M,3063
164
+ contentctl-4.0.2.dist-info/LICENSE.md,sha256=hQWUayRk-pAiOZbZnuy8djmoZkjKBx8MrCFpW-JiOgo,11344
165
+ contentctl-4.0.2.dist-info/METADATA,sha256=xGbT6aNeYGB-__vB1wrMih-Jz2Sb_A8xKb-x3i39QGY,19705
166
+ contentctl-4.0.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
167
+ contentctl-4.0.2.dist-info/entry_points.txt,sha256=5bjZ2NkbQfSwK47uOnA77yCtjgXhvgxnmCQiynRF_-U,57
168
+ contentctl-4.0.2.dist-info/RECORD,,
@@ -1,149 +0,0 @@
1
- import json
2
- from datetime import datetime
3
- from datetime import timedelta
4
- #import fileinput
5
- import os
6
- import re
7
- import io
8
-
9
- class DataManipulation:
10
-
11
- def manipulate_timestamp(self, file_path, sourcetype, source):
12
-
13
-
14
- #print('Updating timestamps in attack_data before replaying')
15
- if sourcetype == 'aws:cloudtrail':
16
- self.manipulate_timestamp_cloudtrail(file_path)
17
-
18
- if source == 'WinEventLog:System' or source == 'WinEventLog:Security':
19
- self.manipulate_timestamp_windows_event_log_raw(file_path)
20
-
21
- if source == 'exchange':
22
- self.manipulate_timestamp_exchange_logs(file_path)
23
-
24
-
25
- def manipulate_timestamp_exchange_logs(self, path):
26
- f = io.open(path, "r", encoding="utf-8")
27
-
28
- first_line = f.readline()
29
- d = json.loads(first_line)
30
- latest_event = datetime.strptime(d["CreationTime"],"%Y-%m-%dT%H:%M:%S")
31
-
32
- now = datetime.now()
33
- now = now.strftime("%Y-%m-%dT%H:%M:%S")
34
- now = datetime.strptime(now,"%Y-%m-%dT%H:%M:%S")
35
-
36
- difference = now - latest_event
37
- f.close()
38
-
39
- #Mimic the behavior of fileinput but in a threadsafe way
40
- #Rename the file, which fileinput does for inplace.
41
- #Note that path will now be the new file
42
- original_backup_file = f"{path}.bak"
43
- os.rename(path, original_backup_file)
44
-
45
- with open(original_backup_file, "r") as original_file:
46
- with open(path, "w") as new_file:
47
- for line in original_file:
48
- d = json.loads(line)
49
- original_time = datetime.strptime(d["CreationTime"],"%Y-%m-%dT%H:%M:%S")
50
- new_time = (difference + original_time)
51
-
52
- original_time = original_time.strftime("%Y-%m-%dT%H:%M:%S")
53
- new_time = new_time.strftime("%Y-%m-%dT%H:%M:%S")
54
- #There is no end character appended, no need for end=''
55
- new_file.write(line.replace(original_time, new_time))
56
-
57
-
58
- os.remove(original_backup_file)
59
-
60
- def manipulate_timestamp_windows_event_log_raw(self, path):
61
-
62
- f = io.open(path, "r", encoding="utf-8")
63
- self.now = datetime.now()
64
- self.now = self.now.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
65
- self.now = datetime.strptime(self.now,"%Y-%m-%dT%H:%M:%S.%fZ")
66
-
67
- # read raw logs
68
- regex = r'\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2} [AP]M'
69
- data = f.read()
70
- lst_matches = re.findall(regex, data)
71
- if len(lst_matches) > 0:
72
- latest_event = datetime.strptime(lst_matches[-1],"%m/%d/%Y %I:%M:%S %p")
73
- self.difference = self.now - latest_event
74
- f.close()
75
-
76
- result = re.sub(regex, self.replacement_function, data)
77
-
78
- with io.open(path, "w+", encoding='utf8') as f:
79
- f.write(result)
80
- else:
81
- f.close()
82
- return
83
-
84
-
85
- def replacement_function(self, match):
86
- try:
87
- event_time = datetime.strptime(match.group(),"%m/%d/%Y %I:%M:%S %p")
88
- new_time = self.difference + event_time
89
- return new_time.strftime("%m/%d/%Y %I:%M:%S %p")
90
- except Exception as e:
91
- self.logger.error("Error in timestamp replacement occured: " + str(e))
92
- return match.group()
93
-
94
-
95
- def manipulate_timestamp_cloudtrail(self, path):
96
-
97
-
98
- f = io.open(path, "r", encoding="utf-8")
99
-
100
- try:
101
- first_line = f.readline()
102
- d = json.loads(first_line)
103
- latest_event = datetime.strptime(d["eventTime"],"%Y-%m-%dT%H:%M:%S.%fZ")
104
-
105
- now = datetime.now()
106
- now = now.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
107
- now = datetime.strptime(now,"%Y-%m-%dT%H:%M:%S.%fZ")
108
- except ValueError:
109
- first_line = f.readline()
110
- d = json.loads(first_line)
111
- latest_event = datetime.strptime(d["eventTime"],"%Y-%m-%dT%H:%M:%SZ")
112
-
113
- now = datetime.now()
114
- now = now.strftime("%Y-%m-%dT%H:%M:%SZ")
115
- now = datetime.strptime(now,"%Y-%m-%dT%H:%M:%SZ")
116
-
117
- difference = now - latest_event
118
- f.close()
119
-
120
-
121
-
122
- #Mimic the behavior of fileinput but in a threadsafe way
123
- #Rename the file, which fileinput does for inplace.
124
- #Note that path will now be the new file
125
- original_backup_file = f"{path}.bak"
126
- os.rename(path, original_backup_file)
127
-
128
- with open(original_backup_file, "r") as original_file:
129
- with open(path, "w") as new_file:
130
- for line in original_file:
131
- try:
132
- d = json.loads(line)
133
- original_time = datetime.strptime(d["eventTime"],"%Y-%m-%dT%H:%M:%S.%fZ")
134
- new_time = (difference + original_time)
135
-
136
- original_time = original_time.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
137
- new_time = new_time.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
138
- new_file.write(line.replace(original_time, new_time))
139
- except ValueError:
140
- d = json.loads(line)
141
- original_time = datetime.strptime(d["eventTime"],"%Y-%m-%dT%H:%M:%SZ")
142
- new_time = (difference + original_time)
143
-
144
- original_time = original_time.strftime("%Y-%m-%dT%H:%M:%SZ")
145
- new_time = new_time.strftime("%Y-%m-%dT%H:%M:%SZ")
146
- new_file.write(line.replace(original_time, new_time))
147
-
148
-
149
- os.remove(original_backup_file)
@@ -1,91 +0,0 @@
1
- import sys
2
- import shutil
3
- import os
4
-
5
- from dataclasses import dataclass
6
-
7
- from contentctl.objects.enums import SecurityContentProduct, SecurityContentType
8
- from contentctl.input.director import Director, DirectorInputDto, DirectorOutputDto
9
- from contentctl.output.conf_output import ConfOutput
10
- from contentctl.output.ba_yml_output import BAYmlOutput
11
- from contentctl.output.api_json_output import ApiJsonOutput
12
- import pathlib
13
- import json
14
- import datetime
15
- from typing import Union
16
-
17
- @dataclass(frozen=True)
18
- class GenerateInputDto:
19
- director_input_dto: DirectorInputDto
20
- splunk_api_username: Union[str,None] = None
21
- splunk_api_password: Union[str,None] = None
22
- #For most cloud stacks, the stack_type argument has been deprecated for appinspect.
23
- #Still, we will pass it in case there are users of very old stacks.
24
- stack_type: str = "victoria"
25
-
26
- class Generate:
27
-
28
- def execute(self, input_dto: GenerateInputDto) -> DirectorOutputDto:
29
- director_output_dto = DirectorOutputDto([],[],[],[],[],[],[],[],[])
30
- director = Director(director_output_dto)
31
- director.execute(input_dto.director_input_dto)
32
-
33
- if input_dto.director_input_dto.product == SecurityContentProduct.SPLUNK_APP:
34
- if (input_dto.splunk_api_username is None) ^ (input_dto.splunk_api_password is None):
35
- # Exclusive OR above finds when ONE of these is defined but the other is not
36
- if input_dto.splunk_api_password:
37
- raise Exception("splunk_api_password was provided, but splunk_api_username was not. Please provide both or neither")
38
- else:
39
- raise Exception("splunk_api_username was provided, but splunk_api_password was not. Please provide both or neither")
40
-
41
-
42
-
43
-
44
- conf_output = ConfOutput(input_dto.director_input_dto.input_path, input_dto.director_input_dto.config)
45
- conf_output.writeHeaders()
46
- conf_output.writeObjects(director_output_dto.detections, SecurityContentType.detections)
47
- conf_output.writeObjects(director_output_dto.stories, SecurityContentType.stories)
48
- conf_output.writeObjects(director_output_dto.baselines, SecurityContentType.baselines)
49
- conf_output.writeObjects(director_output_dto.investigations, SecurityContentType.investigations)
50
- conf_output.writeObjects(director_output_dto.lookups, SecurityContentType.lookups)
51
- conf_output.writeObjects(director_output_dto.macros, SecurityContentType.macros)
52
- conf_output.writeAppConf()
53
- conf_output.packageApp()
54
-
55
- #conf_output.inspectAppCLI()
56
- if input_dto.splunk_api_username and input_dto.splunk_api_password:
57
- _ = conf_output.inspectAppAPI(input_dto.splunk_api_username, input_dto.splunk_api_password, input_dto.stack_type)
58
-
59
- print(f'Generate of security content successful to {conf_output.output_path}')
60
- return director_output_dto
61
-
62
- elif input_dto.director_input_dto.product == SecurityContentProduct.SSA:
63
- output_path = os.path.join(input_dto.director_input_dto.input_path, input_dto.director_input_dto.config.build_ssa.path_root)
64
- shutil.rmtree(output_path + '/srs/', ignore_errors=True)
65
- shutil.rmtree(output_path + '/complex/', ignore_errors=True)
66
- os.makedirs(output_path + '/complex/')
67
- os.makedirs(output_path + '/srs/')
68
- ba_yml_output = BAYmlOutput()
69
- ba_yml_output.writeObjects(director_output_dto.ssa_detections, output_path)
70
-
71
- elif input_dto.director_input_dto.product == SecurityContentProduct.API:
72
- output_path = os.path.join(input_dto.director_input_dto.input_path, input_dto.director_input_dto.config.build_api.path_root)
73
- shutil.rmtree(output_path, ignore_errors=True)
74
- os.makedirs(output_path)
75
- api_json_output = ApiJsonOutput()
76
- api_json_output.writeObjects(director_output_dto.detections, output_path, SecurityContentType.detections)
77
- api_json_output.writeObjects(director_output_dto.stories, output_path, SecurityContentType.stories)
78
- api_json_output.writeObjects(director_output_dto.baselines, output_path, SecurityContentType.baselines)
79
- api_json_output.writeObjects(director_output_dto.investigations, output_path, SecurityContentType.investigations)
80
- api_json_output.writeObjects(director_output_dto.lookups, output_path, SecurityContentType.lookups)
81
- api_json_output.writeObjects(director_output_dto.macros, output_path, SecurityContentType.macros)
82
- api_json_output.writeObjects(director_output_dto.deployments, output_path, SecurityContentType.deployments)
83
-
84
- #create version file for sse api
85
- version_file = pathlib.Path(output_path)/"version.json"
86
- utc_time = datetime.datetime.utcnow().replace(microsecond=0).isoformat()
87
- version_dict = {"version":{"name":f"v{input_dto.director_input_dto.config.build.version}","published_at": f"{utc_time}Z" }}
88
- with open(version_file,"w") as version_f:
89
- json.dump(version_dict,version_f)
90
-
91
- return director_output_dto