Created
November 6, 2017 00:22
-
-
Save yuwash/d83bccd054067437bc2e433ecea366a3 to your computer and use it in GitHub Desktop.
pasaffe_lib usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import getpass | |
from pasaffe_lib.readdb import PassSafeFile # should come with apt-get install pasaffe | |
pspass = getpass.getpass('pspass: ') | |
pf = PassSafeFile('/path/to/file.psafe3', pspass) | |
pf.get_all_folders() | |
# [['Folder 1'], ['Folder 2'], …] | |
someuuid = next(iter(pf.records.keys())) | |
# '12f3e…' | |
pf.records[someuuid] | |
# {1: b'\x10x22…', 2: 'folder (group)', 3: 'name', 4: 'username', 5: 'comments', 6: 'password', 7: b'\x11\x3f…', 8: b'\x12…', 12: b'\x1a…', 13: 'website', 20: 'email'} | |
# someuuid == '{:x}'.format(int.from_bytes(pf.records[someuuid][1], byte_order='big')) | |
import datetime | |
stamp = int.from_bytes(pf.records[someuuid][7], byteorder='little') # 7: created, 8: password last changed, 12: modified entry | |
datetime.datetime.from_timestamp(stamp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment