Python class of common needed methods of CyberArk APIs (v2)
Compatible with: Python3.6 & above
below are common use cases
# First, Instantiate an object from the class
cyberark = Cyberark()
- Search for an account
cyberark.search_accounts(search='test-23', safe='test_safe')
# Returns a list of dictionaries
- Get the password of an account
# Fist, we need to get the ID of the account
# > Make sure when you search for the account you get a single item
test_23_id = cyberark.search_accounts(search='test-23', safe='test_safe')[0].get('id')
# Print the password
print(cyberark.get_account_password(test_23_id))
- Update account password
print(cyberark.update_account_password('30_3619', 'POqwer#123m'))
- Delete an account
print(cyberark.delete_account(test_23_id))
- Get all the safes
print(cyberark.get_all_safes())
- Create a new account
print(cyberark.add_account(name='test-23',
address='192.168.11.11',
userName='test-23',
safeName='test-safe',
secretType='password',
secret='ILoveYouBaby',
platformId='pick-one'))