Python based command line interface for Password Manager Pro. This provides a command line interface which uses the REST API to provide a command line to:
- Read individual passwords
- Create temporary files with a set of passwords
Python and pip must be installed on the machine you wish to use.
- Create a API user in Password Manager Pro
- Set the PASSMANCLI_AUTHTOKEN enviroment variable based on the user (Alternativly set PASSMANCLI_AUTHTOKENFILE if you wish to load the key from a file)
- Set the PASSMANCLI_URL enviroment variable based on your install of password manager pro
- Install utility:
pip3 install PasswordManPro_CLI
passwordmanpro_cli get "**RESOURSE_NAME**" "**PASSWORD_NAME**"
e.g.:
resoursename.username = someuser
resoursename.password = somepassword
Only resourses with a single account are output - see [Limitations of Password manager API](### Limitations of Password manager API)
This file can be created with the following command:
passwordmanpro_cli javaprops **FILTER** > somefile.properties
You can also provide mutiple filter strings and in this case if a resourse name
JSON style output can also be generated. There are two commands for this:
- jsonsingleline
- jsonsinglelineEscapeQuote
They both operate the same except EscapeQuote outputs " rather than ". This is useful on windows machines. Both these commands support mutiple filter strings.
Example:
passwordmanpro_cli jsonsingleline **FILTER**
passwordmanpro_cli jsonsinglelineEscapeQuote **FILTER1** **FILTER2**
The previous functions were created for convience because the API uses resourse ID and password ID rather than the names. To provide further flexibility the rawget command is provided which allows users to call apis. (The auth token is added invisibly based on enviroment paramaters)
passwordmanpro_cli rawget **URL**
Exmaple:
passwordmanpro_cli rawget /restapi/json/v1/resources
In password manager a resourse can have mutiple accounts. Each account has a username and a password, unfortunatly accounts do not have another name associated with them. This makes it impossible to refer to which account will be needed.
- I have experimented with using the notes field but this is not returned in API calls
- I have experimented with using custom fields but these also were not returned in API calls As a workaround only resourses with a single acocunt are output in the generated file and the resourse name is used as an identifier.
This means to use this files you must create your resourses so that each only has one account.
On windows it is possible to set the output to an enviroment varaible.
- you must > nul otherwise passwords will appear in Jenkins logs
This means the UiLauncher can recieve passwords as JSON arguments:
@FOR /F "tokens=*" %g IN ('passwordmanpro_cli jsonsingleline BANNER') do (@SET PASSVAR=%g) > nul
UiLauncher.exe /file:"workflow.xaml" /input:"%PASSVAR%"
Not recommended for normal use but helpful for testing. Add a parameter NOSSLCHECKS at any point in the parameter string. SSL checks will be skipped and the command run as if the parameter was not there.
Sample code:
import passwordmanpro_cli
print("Start")
resourseName = "OpenWeatherMap_DEV_APIKEY"
acocuntName = "API_KEY"
print("Retrieving ", resourseName, " ", acocuntName)
passwordRetrieved = passwordmanpro_cli.getSinglePassword(
resourseName=resourseName,
accountName=accountName,
skipSSLChecks=False
)
print(passwordRetrieved)
print("End")