python4cpm 1.0.15__tar.gz → 1.0.17__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.
- {python4cpm-1.0.15/src/python4cpm.egg-info → python4cpm-1.0.17}/PKG-INFO +11 -11
- {python4cpm-1.0.15 → python4cpm-1.0.17}/README.md +10 -10
- {python4cpm-1.0.15 → python4cpm-1.0.17}/pyproject.toml +1 -1
- {python4cpm-1.0.15 → python4cpm-1.0.17}/src/python4cpm/__init__.py +2 -2
- {python4cpm-1.0.15 → python4cpm-1.0.17}/src/python4cpm/crypto.py +2 -2
- {python4cpm-1.0.15 → python4cpm-1.0.17}/src/python4cpm/secrets.py +6 -11
- {python4cpm-1.0.15 → python4cpm-1.0.17/src/python4cpm.egg-info}/PKG-INFO +11 -11
- {python4cpm-1.0.15 → python4cpm-1.0.17}/LICENSE +0 -0
- {python4cpm-1.0.15 → python4cpm-1.0.17}/setup.cfg +0 -0
- {python4cpm-1.0.15 → python4cpm-1.0.17}/src/python4cpm/args.py +0 -0
- {python4cpm-1.0.15 → python4cpm-1.0.17}/src/python4cpm/logger.py +0 -0
- {python4cpm-1.0.15 → python4cpm-1.0.17}/src/python4cpm/nethelper.py +0 -0
- {python4cpm-1.0.15 → python4cpm-1.0.17}/src/python4cpm/python4cpm.py +0 -0
- {python4cpm-1.0.15 → python4cpm-1.0.17}/src/python4cpm.egg-info/SOURCES.txt +0 -0
- {python4cpm-1.0.15 → python4cpm-1.0.17}/src/python4cpm.egg-info/dependency_links.txt +0 -0
- {python4cpm-1.0.15 → python4cpm-1.0.17}/src/python4cpm.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python4cpm
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.17
|
|
4
4
|
Summary: Python for CPM
|
|
5
5
|
Author-email: Gonzalo Atienza Rela <gonatienza@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -45,7 +45,7 @@ This platform allows you to duplicate it multiple times, simply changing its set
|
|
|
45
45
|
3. Install `python4cpm` in your venv:
|
|
46
46
|
- If your CPM can connect to the internet, install with `c:\venv\Scripts\pip install python4cpm`.
|
|
47
47
|
- If your CPM cannot connect to the internet:
|
|
48
|
-
- Download the
|
|
48
|
+
- Download the `python4cpm-wheel.zip` asset from the latest [release](https://github.com/gonatienza/python4cpm/releases).
|
|
49
49
|
- Copy the file to CPM and extract to a temporary location.
|
|
50
50
|
- From the temporary location run `c:\venv\Scripts\pip install --no-index --find-links=.\python4cpm-wheel python4cpm`.
|
|
51
51
|
|
|
@@ -53,7 +53,7 @@ This platform allows you to duplicate it multiple times, simply changing its set
|
|
|
53
53
|
### Importing the platform
|
|
54
54
|
|
|
55
55
|
1. Download the latest [Credential Management .NET SDK](https://community.cyberark.com/marketplace/s/#a3550000000EkA0AAK-a3950000000jjoOAAQ) and place its content in the bin folder of CPM (`C:\Program Files (x86)\CyberArk\Password Manager\bin`).
|
|
56
|
-
2. Download the
|
|
56
|
+
2. Download the `python4cpm-platform.zip` asset from the [release](https://github.com/gonatienza/python4cpm/releases).
|
|
57
57
|
3. Import the platform zip file into Privilege Cloud/PVWA `(Administration -> Platform Management -> Import platform)`.
|
|
58
58
|
4. Craft your python script and place it within the bin folder of CPM (`C:\Program Files (x86)\CyberArk\Password Manager\bin`).
|
|
59
59
|
5. Duplicate the imported platform in Privilege Cloud/PVWA `(Administration -> Platform Management -> Application -> Python for CPM)` and name it after your application (e.g., My App).
|
|
@@ -72,7 +72,7 @@ This platform allows you to duplicate it multiple times, simply changing its set
|
|
|
72
72
|
from python4cpm import Python4CPM
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
p4cpm = Python4CPM("MyApp") # this instantiates the object and grabs all arguments and secrets shared by
|
|
75
|
+
p4cpm = Python4CPM("MyApp") # this instantiates the object and grabs all arguments and secrets shared by the .NET SDK
|
|
76
76
|
|
|
77
77
|
# These are the usable properties and related methods from the object:
|
|
78
78
|
p4cpm.args.action # action requested from CPM
|
|
@@ -197,12 +197,12 @@ Install this module (in a dev workstation) with:
|
|
|
197
197
|
pip install python4cpm
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
**Note**: As CPM runs in Windows, the plugin was built to pass secrets securely to the `Python4CPM.crypto` module using the Data Protection API (DPAPI). For dev purposes in Linux/Mac dev workstations, those secrets will appear as plaintext in the process
|
|
200
|
+
**Note**: As CPM runs in Windows, the plugin was built to pass secrets securely to the `Python4CPM.crypto` module using the Data Protection API (DPAPI). For dev purposes in Linux/Mac dev workstations, those secrets will appear as plaintext in the environment of the process. This is informational only, the module will use its encryption/decryption capabilities automatically in Windows and you do not have to do anything specific to enable it.
|
|
201
201
|
|
|
202
202
|
### Example:
|
|
203
203
|
|
|
204
204
|
```python
|
|
205
|
-
from python4cpm import
|
|
205
|
+
from python4cpm import NETHelper, Python4CPM
|
|
206
206
|
from getpass import getpass
|
|
207
207
|
|
|
208
208
|
# Get secrets for your password, logon account password, reconcile account password and new password
|
|
@@ -212,7 +212,7 @@ logon_password = getpass("logon_password: ") # password from linked logon accoun
|
|
|
212
212
|
reconcile_password = getpass("reconcile_password: ") # password from linked reconcile account
|
|
213
213
|
new_password = getpass("new_password: ") # new password for the rotation
|
|
214
214
|
|
|
215
|
-
p4cpm =
|
|
215
|
+
p4cpm = NETHelper.run(
|
|
216
216
|
action=Python4CPM.ACTION_LOGON, # use actions from Python4CPM.ACTION_*
|
|
217
217
|
address="myapp.corp.local", # populate with the address from your account properties
|
|
218
218
|
username="jdoe", # populate with the username from your account properties
|
|
@@ -232,12 +232,12 @@ p4cpm.log_info("success!")
|
|
|
232
232
|
p4cpm.close_success()
|
|
233
233
|
|
|
234
234
|
# Remember for your final script:
|
|
235
|
-
## changing the definition of p4cpm from
|
|
235
|
+
## changing the definition of p4cpm from NETHelper.run() to Python4CPM("MyApp")
|
|
236
236
|
## remove any secrets prompting
|
|
237
|
-
## remove the
|
|
237
|
+
## remove the NETHelper import
|
|
238
238
|
```
|
|
239
239
|
|
|
240
240
|
Remember for your final script:
|
|
241
|
-
- Change the definition of `p4cpm` from `p4cpm =
|
|
241
|
+
- Change the definition of `p4cpm` from `p4cpm = NETHelper.run(**kwargs)` to `p4cpm = Python4CPM("MyApp")`.
|
|
242
242
|
- Remove any secrets prompting or interactive interruptions.
|
|
243
|
-
- Remove the import of `
|
|
243
|
+
- Remove the import of `NETHelper`.
|
|
@@ -13,7 +13,7 @@ This platform allows you to duplicate it multiple times, simply changing its set
|
|
|
13
13
|
3. Install `python4cpm` in your venv:
|
|
14
14
|
- If your CPM can connect to the internet, install with `c:\venv\Scripts\pip install python4cpm`.
|
|
15
15
|
- If your CPM cannot connect to the internet:
|
|
16
|
-
- Download the
|
|
16
|
+
- Download the `python4cpm-wheel.zip` asset from the latest [release](https://github.com/gonatienza/python4cpm/releases).
|
|
17
17
|
- Copy the file to CPM and extract to a temporary location.
|
|
18
18
|
- From the temporary location run `c:\venv\Scripts\pip install --no-index --find-links=.\python4cpm-wheel python4cpm`.
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ This platform allows you to duplicate it multiple times, simply changing its set
|
|
|
21
21
|
### Importing the platform
|
|
22
22
|
|
|
23
23
|
1. Download the latest [Credential Management .NET SDK](https://community.cyberark.com/marketplace/s/#a3550000000EkA0AAK-a3950000000jjoOAAQ) and place its content in the bin folder of CPM (`C:\Program Files (x86)\CyberArk\Password Manager\bin`).
|
|
24
|
-
2. Download the
|
|
24
|
+
2. Download the `python4cpm-platform.zip` asset from the [release](https://github.com/gonatienza/python4cpm/releases).
|
|
25
25
|
3. Import the platform zip file into Privilege Cloud/PVWA `(Administration -> Platform Management -> Import platform)`.
|
|
26
26
|
4. Craft your python script and place it within the bin folder of CPM (`C:\Program Files (x86)\CyberArk\Password Manager\bin`).
|
|
27
27
|
5. Duplicate the imported platform in Privilege Cloud/PVWA `(Administration -> Platform Management -> Application -> Python for CPM)` and name it after your application (e.g., My App).
|
|
@@ -40,7 +40,7 @@ This platform allows you to duplicate it multiple times, simply changing its set
|
|
|
40
40
|
from python4cpm import Python4CPM
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
p4cpm = Python4CPM("MyApp") # this instantiates the object and grabs all arguments and secrets shared by
|
|
43
|
+
p4cpm = Python4CPM("MyApp") # this instantiates the object and grabs all arguments and secrets shared by the .NET SDK
|
|
44
44
|
|
|
45
45
|
# These are the usable properties and related methods from the object:
|
|
46
46
|
p4cpm.args.action # action requested from CPM
|
|
@@ -165,12 +165,12 @@ Install this module (in a dev workstation) with:
|
|
|
165
165
|
pip install python4cpm
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
**Note**: As CPM runs in Windows, the plugin was built to pass secrets securely to the `Python4CPM.crypto` module using the Data Protection API (DPAPI). For dev purposes in Linux/Mac dev workstations, those secrets will appear as plaintext in the process
|
|
168
|
+
**Note**: As CPM runs in Windows, the plugin was built to pass secrets securely to the `Python4CPM.crypto` module using the Data Protection API (DPAPI). For dev purposes in Linux/Mac dev workstations, those secrets will appear as plaintext in the environment of the process. This is informational only, the module will use its encryption/decryption capabilities automatically in Windows and you do not have to do anything specific to enable it.
|
|
169
169
|
|
|
170
170
|
### Example:
|
|
171
171
|
|
|
172
172
|
```python
|
|
173
|
-
from python4cpm import
|
|
173
|
+
from python4cpm import NETHelper, Python4CPM
|
|
174
174
|
from getpass import getpass
|
|
175
175
|
|
|
176
176
|
# Get secrets for your password, logon account password, reconcile account password and new password
|
|
@@ -180,7 +180,7 @@ logon_password = getpass("logon_password: ") # password from linked logon accoun
|
|
|
180
180
|
reconcile_password = getpass("reconcile_password: ") # password from linked reconcile account
|
|
181
181
|
new_password = getpass("new_password: ") # new password for the rotation
|
|
182
182
|
|
|
183
|
-
p4cpm =
|
|
183
|
+
p4cpm = NETHelper.run(
|
|
184
184
|
action=Python4CPM.ACTION_LOGON, # use actions from Python4CPM.ACTION_*
|
|
185
185
|
address="myapp.corp.local", # populate with the address from your account properties
|
|
186
186
|
username="jdoe", # populate with the username from your account properties
|
|
@@ -200,12 +200,12 @@ p4cpm.log_info("success!")
|
|
|
200
200
|
p4cpm.close_success()
|
|
201
201
|
|
|
202
202
|
# Remember for your final script:
|
|
203
|
-
## changing the definition of p4cpm from
|
|
203
|
+
## changing the definition of p4cpm from NETHelper.run() to Python4CPM("MyApp")
|
|
204
204
|
## remove any secrets prompting
|
|
205
|
-
## remove the
|
|
205
|
+
## remove the NETHelper import
|
|
206
206
|
```
|
|
207
207
|
|
|
208
208
|
Remember for your final script:
|
|
209
|
-
- Change the definition of `p4cpm` from `p4cpm =
|
|
209
|
+
- Change the definition of `p4cpm` from `p4cpm = NETHelper.run(**kwargs)` to `p4cpm = Python4CPM("MyApp")`.
|
|
210
210
|
- Remove any secrets prompting or interactive interruptions.
|
|
211
|
-
- Remove the import of `
|
|
211
|
+
- Remove the import of `NETHelper`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from python4cpm.python4cpm import Python4CPM
|
|
2
2
|
from python4cpm.args import Args
|
|
3
|
-
from python4cpm.secrets import
|
|
3
|
+
from python4cpm.secrets import Secret, Secrets
|
|
4
4
|
from python4cpm.crypto import Crypto
|
|
5
5
|
from python4cpm.nethelper import NETHelper
|
|
6
6
|
from importlib.metadata import version as __version
|
|
@@ -9,7 +9,7 @@ __version__ = __version(__name__)
|
|
|
9
9
|
|
|
10
10
|
__all__ = [
|
|
11
11
|
Args,
|
|
12
|
-
|
|
12
|
+
Secret,
|
|
13
13
|
Secrets,
|
|
14
14
|
Python4CPM,
|
|
15
15
|
Crypto,
|
|
@@ -43,14 +43,14 @@ class Crypto:
|
|
|
43
43
|
if crypt_res:
|
|
44
44
|
plaintext = ctypes.string_at(output_blob.pbData, output_blob.cbData)
|
|
45
45
|
ctypes.windll.kernel32.LocalFree(output_blob.pbData)
|
|
46
|
-
return plaintext.decode()
|
|
46
|
+
return plaintext.decode("utf-16-le")
|
|
47
47
|
else:
|
|
48
48
|
raise ctypes.WinError()
|
|
49
49
|
|
|
50
50
|
@classmethod
|
|
51
51
|
def encrypt(cls, plaintext: str) -> str:
|
|
52
52
|
cls._verify_enabled()
|
|
53
|
-
plain_bytes = plaintext.encode()
|
|
53
|
+
plain_bytes = plaintext.encode("utf-16-le")
|
|
54
54
|
buffer = ctypes.create_string_buffer(plain_bytes)
|
|
55
55
|
input_blob = cls.DataBlob(
|
|
56
56
|
len(plain_bytes),
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
from python4cpm.crypto import Crypto
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
class
|
|
4
|
+
class Secret:
|
|
5
5
|
def __init__(self, secret: str) -> None:
|
|
6
6
|
self._secret = secret
|
|
7
|
-
self._is_encrypted = Crypto.ENABLED
|
|
8
|
-
|
|
9
|
-
@property
|
|
10
|
-
def is_encrypted(self):
|
|
11
|
-
return self._is_encrypted
|
|
12
7
|
|
|
13
8
|
def get(self) -> str:
|
|
14
|
-
if
|
|
9
|
+
if Crypto.ENABLED and self._secret:
|
|
15
10
|
return Crypto.decrypt(self._secret)
|
|
16
11
|
else:
|
|
17
12
|
return self._secret
|
|
@@ -32,10 +27,10 @@ class Secrets:
|
|
|
32
27
|
reconcile_password: str,
|
|
33
28
|
new_password: str
|
|
34
29
|
) -> None:
|
|
35
|
-
self._password =
|
|
36
|
-
self._logon_password =
|
|
37
|
-
self._reconcile_password =
|
|
38
|
-
self._new_password =
|
|
30
|
+
self._password = Secret(password)
|
|
31
|
+
self._logon_password = Secret(logon_password)
|
|
32
|
+
self._reconcile_password = Secret(reconcile_password)
|
|
33
|
+
self._new_password = Secret(new_password)
|
|
39
34
|
|
|
40
35
|
@property
|
|
41
36
|
def password(self) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python4cpm
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.17
|
|
4
4
|
Summary: Python for CPM
|
|
5
5
|
Author-email: Gonzalo Atienza Rela <gonatienza@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -45,7 +45,7 @@ This platform allows you to duplicate it multiple times, simply changing its set
|
|
|
45
45
|
3. Install `python4cpm` in your venv:
|
|
46
46
|
- If your CPM can connect to the internet, install with `c:\venv\Scripts\pip install python4cpm`.
|
|
47
47
|
- If your CPM cannot connect to the internet:
|
|
48
|
-
- Download the
|
|
48
|
+
- Download the `python4cpm-wheel.zip` asset from the latest [release](https://github.com/gonatienza/python4cpm/releases).
|
|
49
49
|
- Copy the file to CPM and extract to a temporary location.
|
|
50
50
|
- From the temporary location run `c:\venv\Scripts\pip install --no-index --find-links=.\python4cpm-wheel python4cpm`.
|
|
51
51
|
|
|
@@ -53,7 +53,7 @@ This platform allows you to duplicate it multiple times, simply changing its set
|
|
|
53
53
|
### Importing the platform
|
|
54
54
|
|
|
55
55
|
1. Download the latest [Credential Management .NET SDK](https://community.cyberark.com/marketplace/s/#a3550000000EkA0AAK-a3950000000jjoOAAQ) and place its content in the bin folder of CPM (`C:\Program Files (x86)\CyberArk\Password Manager\bin`).
|
|
56
|
-
2. Download the
|
|
56
|
+
2. Download the `python4cpm-platform.zip` asset from the [release](https://github.com/gonatienza/python4cpm/releases).
|
|
57
57
|
3. Import the platform zip file into Privilege Cloud/PVWA `(Administration -> Platform Management -> Import platform)`.
|
|
58
58
|
4. Craft your python script and place it within the bin folder of CPM (`C:\Program Files (x86)\CyberArk\Password Manager\bin`).
|
|
59
59
|
5. Duplicate the imported platform in Privilege Cloud/PVWA `(Administration -> Platform Management -> Application -> Python for CPM)` and name it after your application (e.g., My App).
|
|
@@ -72,7 +72,7 @@ This platform allows you to duplicate it multiple times, simply changing its set
|
|
|
72
72
|
from python4cpm import Python4CPM
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
p4cpm = Python4CPM("MyApp") # this instantiates the object and grabs all arguments and secrets shared by
|
|
75
|
+
p4cpm = Python4CPM("MyApp") # this instantiates the object and grabs all arguments and secrets shared by the .NET SDK
|
|
76
76
|
|
|
77
77
|
# These are the usable properties and related methods from the object:
|
|
78
78
|
p4cpm.args.action # action requested from CPM
|
|
@@ -197,12 +197,12 @@ Install this module (in a dev workstation) with:
|
|
|
197
197
|
pip install python4cpm
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
**Note**: As CPM runs in Windows, the plugin was built to pass secrets securely to the `Python4CPM.crypto` module using the Data Protection API (DPAPI). For dev purposes in Linux/Mac dev workstations, those secrets will appear as plaintext in the process
|
|
200
|
+
**Note**: As CPM runs in Windows, the plugin was built to pass secrets securely to the `Python4CPM.crypto` module using the Data Protection API (DPAPI). For dev purposes in Linux/Mac dev workstations, those secrets will appear as plaintext in the environment of the process. This is informational only, the module will use its encryption/decryption capabilities automatically in Windows and you do not have to do anything specific to enable it.
|
|
201
201
|
|
|
202
202
|
### Example:
|
|
203
203
|
|
|
204
204
|
```python
|
|
205
|
-
from python4cpm import
|
|
205
|
+
from python4cpm import NETHelper, Python4CPM
|
|
206
206
|
from getpass import getpass
|
|
207
207
|
|
|
208
208
|
# Get secrets for your password, logon account password, reconcile account password and new password
|
|
@@ -212,7 +212,7 @@ logon_password = getpass("logon_password: ") # password from linked logon accoun
|
|
|
212
212
|
reconcile_password = getpass("reconcile_password: ") # password from linked reconcile account
|
|
213
213
|
new_password = getpass("new_password: ") # new password for the rotation
|
|
214
214
|
|
|
215
|
-
p4cpm =
|
|
215
|
+
p4cpm = NETHelper.run(
|
|
216
216
|
action=Python4CPM.ACTION_LOGON, # use actions from Python4CPM.ACTION_*
|
|
217
217
|
address="myapp.corp.local", # populate with the address from your account properties
|
|
218
218
|
username="jdoe", # populate with the username from your account properties
|
|
@@ -232,12 +232,12 @@ p4cpm.log_info("success!")
|
|
|
232
232
|
p4cpm.close_success()
|
|
233
233
|
|
|
234
234
|
# Remember for your final script:
|
|
235
|
-
## changing the definition of p4cpm from
|
|
235
|
+
## changing the definition of p4cpm from NETHelper.run() to Python4CPM("MyApp")
|
|
236
236
|
## remove any secrets prompting
|
|
237
|
-
## remove the
|
|
237
|
+
## remove the NETHelper import
|
|
238
238
|
```
|
|
239
239
|
|
|
240
240
|
Remember for your final script:
|
|
241
|
-
- Change the definition of `p4cpm` from `p4cpm =
|
|
241
|
+
- Change the definition of `p4cpm` from `p4cpm = NETHelper.run(**kwargs)` to `p4cpm = Python4CPM("MyApp")`.
|
|
242
242
|
- Remove any secrets prompting or interactive interruptions.
|
|
243
|
-
- Remove the import of `
|
|
243
|
+
- Remove the import of `NETHelper`.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|