contentctl 4.0.4__py3-none-any.whl → 4.1.0__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 (30) hide show
  1. contentctl/actions/inspect.py +1 -1
  2. contentctl/actions/new_content.py +18 -7
  3. contentctl/actions/validate.py +1 -0
  4. contentctl/api.py +137 -0
  5. contentctl/contentctl.py +28 -24
  6. contentctl/enrichments/cve_enrichment.py +43 -78
  7. contentctl/input/director.py +72 -72
  8. contentctl/input/new_content_questions.py +0 -5
  9. contentctl/objects/abstract_security_content_objects/detection_abstract.py +77 -13
  10. contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py +17 -0
  11. contentctl/objects/baseline.py +0 -1
  12. contentctl/objects/config.py +4 -8
  13. contentctl/objects/detection_tags.py +1 -1
  14. contentctl/objects/macro.py +8 -7
  15. contentctl/objects/story_tags.py +2 -0
  16. contentctl/output/yml_writer.py +39 -1
  17. contentctl/templates/detections/application/.gitkeep +0 -0
  18. contentctl/templates/detections/cloud/.gitkeep +0 -0
  19. contentctl/templates/detections/network/.gitkeep +0 -0
  20. contentctl/templates/detections/web/.gitkeep +0 -0
  21. {contentctl-4.0.4.dist-info → contentctl-4.1.0.dist-info}/METADATA +7 -8
  22. {contentctl-4.0.4.dist-info → contentctl-4.1.0.dist-info}/RECORD +27 -25
  23. contentctl/actions/apav_deploy.py +0 -98
  24. contentctl/actions/api_deploy.py +0 -151
  25. contentctl/templates/app_template/default/distsearch.conf +0 -5
  26. /contentctl/actions/{acs_deploy.py → deploy_acs.py} +0 -0
  27. /contentctl/templates/detections/{anomalous_usage_of_7zip.yml → endpoint/anomalous_usage_of_7zip.yml} +0 -0
  28. {contentctl-4.0.4.dist-info → contentctl-4.1.0.dist-info}/LICENSE.md +0 -0
  29. {contentctl-4.0.4.dist-info → contentctl-4.1.0.dist-info}/WHEEL +0 -0
  30. {contentctl-4.0.4.dist-info → contentctl-4.1.0.dist-info}/entry_points.txt +0 -0
@@ -1,9 +1,7 @@
1
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
2
  contentctl/actions/build.py,sha256=BVc-1E63zeUQ9wWAHTC_fLNvfEK5YT3Z6_QLiE72TQs,4765
6
3
  contentctl/actions/convert.py,sha256=0KBWLxvP1hSPXpExePqpOQPRvlQLamvPLyQqeTIWNbk,704
4
+ contentctl/actions/deploy_acs.py,sha256=mf3uk495H1EU_LNN-TiOsYCo18HMGoEBMb6ojeTr0zw,1418
7
5
  contentctl/actions/detection_testing/DetectionTestingManager.py,sha256=zg8JasDjCpSC-yhseEyUwO8qbDJIUJbhlus9Li9ZAnA,8818
8
6
  contentctl/actions/detection_testing/GitService.py,sha256=Rm5Usc0EZk87rk1W8eKyED6b5CdD0YUQZMjkPfk3ztU,8666
9
7
  contentctl/actions/detection_testing/generate_detection_coverage_badge.py,sha256=N5mznaeErVak3mOBwsd0RDBFJO3bku0EZvpayCyU-uk,2259
@@ -18,34 +16,35 @@ contentctl/actions/detection_testing/views/DetectionTestingViewWeb.py,sha256=6me
18
16
  contentctl/actions/doc_gen.py,sha256=YNc1VYA0ikL1hWDHYjfEOmUkfhy8PEIdvTyC4ZLxQRY,863
19
17
  contentctl/actions/initialize.py,sha256=2h3_A68mNWcyZjbrKF-OeQXBi5p4Zu3z74K7QxEtII4,1749
20
18
  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
19
+ contentctl/actions/inspect.py,sha256=6gVVKmV5CUUYOkNNVTMPKj9bM1uXVthgGCoFKZGDeS8,12628
20
+ contentctl/actions/new_content.py,sha256=4gTlxV0fmdsSETPX4T9uQPpIAm--Jf2vc6Vm3w-RkfI,6128
23
21
  contentctl/actions/release_notes.py,sha256=akkFfLhsJuaPUyjsb6dLlKt9cUM-JApAjTFQMbYoXeM,13115
24
22
  contentctl/actions/reporting.py,sha256=MJEmvmoA1WnSFZEU9QM6daL_W94oOX0WXAcX1qAM2As,1583
25
23
  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
24
+ contentctl/actions/validate.py,sha256=6_M5IMi68Pv4CNw69balQTkfRdjMTurUUv7z8BpGh3Y,2454
25
+ contentctl/api.py,sha256=FBOpRhbBCBdjORmwe_8MPQ3PRZ6T0KrrFcfKovVFkug,6343
26
+ contentctl/contentctl.py,sha256=Vr2cuvaPjpJpYvD9kVoYq7iD6rhLQEpTKmcGoq4emhA,10470
28
27
  contentctl/enrichments/attack_enrichment.py,sha256=EkEloG3hMmPTloPyYiVkhq3iT_BieXaJmprJ5stfyRw,6732
29
- contentctl/enrichments/cve_enrichment.py,sha256=r5a2DVpbz7wBW8iU4-OhXmSmJQ28JnFDQJt8XZ96MVo,3934
28
+ contentctl/enrichments/cve_enrichment.py,sha256=IzkKSdnQi3JrAUUyLpcGA_Y2g_B7latq9bOIMlaMpGg,2315
30
29
  contentctl/enrichments/splunk_app_enrichment.py,sha256=zDNHFLZTi2dJ1gdnh0sHkD6F1VtkblqFnhacFcCMBfc,3418
31
30
  contentctl/helper/link_validator.py,sha256=-XorhxfGtjLynEL1X4hcpRMiyemogf2JEnvLwhHq80c,7139
32
31
  contentctl/helper/logger.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
32
  contentctl/helper/utils.py,sha256=iZ6keMdTCs1XySiDVoGIGkMSxD_eDUphwEW-VUYA6vM,15659
34
33
  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
34
+ contentctl/input/director.py,sha256=JsmN35xamnMNl3Wug7KGVLFbVfa5F7jf0ToHEwXFcqM,10965
35
+ contentctl/input/new_content_questions.py,sha256=o4prlBoUhEMxqpZukquI9WKbzfFJfYhEF7a8m2q_BEE,5565
37
36
  contentctl/input/sigma_converter.py,sha256=ATFNW7boNngp5dmWM7Gr4rMZrUKjvKW2_qu28--FdiU,19391
38
37
  contentctl/input/ssa_detection_builder.py,sha256=43B7q4A8MEMjUU-FR7UapO80deW6BooV9WYzZWxcvgI,8377
39
38
  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
39
+ contentctl/objects/abstract_security_content_objects/detection_abstract.py,sha256=BPY0D_evVu4n3xGE7uGJRP5RKOtPbNKNPnZqvo0qC1A,33311
40
+ contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py,sha256=IVr26xFrIlTvsqQoqwYl4cmcfaP9BeYt9I0QTriKmwE,8451
42
41
  contentctl/objects/alert_action.py,sha256=E9gjCn5C31h0sN7k90KNe4agRxFFSnMW_Z-Ri_3YQss,1335
43
42
  contentctl/objects/atomic.py,sha256=a_G_iliAm86BunpAAG86aAL3LAEGpd9Crp7t7-PxYvI,8979
44
43
  contentctl/objects/base_test.py,sha256=6hCL9K-N_jJx1zLbuZQCsB93_XWj6JcGGs2PbbjzJWo,1028
45
44
  contentctl/objects/base_test_result.py,sha256=dPupudgeXW64Emk9YJfS5JhUXbZwpEZrrx_DiqbRgvU,4752
46
- contentctl/objects/baseline.py,sha256=x9vXa45kT2Qu7xQ0icPLvVJLFF6Hrj9svqdbuKtHzDc,2248
45
+ contentctl/objects/baseline.py,sha256=Lb1vJKtDdlDrzWgrdkC9oQao_TnRrOxSwOWHf4trtaU,2150
47
46
  contentctl/objects/baseline_tags.py,sha256=JLdlCUc_DEccMQD6f-sa2qD8pcxYiwMUT_sRZEhW7ZA,2978
48
- contentctl/objects/config.py,sha256=lwiEJu9M3KVP8krH3ieI-4Yke-nI1dRYbStouLmHIWo,43708
47
+ contentctl/objects/config.py,sha256=tK0BY4A9Go5jp8tpOSwgczuOAyu9dMPvC0nyOHeO-74,43642
49
48
  contentctl/objects/constants.py,sha256=1LjiK9A7t0aHHkJz2mrW-DImdW1P98GPssTwmwNNI_M,3468
50
49
  contentctl/objects/correlation_search.py,sha256=B97vCt2Ew7PGgqd5Y9l6RD3DJdy51Eh7Gzkxxs2xqZ0,36891
51
50
  contentctl/objects/data_source.py,sha256=ELNsNsarVHJgytPTcaGZOoWgub2v_-Q0xtc_-xUM8yg,405
@@ -57,14 +56,14 @@ contentctl/objects/deployment_rba.py,sha256=YFLSKzLU7s8Bt1cJkSBWlfCsc_2MfgiwyaDi
57
56
  contentctl/objects/deployment_scheduling.py,sha256=bQjbJHNaUGdU1VAGV8-nFOHzHutbIlt7FZpUvR1CV4Y,198
58
57
  contentctl/objects/deployment_slack.py,sha256=P6z8OLHDKcDWx7nbKWasqBc3dFRatGcpO2GtmxzVV8I,135
59
58
  contentctl/objects/detection.py,sha256=3W41cXf3ECjWuPqWrseqSLC3PAA7O5_nENWWM6MPK0Y,620
60
- contentctl/objects/detection_tags.py,sha256=dYCa4SfoqRiSOwYpbWo93vLGPxy6V9pArCZMWb5fxZs,10238
59
+ contentctl/objects/detection_tags.py,sha256=QR906JN8cf5et5aPf-AluEEyP3IvdUQ_KzxKffMSjrc,10261
61
60
  contentctl/objects/enums.py,sha256=2gLRtJ-dHW_xMFdbjOp0LaX_fEV0V-YAZn2JY9gUzJ8,14030
62
61
  contentctl/objects/integration_test.py,sha256=W_VksBN_cRo7DTXdr1aLujjS9mgkEp0uvoNpmL0dVnQ,1273
63
62
  contentctl/objects/integration_test_result.py,sha256=DrIZRRlILSHGcsK_Rlm3KJLnbKPtIen8uEPFi4ZdJ8s,370
64
63
  contentctl/objects/investigation.py,sha256=JRoZxc_qi1fu_VFTRaxOc3B7zzSzCfEURsNzWPUCrtY,2620
65
64
  contentctl/objects/investigation_tags.py,sha256=nFpMRKBVBsW21YW_vy2G1lXaSARX-kfFyrPoCyE77Q8,1280
66
65
  contentctl/objects/lookup.py,sha256=P8YbzdDAj_MsTBJTEsym35zhQjiN9Eq0MlfON-qvuTM,4556
67
- contentctl/objects/macro.py,sha256=qUnS1UuGrq2nXj49N2qmwzZDJwyfTCqu3KSZMB6CfWk,2451
66
+ contentctl/objects/macro.py,sha256=9nE-bxkFhtaltHOUCr0luU8jCCthmglHjhKs6Q2YzLU,2684
68
67
  contentctl/objects/mitre_attack_enrichment.py,sha256=bWrMG-Xj3knmULR5q2YZk7mloJBdQUzU1moZfEw9lQM,1073
69
68
  contentctl/objects/notable_action.py,sha256=ValkblBaG-60TF19y_vSnNzoNZ3eg48wIfr0qZxyKTA,1605
70
69
  contentctl/objects/observable.py,sha256=-nbVASkwyLpstWQk9Za1Hyjg0etGHiZArg7doEOS02k,1156
@@ -76,7 +75,7 @@ contentctl/objects/security_content_object.py,sha256=j8KNDwSMfZsSIzJucC3NuZo0SlF
76
75
  contentctl/objects/ssa_detection.py,sha256=-G6tXfVVlZgPWS64hIIy3M-aMePANAuQvdpXPlgUyUs,5873
77
76
  contentctl/objects/ssa_detection_tags.py,sha256=u8annjzo3MYZ-16wyFnuR8qJJzRa4LEhdprMIrQ47G0,5224
78
77
  contentctl/objects/story.py,sha256=LQLCCK_3DkP2x8fQOzcnV0d18_gsVFeS06DEK-qaBUE,4526
79
- contentctl/objects/story_tags.py,sha256=_OSUQ-uC3wCQMO2w6mqdqe-Wd_PhcpEANf-_xg_jyS0,2169
78
+ contentctl/objects/story_tags.py,sha256=0oF1OePLBxa-RQPb438tXrrfosa939CP8UbNV0_S8XY,2225
80
79
  contentctl/objects/test_group.py,sha256=Yb1sqGom6SkVL8B3czPndz8w3CK8WdwZ39V_cn0_JZQ,2600
81
80
  contentctl/objects/threat_object.py,sha256=S8B7RQFfLxN_g7yKPrDTuYhIy9JvQH3YwJ_T5LUZIa4,711
82
81
  contentctl/objects/unit_test.py,sha256=5EDsPNUct1UY5OtfX-VwFzhET83OmLA6XcaQiZWL1Uo,1655
@@ -127,7 +126,7 @@ contentctl/output/templates/savedsearches_investigations.j2,sha256=aFIDK4NqtsZr3
127
126
  contentctl/output/templates/transforms.j2,sha256=-cSoie0LgJwibtW-GMhc9BQlmS6h1s1Vykm9O2M0f9Y,1456
128
127
  contentctl/output/templates/workflow_actions.j2,sha256=DFoZVnCa8dMRHjW2AdpoydBC0THgiH_W-Nx7WI4-uR4,925
129
128
  contentctl/output/yml_output.py,sha256=xtTD3f_WWy8O6Joi4S8gG9paot8JpQFRlwt17_ek5B4,2682
130
- contentctl/output/yml_writer.py,sha256=UsVhIJ-QmDB3B3GKiapMZ_ZBCJt_mefBzVmUwD9WfNw,271
129
+ contentctl/output/yml_writer.py,sha256=zZJ3aK-l0YQXbDweS-XZKejHblyhy2eliSthZZEogUs,1668
131
130
  contentctl/templates/README,sha256=Hg4LI9g_ss8o3u060woDkhunLXHMtKOhuFK2i-xJpuM,133
132
131
  contentctl/templates/app_default.yml,sha256=kDeYdJbfMADQPcho8iH1nqgTFrHNt4EXnIJjPHc2unI,6390
133
132
  contentctl/templates/app_template/README/essoc_story_detail.txt,sha256=7hFPBfPpRH28TFl7QchKceZLewQqgFjRWDlmxZzwpmo,897
@@ -141,7 +140,6 @@ contentctl/templates/app_template/default/content-version.conf,sha256=TGzX6qLdzR
141
140
  contentctl/templates/app_template/default/data/ui/nav/default.xml,sha256=fKN53HZCtNJbQqq_5pP8e5-5m30DRrJittr6q5s6V_0,236
142
141
  contentctl/templates/app_template/default/data/ui/views/escu_summary.xml,sha256=jQhkIthPgEEptCJ2wUCj2lWGHBvUl6JGsKkDfONloxI,8635
143
142
  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
143
  contentctl/templates/app_template/default/usage_searches.conf,sha256=mFnhAHGhFHIzl8xxA626thnAjyxs5ZQQfur1PP_Xmbg,4257
146
144
  contentctl/templates/app_template/default/use_case_library.conf,sha256=zWuCOOl8SiP7Kit2s-de4KRu3HySLtBSXcp1QnJx0ec,168
147
145
  contentctl/templates/app_template/lookups/mitre_enrichment.csv,sha256=tifPQjFoQHtvpb78hxSP2fKHnHeehNbZDwUjdvc0aEM,66072
@@ -157,12 +155,16 @@ contentctl/templates/deployments/escu_default_configuration_baseline.yml,sha256=
157
155
  contentctl/templates/deployments/escu_default_configuration_correlation.yml,sha256=iWLqvJnUKVhpKaLBc_w_W65d9HVZgOZfGA-RIpxsH6M,519
158
156
  contentctl/templates/deployments/escu_default_configuration_hunting.yml,sha256=hHmM8u7zncpb-32Qv74UoNs0HKwZwCMoKAq2ygDJZbo,329
159
157
  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
158
+ contentctl/templates/detections/application/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
159
+ contentctl/templates/detections/cloud/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
+ contentctl/templates/detections/endpoint/anomalous_usage_of_7zip.yml,sha256=hkN214ZOqbQPWyYrqgbOrYb4iA0DroG1AnFRhSC_m0M,3323
161
+ contentctl/templates/detections/network/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
+ contentctl/templates/detections/web/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
161
163
  contentctl/templates/macros/security_content_ctime.yml,sha256=Gg1YNllHVsX_YB716H1SJLWzxXZEfuJlnsgB2fuyoHU,159
162
164
  contentctl/templates/macros/security_content_summariesonly.yml,sha256=9BYUxAl2E4Nwh8K19F3AJS8Ka7ceO6ZDBjFiO3l3LY0,162
163
165
  contentctl/templates/stories/cobalt_strike.yml,sha256=rlaXxMN-5k8LnKBLPafBoksyMtlmsPMHPJOjTiMiZ-M,3063
164
- contentctl-4.0.4.dist-info/LICENSE.md,sha256=hQWUayRk-pAiOZbZnuy8djmoZkjKBx8MrCFpW-JiOgo,11344
165
- contentctl-4.0.4.dist-info/METADATA,sha256=quZj1WvlwYP3QddPZkNrHE8i3AlLaD-oa_nQqNZakmE,19751
166
- contentctl-4.0.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
167
- contentctl-4.0.4.dist-info/entry_points.txt,sha256=5bjZ2NkbQfSwK47uOnA77yCtjgXhvgxnmCQiynRF_-U,57
168
- contentctl-4.0.4.dist-info/RECORD,,
166
+ contentctl-4.1.0.dist-info/LICENSE.md,sha256=hQWUayRk-pAiOZbZnuy8djmoZkjKBx8MrCFpW-JiOgo,11344
167
+ contentctl-4.1.0.dist-info/METADATA,sha256=AXM-iaprX65-e2JRJCjSFS4yr315R3uAbh80e5KJp20,19706
168
+ contentctl-4.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
169
+ contentctl-4.1.0.dist-info/entry_points.txt,sha256=5bjZ2NkbQfSwK47uOnA77yCtjgXhvgxnmCQiynRF_-U,57
170
+ contentctl-4.1.0.dist-info/RECORD,,
@@ -1,98 +0,0 @@
1
- import splunklib.client as client
2
- import multiprocessing
3
- import http.server
4
- import time
5
- import sys
6
- import subprocess
7
- import os
8
- class Deploy:
9
- def __init__(self, args):
10
-
11
-
12
-
13
- #First, check to ensure that the legal ack is correct. If not, quit
14
- if args.acs_legal_ack != "Y":
15
- raise(Exception(f"Error - must supply 'acs-legal-ack=Y', not 'acs-legal-ack={args.acs_legal_ack}'"))
16
-
17
- self.acs_legal_ack = args.acs_legal_ack
18
- self.app_package = args.app_package
19
- if not os.path.exists(self.app_package):
20
- raise(Exception(f"Error - app_package file {self.app_package} does not exist"))
21
- self.username = args.username
22
- self.password = args.password
23
- self.server = args.server
24
-
25
-
26
-
27
- self.deploy_to_splunk_cloud()
28
- #self.http_process = self.start_http_server()
29
-
30
- #self.install_app()
31
-
32
-
33
- def deploy_to_splunk_cloud(self):
34
-
35
- commandline = f"acs apps install private --acs-legal-ack={self.acs_legal_ack} "\
36
- f"--app-package {self.app_package} --server {self.server} --username "\
37
- f"{self.username} --password {self.password}"
38
-
39
-
40
- try:
41
- res = subprocess.run(args = commandline.split(' '), )
42
- except Exception as e:
43
- raise(Exception(f"Error deploying to Splunk Cloud Instance: {str(e)}"))
44
- print(res.returncode)
45
- if res.returncode != 0:
46
- raise(Exception("Error deploying to Splunk Cloud Instance. Review output to diagnose error."))
47
-
48
- '''
49
- def install_app_local(self) -> bool:
50
- #Connect to the service
51
- time.sleep(1)
52
- #self.http_process.start()
53
- #time.sleep(2)
54
-
55
-
56
- print(f"Connecting to server {self.host}")
57
- try:
58
- service = client.connect(host=self.host, port=self.api_port, username=self.username, password=self.password)
59
- assert isinstance(service, client.Service)
60
-
61
- except Exception as e:
62
- raise(Exception(f"Failure connecting the Splunk Search Head: {str(e)}"))
63
-
64
-
65
- #Install the app
66
- try:
67
- params = {'name': self.server_app_path}
68
- res = service.post('apps/appinstall', **params)
69
- #Check the result?
70
-
71
- print(f"Successfully installed {self.server_app_path}!")
72
-
73
-
74
-
75
- except Exception as e:
76
- raise(Exception(f"Failure installing the app {self.server_app_path}: {str(e)}"))
77
-
78
-
79
- #Query and list all of the installed apps
80
- try:
81
- all_apps = service.apps
82
- except Exception as e:
83
- print(f"Failed listing all apps: {str(e)}")
84
- return False
85
-
86
- print("Installed apps:")
87
- for count, app in enumerate(all_apps):
88
- print("\t{count}. {app.name}")
89
-
90
-
91
- print(f"Installing app {self.path}")
92
-
93
- self.http_process.terminate()
94
-
95
- return True
96
- '''
97
-
98
-
@@ -1,151 +0,0 @@
1
- import os
2
- import sys
3
- import json
4
- import requests
5
- from requests.auth import HTTPBasicAuth
6
-
7
- from dataclasses import dataclass
8
- from configparser import RawConfigParser
9
- import splunklib.client as client
10
-
11
- from contentctl.objects.config import Config
12
- import pathlib
13
-
14
- @dataclass(frozen=True)
15
- class API_DeployInputDto:
16
- path: pathlib.Path
17
- config: Config
18
-
19
-
20
- class API_Deploy:
21
- def fix_newlines_in_conf_files(self, conf_path: pathlib.Path) -> RawConfigParser:
22
- parser = RawConfigParser()
23
- with open(conf_path, "r") as conf_data_file:
24
- conf_data = conf_data_file.read()
25
-
26
- # ConfigParser cannot read multipleline strings that simply escape the newline character with \
27
- # To include a newline, you need to include a space at the beginning of the newline.
28
- # We will simply replace all \NEWLINE with NEWLINESPACE (removing the leading literal \).
29
- # We will discuss whether we intend to make these changes to the underlying conf files
30
- # or just apply the changes here
31
- conf_data = conf_data.replace("\\\n", "\n ")
32
-
33
- parser.read_string(conf_data)
34
- return parser
35
-
36
- def execute(self, input_dto: API_DeployInputDto) -> None:
37
- if len(input_dto.config.deployments.rest_api_deployments) == 0:
38
- raise Exception("No rest_api_deployments defined in 'contentctl.yml'")
39
- app_path = pathlib.Path(input_dto.config.build.path_root)/input_dto.config.build.title
40
- if not app_path.is_dir():
41
- raise Exception(f"The unpackaged app does not exist at the path {app_path}. Please run 'contentctl build' to generate the app.")
42
- for target in input_dto.config.deployments.rest_api_deployments:
43
- print(f"Deploying '{input_dto.config.build.title}' to target '{target.server}' [{target.description}]")
44
- splunk_args = {
45
- "host": target.server,
46
- "port": target.port,
47
- "username": target.username,
48
- "password": target.password,
49
- "owner": "nobody",
50
- "app": "search",
51
- }
52
- print("Warning - we are currently deploying all content into the 'search' app. "
53
- "At this time, this means the user does not have to install the app "
54
- "manually, but this will change")
55
- service = client.connect(**splunk_args)
56
-
57
-
58
- macros_parser = self.fix_newlines_in_conf_files(
59
- app_path/"default"/"macros.conf"
60
- )
61
- import tqdm
62
-
63
- bar_format_macros = (
64
- f"Deploying macros "
65
- + "{percentage:3.0f}%[{bar:20}]"
66
- + "[{n_fmt}/{total_fmt} | ETA: {remaining}]"
67
- )
68
- bar_format_detections = (
69
- f"Deploying saved searches"
70
- + "{percentage:3.0f}%[{bar:20}]"
71
- + "[{n_fmt}/{total_fmt} | ETA: {remaining}]"
72
- )
73
- for section in tqdm.tqdm(
74
- macros_parser.sections(), bar_format=bar_format_macros
75
- ):
76
- try:
77
- service.post("properties/macros", __stanza=section)
78
- service.post("properties/macros/" + section, **macros_parser[section])
79
- tqdm.tqdm.write(f"Deployed macro [{section}]")
80
- except Exception as e:
81
- tqdm.tqdm.write(f"Error deploying macro {section}: {str(e)}")
82
-
83
- detection_parser = RawConfigParser()
84
- detection_parser = self.fix_newlines_in_conf_files(
85
- app_path/"default"/"savedsearches.conf",
86
- )
87
-
88
-
89
- for section in tqdm.tqdm(
90
- detection_parser.sections(), bar_format=bar_format_detections
91
- ):
92
- try:
93
- if section.startswith(input_dto.config.build.prefix):
94
- params = detection_parser[section]
95
- params["name"] = section
96
- response_actions = []
97
- if (
98
- input_dto.config.detection_configuration.notable
99
- and input_dto.config.detection_configuration.notable.rule_description
100
- ):
101
- response_actions.append("notable")
102
- if (
103
- input_dto.config.detection_configuration.rba
104
- and input_dto.config.detection_configuration.rba.enabled
105
- ):
106
- response_actions.append("risk")
107
- params["actions"] = ",".join(response_actions)
108
- params["request.ui_dispatch_app"] = "ES Content Updates"
109
- params["request.ui_dispatch_view"] = "ES Content Updates"
110
- params["alert_type"] = params.pop("counttype")
111
- params["alert_comparator"] = params.pop("relation")
112
- params["alert_threshold"] = params.pop("quantity")
113
- params.pop("enablesched")
114
-
115
- try:
116
- service.saved_searches.delete(section)
117
- #tqdm.tqdm.write(f"Deleted old saved search: {section}")
118
- except Exception as e:
119
- #tqdm.tqdm.write(f"Error deleting savedsearch '{section}' :[{str(e)}]")
120
- pass
121
-
122
- service.post("saved/searches", **params)
123
- tqdm.tqdm.write(f"Deployed savedsearch [{section}]")
124
-
125
- except Exception as e:
126
- tqdm.tqdm.write(f"Error deploying saved search {section}: {str(e)}")
127
-
128
- # story_parser = RawConfigParser()
129
- # story_parser.read(os.path.join(input_dto.path, input_dto.config.build.splunk_app.path, "default", "analyticstories.conf"))
130
-
131
- # for section in story_parser.sections():
132
- # if section.startswith("analytic_story"):
133
- # params = story_parser[section]
134
- # params = dict(params.items())
135
- # params["spec_version"] = 1
136
- # params["version"] = 1
137
- # name = section[17:]
138
- # #service.post('services/analyticstories/configs/analytic_story', name=name, content=json.dumps(params))
139
-
140
- # url = "https://3.72.220.157:8089/services/analyticstories/configs/analytic_story"
141
- # data = dict()
142
- # data["name"] = name
143
- # data["content"] = params
144
- # print(json.dumps(data))
145
- # response = requests.post(
146
- # url,
147
- # auth=HTTPBasicAuth('admin', 'fgWFshd0mm7eErMj9qX'),
148
- # data=json.dumps(data),
149
- # verify=False
150
- # )
151
- # print(response.text)
@@ -1,5 +0,0 @@
1
- [replicationSettings:refineConf]
2
- replicate.analytic_stories = false
3
-
4
- [replicationBlacklist]
5
- excludeESCU = apps[/\\]DA-ESS-ContentUpdate[/\\]lookups[/\\]...
File without changes