prelude-cli-beta 1416__tar.gz → 1443__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {prelude_cli_beta-1416/prelude_cli_beta.egg-info → prelude_cli_beta-1443}/PKG-INFO +2 -2
  2. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/partner.py +0 -11
  3. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/scm.py +111 -2
  4. {prelude_cli_beta-1416 → prelude_cli_beta-1443/prelude_cli_beta.egg-info}/PKG-INFO +2 -2
  5. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta.egg-info/requires.txt +1 -1
  6. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/setup.cfg +2 -2
  7. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/LICENSE +0 -0
  8. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/MANIFEST.in +0 -0
  9. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/README.md +0 -0
  10. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/__init__.py +0 -0
  11. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/cli.py +0 -0
  12. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/templates/__init__.py +0 -0
  13. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/__init__.py +0 -0
  14. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/auth.py +0 -0
  15. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/build.py +0 -0
  16. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/configure.py +0 -0
  17. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/detect.py +0 -0
  18. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/generate.py +0 -0
  19. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/iam.py +0 -0
  20. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/jobs.py +0 -0
  21. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta/views/shared.py +0 -0
  22. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta.egg-info/SOURCES.txt +0 -0
  23. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta.egg-info/dependency_links.txt +0 -0
  24. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta.egg-info/entry_points.txt +0 -0
  25. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/prelude_cli_beta.egg-info/top_level.txt +0 -0
  26. {prelude_cli_beta-1416 → prelude_cli_beta-1443}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prelude-cli-beta
3
- Version: 1416
3
+ Version: 1443
4
4
  Summary: For interacting with the Prelude SDK
5
5
  Home-page: https://github.com/preludeorg
6
6
  Author: Prelude Research
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: prelude-sdk-beta==1416
14
+ Requires-Dist: prelude-sdk-beta==1443
15
15
  Requires-Dist: click>8
16
16
  Requires-Dist: rich
17
17
  Requires-Dist: python-dateutil
@@ -136,17 +136,6 @@ def partner_reports(controller, partner, test_id):
136
136
  with Spinner(description="Getting reports to partner"):
137
137
  return controller.list_reports(partner=Control[partner], test_id=test_id)
138
138
 
139
-
140
- @partner.command("ioa-stats")
141
- @click.option("-t", "--test_id", help="test to get IOA stats for")
142
- @click.pass_obj
143
- @pretty_print
144
- def ioa_stats(controller, test_id):
145
- """Get IOA stats"""
146
- with Spinner(description="Getting IOA stats"):
147
- return controller.ioa_stats(test_id=test_id)
148
-
149
-
150
139
  @partner.command("observed-detected")
151
140
  @click.option("-t", "--test_id", help="test to get observed/detected stats for")
152
141
  @click.option("-h", "--hours", help="number of hours to look back", type=int)
@@ -1,4 +1,5 @@
1
1
  import click
2
+ import json
2
3
  import requests
3
4
  from time import sleep
4
5
 
@@ -693,7 +694,6 @@ def delete_notification(controller, notification_id):
693
694
  required=True,
694
695
  )
695
696
  @click.option(
696
- "-u",
697
697
  "--slack_urls",
698
698
  help="comma-separated list of Slack Webhook URLs to notify",
699
699
  default=None,
@@ -707,7 +707,6 @@ def delete_notification(controller, notification_id):
707
707
  type=bool,
708
708
  )
709
709
  @click.option(
710
- "-u",
711
710
  "--teams_urls",
712
711
  help="comma-separated list of Teams Webhook URLs to notify",
713
712
  default=None,
@@ -770,3 +769,113 @@ def list_history(controller, odata_filter, start, end):
770
769
  """List history"""
771
770
  with Spinner("Fetching SCM history"):
772
771
  return controller.list_history(start, end, filter=odata_filter)
772
+
773
+
774
+ @click.group()
775
+ @click.pass_context
776
+ def report(ctx):
777
+ """SCM report commands"""
778
+ ctx.obj = ScmController(account=ctx.obj.account)
779
+
780
+
781
+ scm.add_command(report)
782
+
783
+
784
+ @report.command("get")
785
+ @click.argument("report_id", type=str)
786
+ @click.pass_obj
787
+ @pretty_print
788
+ def get_report(controller, report_id):
789
+ with Spinner("Fetching report"):
790
+ return controller.get_report(report_id)
791
+
792
+
793
+ @report.command("list")
794
+ @click.pass_obj
795
+ @pretty_print
796
+ def list_reports(controller):
797
+ with Spinner("Fetching reports"):
798
+ return controller.list_reports()
799
+
800
+
801
+ @report.command("delete")
802
+ @click.argument("report_id", type=str)
803
+ @click.confirmation_option(prompt="Are you sure?")
804
+ @click.pass_obj
805
+ @pretty_print
806
+ def delete_report(controller, report_id):
807
+ with Spinner("Deleting report"):
808
+ return controller.delete_report(report_id)
809
+
810
+
811
+ @report.command("put")
812
+ @click.option(
813
+ "--report_data",
814
+ type=str,
815
+ help="report data in JSON format, cannot be used with report_file",
816
+ default=None,
817
+ )
818
+ @click.option(
819
+ "--report_file",
820
+ type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True),
821
+ help="report data JSON file, will ignore report_data if provided",
822
+ default=None,
823
+ )
824
+ @click.option("--report_id", type=str, help="report ID to update", default=None)
825
+ @click.pass_obj
826
+ @pretty_print
827
+ def put_report(controller, report_data, report_file, report_id):
828
+ if not report_data and not report_file:
829
+ raise ValueError("Either report_data or report_file must be provided")
830
+
831
+ with Spinner("Updating report"):
832
+ if report_file:
833
+ with open(report_file, "r") as f:
834
+ report_data = f.read()
835
+ report_data = json.loads(report_data)
836
+ return controller.put_report(report_data, report_id)
837
+
838
+
839
+ @report.command("chart-data")
840
+ @click.argument(
841
+ "scm_category",
842
+ type=click.Choice(
843
+ [c.name for c in SCMCategory if c.value > 0], case_sensitive=False
844
+ ),
845
+ )
846
+ @click.option("--group_by", "-b", help="field to group by", required=True, type=str)
847
+ @click.option(
848
+ "--group_limit", "-l", help="max number of groups to return", type=int, default=100
849
+ )
850
+ @click.option(
851
+ "--sort_by",
852
+ "-s",
853
+ help="sort method",
854
+ type=click.Choice(["a-z", "z-a", "0-9", "9-0"]),
855
+ default="9-0",
856
+ )
857
+ @click.option(
858
+ "--scopes",
859
+ "-c",
860
+ help="comma-separated list of scope to value pairs, i.e. instances/control=1,instances/platform=windows",
861
+ default=None,
862
+ type=str,
863
+ )
864
+ @click.option(
865
+ "--odata_filter", "-f", help="OData filter string", default=None, type=str
866
+ )
867
+ @click.pass_obj
868
+ @pretty_print
869
+ def get_chart_data(
870
+ controller, scm_category, group_by, group_limit, sort_by, scopes, odata_filter
871
+ ):
872
+ """Get chart data for SCM reports"""
873
+ with Spinner("Fetching chart data"):
874
+ return controller.get_chart_data(
875
+ scm_category=SCMCategory[scm_category],
876
+ group_by=group_by,
877
+ group_limit=group_limit,
878
+ sort_by=sort_by,
879
+ scopes=scopes,
880
+ odata_filter=odata_filter,
881
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prelude-cli-beta
3
- Version: 1416
3
+ Version: 1443
4
4
  Summary: For interacting with the Prelude SDK
5
5
  Home-page: https://github.com/preludeorg
6
6
  Author: Prelude Research
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: prelude-sdk-beta==1416
14
+ Requires-Dist: prelude-sdk-beta==1443
15
15
  Requires-Dist: click>8
16
16
  Requires-Dist: rich
17
17
  Requires-Dist: python-dateutil
@@ -1,4 +1,4 @@
1
- prelude-sdk-beta==1416
1
+ prelude-sdk-beta==1443
2
2
  click>8
3
3
  rich
4
4
  python-dateutil
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = prelude-cli-beta
3
- version = 1416
3
+ version = 1443
4
4
  author = Prelude Research
5
5
  author_email = support@preludesecurity.com
6
6
  description = For interacting with the Prelude SDK
@@ -17,7 +17,7 @@ packages = find:
17
17
  include_package_data = True
18
18
  python_requires = >=3.10
19
19
  install_requires =
20
- prelude-sdk-beta == 1416
20
+ prelude-sdk-beta == 1443
21
21
  click > 8
22
22
  rich
23
23
  python-dateutil
File without changes