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.
- bt_cli/__init__.py +3 -0
- bt_cli/cli.py +830 -0
- bt_cli/commands/__init__.py +1 -0
- bt_cli/commands/configure.py +415 -0
- bt_cli/commands/learn.py +229 -0
- bt_cli/commands/quick.py +784 -0
- bt_cli/core/__init__.py +1 -0
- bt_cli/core/auth.py +213 -0
- bt_cli/core/client.py +313 -0
- bt_cli/core/config.py +393 -0
- bt_cli/core/config_file.py +420 -0
- bt_cli/core/csv_utils.py +91 -0
- bt_cli/core/errors.py +247 -0
- bt_cli/core/output.py +205 -0
- bt_cli/core/prompts.py +87 -0
- bt_cli/core/rest_debug.py +221 -0
- bt_cli/data/CLAUDE.md +94 -0
- bt_cli/data/__init__.py +0 -0
- bt_cli/data/skills/bt/SKILL.md +108 -0
- bt_cli/data/skills/entitle/SKILL.md +170 -0
- bt_cli/data/skills/epmw/SKILL.md +144 -0
- bt_cli/data/skills/pra/SKILL.md +150 -0
- bt_cli/data/skills/pws/SKILL.md +198 -0
- bt_cli/entitle/__init__.py +1 -0
- bt_cli/entitle/client/__init__.py +5 -0
- bt_cli/entitle/client/base.py +443 -0
- bt_cli/entitle/commands/__init__.py +24 -0
- bt_cli/entitle/commands/accounts.py +53 -0
- bt_cli/entitle/commands/applications.py +39 -0
- bt_cli/entitle/commands/auth.py +68 -0
- bt_cli/entitle/commands/bundles.py +218 -0
- bt_cli/entitle/commands/integrations.py +60 -0
- bt_cli/entitle/commands/permissions.py +70 -0
- bt_cli/entitle/commands/policies.py +97 -0
- bt_cli/entitle/commands/resources.py +131 -0
- bt_cli/entitle/commands/roles.py +74 -0
- bt_cli/entitle/commands/users.py +123 -0
- bt_cli/entitle/commands/workflows.py +187 -0
- bt_cli/entitle/models/__init__.py +31 -0
- bt_cli/entitle/models/bundle.py +28 -0
- bt_cli/entitle/models/common.py +37 -0
- bt_cli/entitle/models/integration.py +30 -0
- bt_cli/entitle/models/permission.py +27 -0
- bt_cli/entitle/models/policy.py +25 -0
- bt_cli/entitle/models/resource.py +29 -0
- bt_cli/entitle/models/role.py +28 -0
- bt_cli/entitle/models/user.py +24 -0
- bt_cli/entitle/models/workflow.py +55 -0
- bt_cli/epmw/__init__.py +1 -0
- bt_cli/epmw/client/__init__.py +5 -0
- bt_cli/epmw/client/base.py +848 -0
- bt_cli/epmw/commands/__init__.py +33 -0
- bt_cli/epmw/commands/audits.py +250 -0
- bt_cli/epmw/commands/auth.py +55 -0
- bt_cli/epmw/commands/computers.py +140 -0
- bt_cli/epmw/commands/events.py +233 -0
- bt_cli/epmw/commands/groups.py +215 -0
- bt_cli/epmw/commands/policies.py +673 -0
- bt_cli/epmw/commands/quick.py +348 -0
- bt_cli/epmw/commands/requests.py +224 -0
- bt_cli/epmw/commands/roles.py +78 -0
- bt_cli/epmw/commands/tasks.py +38 -0
- bt_cli/epmw/commands/users.py +219 -0
- bt_cli/epmw/models/__init__.py +1 -0
- bt_cli/pra/__init__.py +1 -0
- bt_cli/pra/client/__init__.py +5 -0
- bt_cli/pra/client/base.py +618 -0
- bt_cli/pra/commands/__init__.py +30 -0
- bt_cli/pra/commands/auth.py +55 -0
- bt_cli/pra/commands/import_export.py +442 -0
- bt_cli/pra/commands/jump_clients.py +139 -0
- bt_cli/pra/commands/jump_groups.py +146 -0
- bt_cli/pra/commands/jump_items.py +638 -0
- bt_cli/pra/commands/jumpoints.py +95 -0
- bt_cli/pra/commands/policies.py +197 -0
- bt_cli/pra/commands/quick.py +470 -0
- bt_cli/pra/commands/teams.py +81 -0
- bt_cli/pra/commands/users.py +87 -0
- bt_cli/pra/commands/vault.py +564 -0
- bt_cli/pra/models/__init__.py +27 -0
- bt_cli/pra/models/common.py +12 -0
- bt_cli/pra/models/jump_client.py +25 -0
- bt_cli/pra/models/jump_group.py +15 -0
- bt_cli/pra/models/jump_item.py +72 -0
- bt_cli/pra/models/jumpoint.py +19 -0
- bt_cli/pra/models/team.py +14 -0
- bt_cli/pra/models/user.py +17 -0
- bt_cli/pra/models/vault.py +45 -0
- bt_cli/pws/__init__.py +1 -0
- bt_cli/pws/client/__init__.py +5 -0
- bt_cli/pws/client/base.py +356 -0
- bt_cli/pws/client/beyondinsight.py +869 -0
- bt_cli/pws/client/passwordsafe.py +1786 -0
- bt_cli/pws/commands/__init__.py +33 -0
- bt_cli/pws/commands/accounts.py +372 -0
- bt_cli/pws/commands/assets.py +311 -0
- bt_cli/pws/commands/auth.py +166 -0
- bt_cli/pws/commands/clouds.py +221 -0
- bt_cli/pws/commands/config.py +344 -0
- bt_cli/pws/commands/credentials.py +347 -0
- bt_cli/pws/commands/databases.py +306 -0
- bt_cli/pws/commands/directories.py +199 -0
- bt_cli/pws/commands/functional.py +298 -0
- bt_cli/pws/commands/import_export.py +452 -0
- bt_cli/pws/commands/platforms.py +118 -0
- bt_cli/pws/commands/quick.py +1646 -0
- bt_cli/pws/commands/search.py +256 -0
- bt_cli/pws/commands/secrets.py +1343 -0
- bt_cli/pws/commands/systems.py +389 -0
- bt_cli/pws/commands/users.py +415 -0
- bt_cli/pws/commands/workgroups.py +166 -0
- bt_cli/pws/config.py +18 -0
- bt_cli/pws/models/__init__.py +19 -0
- bt_cli/pws/models/account.py +186 -0
- bt_cli/pws/models/asset.py +102 -0
- bt_cli/pws/models/common.py +132 -0
- bt_cli/pws/models/system.py +121 -0
- bt_cli-0.4.13.dist-info/METADATA +417 -0
- bt_cli-0.4.13.dist-info/RECORD +121 -0
- bt_cli-0.4.13.dist-info/WHEEL +4 -0
- bt_cli-0.4.13.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"""EPMW users commands."""
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
import typer
|
|
7
|
+
|
|
8
|
+
from bt_cli.core.output import OutputFormat, print_api_error, print_error, print_json, print_table
|
|
9
|
+
|
|
10
|
+
app = typer.Typer(no_args_is_help=True, help="EPM user accounts")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@app.command("list")
|
|
14
|
+
def list_users(
|
|
15
|
+
output: OutputFormat = typer.Option(
|
|
16
|
+
OutputFormat.TABLE, "--output", "-o", help="Output format"
|
|
17
|
+
),
|
|
18
|
+
):
|
|
19
|
+
"""List all users."""
|
|
20
|
+
from bt_cli.epmw.client import get_client
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
client = get_client()
|
|
24
|
+
users = client.list_users()
|
|
25
|
+
|
|
26
|
+
if output == OutputFormat.JSON:
|
|
27
|
+
print_json(users)
|
|
28
|
+
else:
|
|
29
|
+
columns = [
|
|
30
|
+
("ID", "id"),
|
|
31
|
+
("Account", "accountName"),
|
|
32
|
+
("Email", "emailAddress"),
|
|
33
|
+
("Type", "userType"),
|
|
34
|
+
("Disabled", "disabled"),
|
|
35
|
+
]
|
|
36
|
+
print_table(users, columns, title="Users")
|
|
37
|
+
except httpx.HTTPStatusError as e:
|
|
38
|
+
print_api_error(e, "list users")
|
|
39
|
+
raise typer.Exit(1)
|
|
40
|
+
except httpx.RequestError as e:
|
|
41
|
+
print_api_error(e, "list users")
|
|
42
|
+
raise typer.Exit(1)
|
|
43
|
+
except Exception as e:
|
|
44
|
+
print_api_error(e, "list users")
|
|
45
|
+
raise typer.Exit(1)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@app.command("get")
|
|
49
|
+
def get_user(
|
|
50
|
+
user_id: str = typer.Argument(..., help="User ID"),
|
|
51
|
+
output: OutputFormat = typer.Option(
|
|
52
|
+
OutputFormat.JSON, "--output", "-o", help="Output format"
|
|
53
|
+
),
|
|
54
|
+
):
|
|
55
|
+
"""Get user details."""
|
|
56
|
+
from bt_cli.epmw.client import get_client
|
|
57
|
+
|
|
58
|
+
try:
|
|
59
|
+
client = get_client()
|
|
60
|
+
user = client.get_user(user_id)
|
|
61
|
+
|
|
62
|
+
if output == OutputFormat.JSON:
|
|
63
|
+
print_json(user)
|
|
64
|
+
else:
|
|
65
|
+
typer.echo(f"ID: {user.get('id')}")
|
|
66
|
+
typer.echo(f"Account: {user.get('accountName')}")
|
|
67
|
+
typer.echo(f"Email: {user.get('emailAddress')}")
|
|
68
|
+
typer.echo(f"Type: {user.get('userType')}")
|
|
69
|
+
typer.echo(f"Disabled: {user.get('disabled')}")
|
|
70
|
+
typer.echo(f"Last Signed In: {user.get('lastSignedIn')}")
|
|
71
|
+
if user.get('roles'):
|
|
72
|
+
typer.echo("Roles:")
|
|
73
|
+
for role in user['roles']:
|
|
74
|
+
typer.echo(f" - {role.get('name')}")
|
|
75
|
+
except httpx.HTTPStatusError as e:
|
|
76
|
+
print_api_error(e, "get user")
|
|
77
|
+
raise typer.Exit(1)
|
|
78
|
+
except httpx.RequestError as e:
|
|
79
|
+
print_api_error(e, "get user")
|
|
80
|
+
raise typer.Exit(1)
|
|
81
|
+
except Exception as e:
|
|
82
|
+
print_api_error(e, "get user")
|
|
83
|
+
raise typer.Exit(1)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@app.command("create")
|
|
87
|
+
def create_user(
|
|
88
|
+
account_name: str = typer.Option(..., "--account", "-a", help="Account name (email)"),
|
|
89
|
+
email: Optional[str] = typer.Option(None, "--email", "-e", help="Email address (defaults to account name)"),
|
|
90
|
+
output: OutputFormat = typer.Option(
|
|
91
|
+
OutputFormat.JSON, "--output", "-o", help="Output format"
|
|
92
|
+
),
|
|
93
|
+
):
|
|
94
|
+
"""Create a new user."""
|
|
95
|
+
from bt_cli.epmw.client import get_client
|
|
96
|
+
|
|
97
|
+
try:
|
|
98
|
+
client = get_client()
|
|
99
|
+
data = {
|
|
100
|
+
"accountName": account_name,
|
|
101
|
+
"emailAddress": email or account_name,
|
|
102
|
+
}
|
|
103
|
+
user = client.create_user(data)
|
|
104
|
+
|
|
105
|
+
typer.echo(f"Created user: {user['accountName']} (ID: {user['id']})")
|
|
106
|
+
if output == OutputFormat.JSON:
|
|
107
|
+
print_json(user)
|
|
108
|
+
except httpx.HTTPStatusError as e:
|
|
109
|
+
print_api_error(e, "create user")
|
|
110
|
+
raise typer.Exit(1)
|
|
111
|
+
except httpx.RequestError as e:
|
|
112
|
+
print_api_error(e, "create user")
|
|
113
|
+
raise typer.Exit(1)
|
|
114
|
+
except Exception as e:
|
|
115
|
+
print_api_error(e, "create user")
|
|
116
|
+
raise typer.Exit(1)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
@app.command("update")
|
|
120
|
+
def update_user(
|
|
121
|
+
user_id: str = typer.Argument(..., help="User ID"),
|
|
122
|
+
email: Optional[str] = typer.Option(None, "--email", "-e", help="New email address"),
|
|
123
|
+
output: OutputFormat = typer.Option(
|
|
124
|
+
OutputFormat.JSON, "--output", "-o", help="Output format"
|
|
125
|
+
),
|
|
126
|
+
):
|
|
127
|
+
"""Update a user."""
|
|
128
|
+
from bt_cli.epmw.client import get_client
|
|
129
|
+
|
|
130
|
+
try:
|
|
131
|
+
client = get_client()
|
|
132
|
+
data = {}
|
|
133
|
+
if email:
|
|
134
|
+
data["emailAddress"] = email
|
|
135
|
+
if not data:
|
|
136
|
+
print_error("No updates specified")
|
|
137
|
+
raise typer.Exit(1)
|
|
138
|
+
|
|
139
|
+
user = client.update_user(user_id, data)
|
|
140
|
+
typer.echo(f"Updated user: {user_id}")
|
|
141
|
+
if output == OutputFormat.JSON and user:
|
|
142
|
+
print_json(user)
|
|
143
|
+
except httpx.HTTPStatusError as e:
|
|
144
|
+
print_api_error(e, "update user")
|
|
145
|
+
raise typer.Exit(1)
|
|
146
|
+
except httpx.RequestError as e:
|
|
147
|
+
print_api_error(e, "update user")
|
|
148
|
+
raise typer.Exit(1)
|
|
149
|
+
except Exception as e:
|
|
150
|
+
print_api_error(e, "update user")
|
|
151
|
+
raise typer.Exit(1)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
@app.command("enable")
|
|
155
|
+
def enable_user(
|
|
156
|
+
user_id: str = typer.Argument(..., help="User ID"),
|
|
157
|
+
):
|
|
158
|
+
"""Enable a user."""
|
|
159
|
+
from bt_cli.epmw.client import get_client
|
|
160
|
+
|
|
161
|
+
try:
|
|
162
|
+
client = get_client()
|
|
163
|
+
client.enable_user(user_id)
|
|
164
|
+
typer.echo(f"Enabled user: {user_id}")
|
|
165
|
+
except httpx.HTTPStatusError as e:
|
|
166
|
+
print_api_error(e, "enable user")
|
|
167
|
+
raise typer.Exit(1)
|
|
168
|
+
except httpx.RequestError as e:
|
|
169
|
+
print_api_error(e, "enable user")
|
|
170
|
+
raise typer.Exit(1)
|
|
171
|
+
except Exception as e:
|
|
172
|
+
print_api_error(e, "enable user")
|
|
173
|
+
raise typer.Exit(1)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
@app.command("disable")
|
|
177
|
+
def disable_user(
|
|
178
|
+
user_id: str = typer.Argument(..., help="User ID"),
|
|
179
|
+
):
|
|
180
|
+
"""Disable a user."""
|
|
181
|
+
from bt_cli.epmw.client import get_client
|
|
182
|
+
|
|
183
|
+
try:
|
|
184
|
+
client = get_client()
|
|
185
|
+
client.disable_user(user_id)
|
|
186
|
+
typer.echo(f"Disabled user: {user_id}")
|
|
187
|
+
except httpx.HTTPStatusError as e:
|
|
188
|
+
print_api_error(e, "disable user")
|
|
189
|
+
raise typer.Exit(1)
|
|
190
|
+
except httpx.RequestError as e:
|
|
191
|
+
print_api_error(e, "disable user")
|
|
192
|
+
raise typer.Exit(1)
|
|
193
|
+
except Exception as e:
|
|
194
|
+
print_api_error(e, "disable user")
|
|
195
|
+
raise typer.Exit(1)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
@app.command("assign-roles")
|
|
199
|
+
def assign_roles(
|
|
200
|
+
user_id: str = typer.Argument(..., help="User ID"),
|
|
201
|
+
role_ids: str = typer.Option(..., "--roles", "-r", help="Comma-separated role IDs"),
|
|
202
|
+
):
|
|
203
|
+
"""Assign roles to a user."""
|
|
204
|
+
from bt_cli.epmw.client import get_client
|
|
205
|
+
|
|
206
|
+
try:
|
|
207
|
+
client = get_client()
|
|
208
|
+
ids = [r.strip() for r in role_ids.split(",")]
|
|
209
|
+
client.assign_roles_to_user(user_id, ids)
|
|
210
|
+
typer.echo(f"Assigned {len(ids)} role(s) to user {user_id}")
|
|
211
|
+
except httpx.HTTPStatusError as e:
|
|
212
|
+
print_api_error(e, "assign roles")
|
|
213
|
+
raise typer.Exit(1)
|
|
214
|
+
except httpx.RequestError as e:
|
|
215
|
+
print_api_error(e, "assign roles")
|
|
216
|
+
raise typer.Exit(1)
|
|
217
|
+
except Exception as e:
|
|
218
|
+
print_api_error(e, "assign roles")
|
|
219
|
+
raise typer.Exit(1)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""EPMW models module."""
|
bt_cli/pra/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""BeyondTrust Privileged Remote Access (PRA) module."""
|