KEEPASS: mudanças entre as edições

De Wiki Clusterlab.com.br
Ir para navegação Ir para pesquisar
(Criou página com '=Preparations= <syntaxhighlight lang=bash> virtualenv -p $(which python3) kp source kp/bin/activate cd kp touch kp.py chmod +x kp.py pip install pykeepass </syntaxhighlight> =...')
 
Linha 22: Linha 22:
         username = str(entry.username).replace("\n", "")
         username = str(entry.username).replace("\n", "")
         password = str(entry.password).replace("\n", "")
         password = str(entry.password).replace("\n", "")
         print(grupo + ";" + path + ";" + title + ";" + notes + ";" + username + ";" + password)
         print("\"" + grupo + "\";\"" + path + "\";\"" + title + "\";\"" + notes + "\";\"" + username + "\";\"" + password + "\"")
</syntaxhighlight>
</syntaxhighlight>

Edição das 12h06min de 17 de outubro de 2019

Preparations

virtualenv -p $(which python3) kp
source kp/bin/activate
cd kp
touch kp.py
chmod +x kp.py
pip install pykeepass

Code

#!/usr/bin/env python

from pykeepass import PyKeePass

with PyKeePass('all-my-secrets.kdbx', password='StrongPass') as kp:
    for entry in kp.entries:
        grupo = str(entry.group).replace("\n", "")
        path = str(entry.path).replace("\n", "")
        title = str(entry.title).replace("\n", "")
        notes = str(entry.notes).replace("\n", "")
        username = str(entry.username).replace("\n", "")
        password = str(entry.password).replace("\n", "")
        print("\"" + grupo + "\";\"" + path + "\";\"" + title + "\";\"" + notes + "\";\"" + username + "\";\"" + password + "\"")