prelude-cli-beta 1396__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.

Potentially problematic release.


This version of prelude-cli-beta might be problematic. Click here for more details.

Files changed (28) hide show
  1. prelude_cli_beta-1396/LICENSE +9 -0
  2. prelude_cli_beta-1396/MANIFEST.in +1 -0
  3. prelude_cli_beta-1396/PKG-INFO +38 -0
  4. prelude_cli_beta-1396/README.md +18 -0
  5. prelude_cli_beta-1396/prelude_cli/__init__.py +0 -0
  6. prelude_cli_beta-1396/prelude_cli/cli.py +47 -0
  7. prelude_cli_beta-1396/prelude_cli/templates/README.md +28 -0
  8. prelude_cli_beta-1396/prelude_cli/templates/__init__.py +0 -0
  9. prelude_cli_beta-1396/prelude_cli/templates/template.go +24 -0
  10. prelude_cli_beta-1396/prelude_cli/views/__init__.py +0 -0
  11. prelude_cli_beta-1396/prelude_cli/views/auth.py +56 -0
  12. prelude_cli_beta-1396/prelude_cli/views/build.py +488 -0
  13. prelude_cli_beta-1396/prelude_cli/views/configure.py +29 -0
  14. prelude_cli_beta-1396/prelude_cli/views/detect.py +438 -0
  15. prelude_cli_beta-1396/prelude_cli/views/generate.py +125 -0
  16. prelude_cli_beta-1396/prelude_cli/views/iam.py +368 -0
  17. prelude_cli_beta-1396/prelude_cli/views/jobs.py +50 -0
  18. prelude_cli_beta-1396/prelude_cli/views/partner.py +192 -0
  19. prelude_cli_beta-1396/prelude_cli/views/scm.py +471 -0
  20. prelude_cli_beta-1396/prelude_cli/views/shared.py +37 -0
  21. prelude_cli_beta-1396/prelude_cli_beta.egg-info/PKG-INFO +38 -0
  22. prelude_cli_beta-1396/prelude_cli_beta.egg-info/SOURCES.txt +27 -0
  23. prelude_cli_beta-1396/prelude_cli_beta.egg-info/dependency_links.txt +1 -0
  24. prelude_cli_beta-1396/prelude_cli_beta.egg-info/entry_points.txt +2 -0
  25. prelude_cli_beta-1396/prelude_cli_beta.egg-info/requires.txt +5 -0
  26. prelude_cli_beta-1396/prelude_cli_beta.egg-info/top_level.txt +1 -0
  27. prelude_cli_beta-1396/pyproject.toml +6 -0
  28. prelude_cli_beta-1396/setup.cfg +33 -0
@@ -0,0 +1,9 @@
1
+ MIT LICENSE
2
+
3
+ Copyright 2022, Prelude Research
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ include prelude_cli/templates/*
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.4
2
+ Name: prelude-cli-beta
3
+ Version: 1396
4
+ Summary: For interacting with the Prelude SDK
5
+ Home-page: https://github.com/preludeorg
6
+ Author: Prelude Research
7
+ Author-email: support@preludesecurity.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: prelude-sdk==2.6.13a1396
15
+ Requires-Dist: click>8
16
+ Requires-Dist: rich
17
+ Requires-Dist: python-dateutil
18
+ Requires-Dist: pyyaml
19
+ Dynamic: license-file
20
+
21
+ # Prelude CLI
22
+
23
+ Interact with the full range of features in Prelude Detect, organized by:
24
+
25
+ - IAM: manage your account
26
+ - Build: write and maintain your collection of security tests
27
+ - Detect: schedule security tests for your endpoints
28
+
29
+ ## Quick start
30
+ ```bash
31
+ pip install prelude-cli
32
+ prelude --help
33
+ prelude --interactive
34
+ ```
35
+
36
+ ## Documentation
37
+
38
+ https://docs.preludesecurity.com/docs/prelude-cli
@@ -0,0 +1,18 @@
1
+ # Prelude CLI
2
+
3
+ Interact with the full range of features in Prelude Detect, organized by:
4
+
5
+ - IAM: manage your account
6
+ - Build: write and maintain your collection of security tests
7
+ - Detect: schedule security tests for your endpoints
8
+
9
+ ## Quick start
10
+ ```bash
11
+ pip install prelude-cli
12
+ prelude --help
13
+ prelude --interactive
14
+ ```
15
+
16
+ ## Documentation
17
+
18
+ https://docs.preludesecurity.com/docs/prelude-cli
File without changes
@@ -0,0 +1,47 @@
1
+ import click
2
+
3
+ from prelude_cli.views.auth import auth
4
+ from prelude_cli.views.build import build
5
+ from prelude_cli.views.configure import configure
6
+ from prelude_cli.views.detect import detect
7
+ from prelude_cli.views.generate import generate
8
+ from prelude_cli.views.iam import iam
9
+ from prelude_cli.views.jobs import jobs
10
+ from prelude_cli.views.partner import partner
11
+ from prelude_cli.views.scm import scm
12
+ from prelude_sdk.models.account import Account, Keychain
13
+
14
+
15
+ def complete_profile(ctx, param, incomplete):
16
+ return [x for x in Keychain().read_keychain() if x.startswith(incomplete)]
17
+
18
+
19
+ @click.group(invoke_without_command=True)
20
+ @click.version_option()
21
+ @click.pass_context
22
+ @click.option(
23
+ "--profile",
24
+ default="default",
25
+ help="The prelude keychain profile to use",
26
+ show_default=True,
27
+ shell_complete=complete_profile,
28
+ )
29
+ def cli(ctx, profile):
30
+ ctx.obj = Account.from_keychain(profile=profile)
31
+ if ctx.invoked_subcommand is None:
32
+ click.echo(ctx.get_help())
33
+
34
+
35
+ cli.add_command(auth)
36
+ cli.add_command(build)
37
+ cli.add_command(configure)
38
+ cli.add_command(detect)
39
+ cli.add_command(generate)
40
+ cli.add_command(iam)
41
+ cli.add_command(jobs)
42
+ cli.add_command(partner)
43
+ cli.add_command(scm)
44
+
45
+
46
+ if __name__ == "__main__":
47
+ cli()
@@ -0,0 +1,28 @@
1
+ # $NAME
2
+
3
+ This section should describe the test, provide some background information (such as historical in-the-wild usage by threat actors or APTs), and briefly illustrate the test's intention, objective, and techniques utilized to achieve them. This section should NOT be too technical or overly long; a small paragraph should be sufficient.
4
+
5
+ ## How
6
+
7
+ > Safety: This section should contain an advisory statement that positively declares that the VST does not negatively affect the tested system in any way.
8
+
9
+ Steps:
10
+
11
+ 1. This section enumerates the individual, atomic steps by which ...
12
+ 2. ... the probe attempts to achieve the intended effect of the test ...
13
+ 3. ... and thereby perform evaluation of any resident security solutions.
14
+
15
+ Example Output:
16
+ ```bash
17
+ [$ID] Starting test at: $TIME
18
+ [$ID] Host is vulnerable, continuing with technique execution
19
+ [$ID] Completed with code: 101
20
+ [$ID] Ending test at: $TIME
21
+ ```
22
+
23
+ ## Resolution
24
+
25
+ If this test fails:
26
+
27
+ * Bulleted list of recommendations that the testing organization SHOULD consider ...
28
+ * ... based upon the nature of the test, as well as the point of failure.
@@ -0,0 +1,24 @@
1
+ /*
2
+ ID: $ID
3
+ NAME: $NAME
4
+ TECHNIQUE: $TECHNIQUE
5
+ UNIT: $UNIT
6
+ CREATED: $TIME
7
+ */
8
+ package main
9
+
10
+ import (
11
+ Endpoint "github.com/preludeorg/libraries/go/tests/endpoint"
12
+ )
13
+
14
+ func test() {
15
+ Endpoint.Stop(Endpoint.TestCompletedNormally)
16
+ }
17
+
18
+ func clean() {
19
+ Endpoint.Say("Cleaning up")
20
+ }
21
+
22
+ func main() {
23
+ Endpoint.Start(test, clean)
24
+ }
File without changes
@@ -0,0 +1,56 @@
1
+ import click
2
+ import webbrowser
3
+
4
+ from prelude_cli.views.shared import Spinner, pretty_print
5
+
6
+
7
+ @click.group()
8
+ @click.pass_context
9
+ def auth(ctx):
10
+ """Authentication"""
11
+ pass
12
+
13
+
14
+ @auth.command("login")
15
+ @click.option("-p", "--password", type=str, help="password for login")
16
+ @click.option(
17
+ "-t",
18
+ "--temp_password",
19
+ type=str,
20
+ help="temporary password for login (if set, `password` will become your new password)",
21
+ )
22
+ @click.pass_obj
23
+ @pretty_print
24
+ def login(account, password, temp_password):
25
+ """Login using password or SSO"""
26
+ if not account.oidc:
27
+ password = password or click.prompt("Password", type=str, hide_input=True)
28
+ with Spinner(description="Logging in and saving tokens"):
29
+ new_password = password if temp_password else None
30
+ password = temp_password or password
31
+ return (
32
+ account.password_login(password, new_password),
33
+ "Login with password successful",
34
+ )
35
+
36
+ url = f"{account.hq.replace('api', 'platform')}/cli-auth?handle={account.handle}&provider={account.oidc}"
37
+ if account.oidc == "custom":
38
+ slug = account.slug or click.prompt("Please enter your account slug")
39
+ url += f"&slug={slug}"
40
+ webbrowser.open(url)
41
+ code = click.prompt(
42
+ f"Launching browser for authentication:\n\n{url}\n\nPlease enter your authorization code here"
43
+ )
44
+ verifier, authorization_code = code.split("/")
45
+ with Spinner(description="Logging in and saving tokens"):
46
+ tokens = account.exchange_authorization_code(authorization_code, verifier)
47
+ return tokens, "Login with SSO successful"
48
+
49
+
50
+ @auth.command("refresh")
51
+ @click.pass_obj
52
+ @pretty_print
53
+ def refresh(account):
54
+ """Refresh your tokens"""
55
+ with Spinner(description="Refreshing tokens"):
56
+ return account.refresh_tokens(), "New access tokens saved"