bt-cli 0.4.13__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 (121) hide show
  1. bt_cli/__init__.py +3 -0
  2. bt_cli/cli.py +830 -0
  3. bt_cli/commands/__init__.py +1 -0
  4. bt_cli/commands/configure.py +415 -0
  5. bt_cli/commands/learn.py +229 -0
  6. bt_cli/commands/quick.py +784 -0
  7. bt_cli/core/__init__.py +1 -0
  8. bt_cli/core/auth.py +213 -0
  9. bt_cli/core/client.py +313 -0
  10. bt_cli/core/config.py +393 -0
  11. bt_cli/core/config_file.py +420 -0
  12. bt_cli/core/csv_utils.py +91 -0
  13. bt_cli/core/errors.py +247 -0
  14. bt_cli/core/output.py +205 -0
  15. bt_cli/core/prompts.py +87 -0
  16. bt_cli/core/rest_debug.py +221 -0
  17. bt_cli/data/CLAUDE.md +94 -0
  18. bt_cli/data/__init__.py +0 -0
  19. bt_cli/data/skills/bt/SKILL.md +108 -0
  20. bt_cli/data/skills/entitle/SKILL.md +170 -0
  21. bt_cli/data/skills/epmw/SKILL.md +144 -0
  22. bt_cli/data/skills/pra/SKILL.md +150 -0
  23. bt_cli/data/skills/pws/SKILL.md +198 -0
  24. bt_cli/entitle/__init__.py +1 -0
  25. bt_cli/entitle/client/__init__.py +5 -0
  26. bt_cli/entitle/client/base.py +443 -0
  27. bt_cli/entitle/commands/__init__.py +24 -0
  28. bt_cli/entitle/commands/accounts.py +53 -0
  29. bt_cli/entitle/commands/applications.py +39 -0
  30. bt_cli/entitle/commands/auth.py +68 -0
  31. bt_cli/entitle/commands/bundles.py +218 -0
  32. bt_cli/entitle/commands/integrations.py +60 -0
  33. bt_cli/entitle/commands/permissions.py +70 -0
  34. bt_cli/entitle/commands/policies.py +97 -0
  35. bt_cli/entitle/commands/resources.py +131 -0
  36. bt_cli/entitle/commands/roles.py +74 -0
  37. bt_cli/entitle/commands/users.py +123 -0
  38. bt_cli/entitle/commands/workflows.py +187 -0
  39. bt_cli/entitle/models/__init__.py +31 -0
  40. bt_cli/entitle/models/bundle.py +28 -0
  41. bt_cli/entitle/models/common.py +37 -0
  42. bt_cli/entitle/models/integration.py +30 -0
  43. bt_cli/entitle/models/permission.py +27 -0
  44. bt_cli/entitle/models/policy.py +25 -0
  45. bt_cli/entitle/models/resource.py +29 -0
  46. bt_cli/entitle/models/role.py +28 -0
  47. bt_cli/entitle/models/user.py +24 -0
  48. bt_cli/entitle/models/workflow.py +55 -0
  49. bt_cli/epmw/__init__.py +1 -0
  50. bt_cli/epmw/client/__init__.py +5 -0
  51. bt_cli/epmw/client/base.py +848 -0
  52. bt_cli/epmw/commands/__init__.py +33 -0
  53. bt_cli/epmw/commands/audits.py +250 -0
  54. bt_cli/epmw/commands/auth.py +55 -0
  55. bt_cli/epmw/commands/computers.py +140 -0
  56. bt_cli/epmw/commands/events.py +233 -0
  57. bt_cli/epmw/commands/groups.py +215 -0
  58. bt_cli/epmw/commands/policies.py +673 -0
  59. bt_cli/epmw/commands/quick.py +348 -0
  60. bt_cli/epmw/commands/requests.py +224 -0
  61. bt_cli/epmw/commands/roles.py +78 -0
  62. bt_cli/epmw/commands/tasks.py +38 -0
  63. bt_cli/epmw/commands/users.py +219 -0
  64. bt_cli/epmw/models/__init__.py +1 -0
  65. bt_cli/pra/__init__.py +1 -0
  66. bt_cli/pra/client/__init__.py +5 -0
  67. bt_cli/pra/client/base.py +618 -0
  68. bt_cli/pra/commands/__init__.py +30 -0
  69. bt_cli/pra/commands/auth.py +55 -0
  70. bt_cli/pra/commands/import_export.py +442 -0
  71. bt_cli/pra/commands/jump_clients.py +139 -0
  72. bt_cli/pra/commands/jump_groups.py +146 -0
  73. bt_cli/pra/commands/jump_items.py +638 -0
  74. bt_cli/pra/commands/jumpoints.py +95 -0
  75. bt_cli/pra/commands/policies.py +197 -0
  76. bt_cli/pra/commands/quick.py +470 -0
  77. bt_cli/pra/commands/teams.py +81 -0
  78. bt_cli/pra/commands/users.py +87 -0
  79. bt_cli/pra/commands/vault.py +564 -0
  80. bt_cli/pra/models/__init__.py +27 -0
  81. bt_cli/pra/models/common.py +12 -0
  82. bt_cli/pra/models/jump_client.py +25 -0
  83. bt_cli/pra/models/jump_group.py +15 -0
  84. bt_cli/pra/models/jump_item.py +72 -0
  85. bt_cli/pra/models/jumpoint.py +19 -0
  86. bt_cli/pra/models/team.py +14 -0
  87. bt_cli/pra/models/user.py +17 -0
  88. bt_cli/pra/models/vault.py +45 -0
  89. bt_cli/pws/__init__.py +1 -0
  90. bt_cli/pws/client/__init__.py +5 -0
  91. bt_cli/pws/client/base.py +356 -0
  92. bt_cli/pws/client/beyondinsight.py +869 -0
  93. bt_cli/pws/client/passwordsafe.py +1786 -0
  94. bt_cli/pws/commands/__init__.py +33 -0
  95. bt_cli/pws/commands/accounts.py +372 -0
  96. bt_cli/pws/commands/assets.py +311 -0
  97. bt_cli/pws/commands/auth.py +166 -0
  98. bt_cli/pws/commands/clouds.py +221 -0
  99. bt_cli/pws/commands/config.py +344 -0
  100. bt_cli/pws/commands/credentials.py +347 -0
  101. bt_cli/pws/commands/databases.py +306 -0
  102. bt_cli/pws/commands/directories.py +199 -0
  103. bt_cli/pws/commands/functional.py +298 -0
  104. bt_cli/pws/commands/import_export.py +452 -0
  105. bt_cli/pws/commands/platforms.py +118 -0
  106. bt_cli/pws/commands/quick.py +1646 -0
  107. bt_cli/pws/commands/search.py +256 -0
  108. bt_cli/pws/commands/secrets.py +1343 -0
  109. bt_cli/pws/commands/systems.py +389 -0
  110. bt_cli/pws/commands/users.py +415 -0
  111. bt_cli/pws/commands/workgroups.py +166 -0
  112. bt_cli/pws/config.py +18 -0
  113. bt_cli/pws/models/__init__.py +19 -0
  114. bt_cli/pws/models/account.py +186 -0
  115. bt_cli/pws/models/asset.py +102 -0
  116. bt_cli/pws/models/common.py +132 -0
  117. bt_cli/pws/models/system.py +121 -0
  118. bt_cli-0.4.13.dist-info/METADATA +417 -0
  119. bt_cli-0.4.13.dist-info/RECORD +121 -0
  120. bt_cli-0.4.13.dist-info/WHEEL +4 -0
  121. bt_cli-0.4.13.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,95 @@
1
+ """Jumpoint commands."""
2
+
3
+ from typing import Optional
4
+
5
+ import httpx
6
+ import typer
7
+
8
+ from bt_cli.core.output import OutputFormat, print_table, print_json, print_error, print_api_error
9
+
10
+ app = typer.Typer(no_args_is_help=True)
11
+
12
+
13
+ @app.command("list")
14
+ def list_jumpoints(
15
+ output: OutputFormat = typer.Option(
16
+ OutputFormat.TABLE, "--output", "-o", help="Output format"
17
+ ),
18
+ ):
19
+ """List all Jumpoints."""
20
+ from bt_cli.pra.client import get_client
21
+
22
+ try:
23
+ client = get_client()
24
+ jumpoints = client.list_jumpoints()
25
+
26
+ if output == OutputFormat.JSON:
27
+ print_json(jumpoints)
28
+ else:
29
+ columns = [
30
+ ("ID", "id"),
31
+ ("Name", "name"),
32
+ ("Code Name", "code_name"),
33
+ ("Platform", "platform"),
34
+ ("Shell Jump", "shell_jump_enabled"),
35
+ ("Protocol Tunnel", "protocol_tunnel_enabled"),
36
+ ]
37
+ print_table(jumpoints, columns, title="Jumpoints")
38
+ except httpx.HTTPStatusError as e:
39
+ print_api_error(e, "list jumpoints")
40
+ raise typer.Exit(1)
41
+ except httpx.RequestError as e:
42
+ print_api_error(e, "list jumpoints")
43
+ raise typer.Exit(1)
44
+ except Exception as e:
45
+ print_api_error(e, "list jumpoints")
46
+ raise typer.Exit(1)
47
+
48
+
49
+ @app.command("get")
50
+ def get_jumpoint(
51
+ jumpoint_id: int = typer.Argument(..., help="Jumpoint ID"),
52
+ output: OutputFormat = typer.Option(
53
+ OutputFormat.TABLE, "--output", "-o", help="Output format"
54
+ ),
55
+ ):
56
+ """Get Jumpoint details."""
57
+ from bt_cli.pra.client import get_client
58
+ from rich.console import Console
59
+ from rich.panel import Panel
60
+
61
+ console = Console()
62
+
63
+ try:
64
+ client = get_client()
65
+ jumpoint = client.get_jumpoint(jumpoint_id)
66
+
67
+ if output == OutputFormat.JSON:
68
+ print_json(jumpoint)
69
+ else:
70
+ name = jumpoint.get("name", "")
71
+ code_name = jumpoint.get("code_name", "")
72
+ platform = jumpoint.get("platform", "")
73
+ shell_jump = "Yes" if jumpoint.get("shell_jump_enabled") else "No"
74
+ protocol_tunnel = "Yes" if jumpoint.get("protocol_tunnel_enabled") else "No"
75
+ connected = "Yes" if jumpoint.get("connected") else "No"
76
+
77
+ console.print(Panel(
78
+ f"[bold]{name}[/bold]\n\n"
79
+ f"[dim]Code Name:[/dim] {code_name}\n"
80
+ f"[dim]Platform:[/dim] {platform}\n"
81
+ f"[dim]Connected:[/dim] {connected}\n"
82
+ f"[dim]Shell Jump:[/dim] {shell_jump}\n"
83
+ f"[dim]Protocol Tunnel:[/dim] {protocol_tunnel}",
84
+ title="Jumpoint Details",
85
+ subtitle=f"ID: {jumpoint.get('id', '')}",
86
+ ))
87
+ except httpx.HTTPStatusError as e:
88
+ print_api_error(e, "get jumpoint")
89
+ raise typer.Exit(1)
90
+ except httpx.RequestError as e:
91
+ print_api_error(e, "get jumpoint")
92
+ raise typer.Exit(1)
93
+ except Exception as e:
94
+ print_api_error(e, "get jumpoint")
95
+ raise typer.Exit(1)
@@ -0,0 +1,197 @@
1
+ """Policy commands (jump, session, group)."""
2
+
3
+ import httpx
4
+ import typer
5
+
6
+ from bt_cli.core.output import OutputFormat, print_table, print_json, print_error, print_api_error
7
+
8
+ app = typer.Typer(no_args_is_help=True)
9
+
10
+ # Jump Policies
11
+ jump_app = typer.Typer(no_args_is_help=True, help="Jump Policies")
12
+ app.add_typer(jump_app, name="jump")
13
+
14
+
15
+ @jump_app.command("list")
16
+ def list_jump_policies(
17
+ output: OutputFormat = typer.Option(OutputFormat.TABLE, "--output", "-o"),
18
+ ):
19
+ """List Jump Policies."""
20
+ from bt_cli.pra.client import get_client
21
+
22
+ try:
23
+ client = get_client()
24
+ policies = client.list_jump_policies()
25
+
26
+ if output == OutputFormat.JSON:
27
+ print_json(policies)
28
+ else:
29
+ columns = [
30
+ ("ID", "id"),
31
+ ("Name", "display_name"),
32
+ ("Code Name", "code_name"),
33
+ ("Description", "description"),
34
+ ]
35
+ print_table(policies, columns, title="Jump Policies")
36
+ except httpx.HTTPStatusError as e:
37
+ print_api_error(e, "list jump policies")
38
+ raise typer.Exit(1)
39
+ except httpx.RequestError as e:
40
+ print_api_error(e, "list jump policies")
41
+ raise typer.Exit(1)
42
+ except Exception as e:
43
+ print_api_error(e, "list jump policies")
44
+ raise typer.Exit(1)
45
+
46
+
47
+ @jump_app.command("get")
48
+ def get_jump_policy(
49
+ policy_id: int = typer.Argument(..., help="Jump Policy ID"),
50
+ output: OutputFormat = typer.Option(OutputFormat.TABLE, "--output", "-o"),
51
+ ):
52
+ """Get Jump Policy details."""
53
+ from bt_cli.pra.client import get_client
54
+ from rich.console import Console
55
+ from rich.panel import Panel
56
+
57
+ console = Console()
58
+
59
+ try:
60
+ client = get_client()
61
+ policy = client.get_jump_policy(policy_id)
62
+
63
+ if output == OutputFormat.JSON:
64
+ print_json(policy)
65
+ else:
66
+ name = policy.get("display_name", policy.get("name", ""))
67
+ code_name = policy.get("code_name", "") or "-"
68
+ description = policy.get("description", "") or "-"
69
+
70
+ console.print(Panel(
71
+ f"[bold]{name}[/bold]\n\n"
72
+ f"[dim]Code Name:[/dim] {code_name}\n"
73
+ f"[dim]Description:[/dim] {description}",
74
+ title="Jump Policy Details",
75
+ subtitle=f"ID: {policy.get('id', '')}",
76
+ ))
77
+ except httpx.HTTPStatusError as e:
78
+ print_api_error(e, "get jump policy")
79
+ raise typer.Exit(1)
80
+ except httpx.RequestError as e:
81
+ print_api_error(e, "get jump policy")
82
+ raise typer.Exit(1)
83
+ except Exception as e:
84
+ print_api_error(e, "get jump policy")
85
+ raise typer.Exit(1)
86
+
87
+
88
+ # Session Policies
89
+ session_app = typer.Typer(no_args_is_help=True, help="Session Policies")
90
+ app.add_typer(session_app, name="session")
91
+
92
+
93
+ @session_app.command("list")
94
+ def list_session_policies(
95
+ output: OutputFormat = typer.Option(OutputFormat.TABLE, "--output", "-o"),
96
+ ):
97
+ """List Session Policies."""
98
+ from bt_cli.pra.client import get_client
99
+
100
+ try:
101
+ client = get_client()
102
+ policies = client.list_session_policies()
103
+
104
+ if output == OutputFormat.JSON:
105
+ print_json(policies)
106
+ else:
107
+ columns = [
108
+ ("ID", "id"),
109
+ ("Name", "display_name"),
110
+ ("Code Name", "code_name"),
111
+ ("Description", "description"),
112
+ ]
113
+ print_table(policies, columns, title="Session Policies")
114
+ except httpx.HTTPStatusError as e:
115
+ print_api_error(e, "list session policies")
116
+ raise typer.Exit(1)
117
+ except httpx.RequestError as e:
118
+ print_api_error(e, "list session policies")
119
+ raise typer.Exit(1)
120
+ except Exception as e:
121
+ print_api_error(e, "list session policies")
122
+ raise typer.Exit(1)
123
+
124
+
125
+ # Group Policies
126
+ group_app = typer.Typer(no_args_is_help=True, help="Group Policies")
127
+ app.add_typer(group_app, name="group")
128
+
129
+
130
+ @group_app.command("list")
131
+ def list_group_policies(
132
+ output: OutputFormat = typer.Option(OutputFormat.TABLE, "--output", "-o"),
133
+ ):
134
+ """List Group Policies."""
135
+ from bt_cli.pra.client import get_client
136
+
137
+ try:
138
+ client = get_client()
139
+ policies = client.list_group_policies()
140
+
141
+ if output == OutputFormat.JSON:
142
+ print_json(policies)
143
+ else:
144
+ columns = [
145
+ ("ID", "id"),
146
+ ("Name", "name"),
147
+ ("Description", "description"),
148
+ ]
149
+ print_table(policies, columns, title="Group Policies")
150
+ except httpx.HTTPStatusError as e:
151
+ print_api_error(e, "list group policies")
152
+ raise typer.Exit(1)
153
+ except httpx.RequestError as e:
154
+ print_api_error(e, "list group policies")
155
+ raise typer.Exit(1)
156
+ except Exception as e:
157
+ print_api_error(e, "list group policies")
158
+ raise typer.Exit(1)
159
+
160
+
161
+ @group_app.command("get")
162
+ def get_group_policy(
163
+ policy_id: int = typer.Argument(..., help="Group Policy ID"),
164
+ output: OutputFormat = typer.Option(OutputFormat.TABLE, "--output", "-o"),
165
+ ):
166
+ """Get Group Policy details."""
167
+ from bt_cli.pra.client import get_client
168
+ from rich.console import Console
169
+ from rich.panel import Panel
170
+
171
+ console = Console()
172
+
173
+ try:
174
+ client = get_client()
175
+ policy = client.get_group_policy(policy_id)
176
+
177
+ if output == OutputFormat.JSON:
178
+ print_json(policy)
179
+ else:
180
+ name = policy.get("name", "")
181
+ description = policy.get("description", "") or "-"
182
+
183
+ console.print(Panel(
184
+ f"[bold]{name}[/bold]\n\n"
185
+ f"[dim]Description:[/dim] {description}",
186
+ title="Group Policy Details",
187
+ subtitle=f"ID: {policy.get('id', '')}",
188
+ ))
189
+ except httpx.HTTPStatusError as e:
190
+ print_api_error(e, "get group policy")
191
+ raise typer.Exit(1)
192
+ except httpx.RequestError as e:
193
+ print_api_error(e, "get group policy")
194
+ raise typer.Exit(1)
195
+ except Exception as e:
196
+ print_api_error(e, "get group policy")
197
+ raise typer.Exit(1)