summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/importers/revelation2pass.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/contrib/importers/revelation2pass.py b/contrib/importers/revelation2pass.py
index f04c1a8..cc2d01c 100755
--- a/contrib/importers/revelation2pass.py
+++ b/contrib/importers/revelation2pass.py
@@ -122,25 +122,29 @@ def decrypt_gz(key, cipher_text):
ct = c.decrypt(cipher_text[28:], iv=iv)
return ct
-def main(datafile, verbose=False):
+def main(datafile, verbose=False, xml=False):
f = None
with open(datafile, "rb") as f:
# Encrypted data
data = f.read()
- password = getpass.getpass()
- # Pad password
- password += (chr(0) * (32 - len(password)))
- # Decrypt. Decrypted data is compressed
- cleardata_gz = decrypt_gz(password, data)
- # Length of data padding
- padlen = ord(cleardata_gz[-1])
- # Decompress actual data (15 is wbits [ref3] DON'T CHANGE, 2**15 is the (initial) buf size)
- xmldata = zlib.decompress(cleardata_gz[:-padlen], 15, 2**15)
+ if xml:
+ xmldata = data
+ else:
+ password = getpass.getpass()
+ # Pad password
+ password += (chr(0) * (32 - len(password)))
+ # Decrypt. Decrypted data is compressed
+ cleardata_gz = decrypt_gz(password, data)
+ # Length of data padding
+ padlen = ord(cleardata_gz[-1])
+ # Decompress actual data (15 is wbits [ref3] DON'T CHANGE, 2**15 is the (initial) buf size)
+ xmldata = zlib.decompress(cleardata_gz[:-padlen], 15, 2**15)
root = etree.fromstring(xmldata)
import_subentries(root, verbose=verbose)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
+ parser.add_argument('-x', '--xml', help='read plain XML file', action='store_true')
parser.add_argument('--verbose', '-v', action='count')
parser.add_argument('FILE', help="the file storing the Revelation passwords")
args = parser.parse_args()
@@ -149,7 +153,7 @@ if __name__ == '__main__':
sys.stderr.write(s+'\n')
try:
- main(args.FILE, verbose=args.verbose)
+ main(args.FILE, verbose=args.verbose, xml=args.xml)
except KeyboardInterrupt:
if args.verbose:
traceback.print_exc()
846f70c8eac84a5f0ff95b8482a169667160&follow=1'>Bump github.com/antonmedv/expr from 1.12.6 to 1.14.0dependabot[bot]2-3/+3 2023-07-15Upgrade depsRené 'Necoro' Neumann2-15/+12 2023-06-13Version Changelog entryv1.7.0René 'Necoro' Neumann1-1/+4 2023-06-13Prepare v1.7.0René 'Necoro' Neumann2-2/+2 2023-06-05Improve changelogRené 'Necoro' Neumann1-2/+4 2023-06-05IMAP client does not need to know about max number of connectionsRené 'Necoro' Neumann2-19/+12 2023-06-04ChangelogRené 'Necoro' Neumann1-0/+4 2023-06-04Add new config option to set max number of IMAP connections.René 'Necoro' Neumann5-20/+26 2023-06-04Improve locking around IMAP connect/disconnect.René 'Necoro' Neumann1-10/+26 2023-05-20Bump golang.org/x/net from 0.9.0 to 0.10.0dependabot[bot]2-2/+3 2023-05-12Amend changelogRené 'Necoro' Neumann1-0/+1 2023-05-12Issue #95 Add warning when config can be read globally.René 'Necoro' Neumann1-0/+11 2023-05-11Issue #95: Change cache ownership.René 'Necoro' Neumann1-0/+4 2023-05-11Issue #95: Add hint about sensible access rights.René 'Necoro' Neumann1-0/+1 2023-04-23[workflow] Port changes also to releaseRené 'Necoro' Neumann1-6/+5 2023-04-23[workflow] Checkout before go setupRené 'Necoro' Neumann1-3/+3 2023-04-23[workflow] determine go version from go.modRené 'Necoro' Neumann1-3/+2 2023-04-23Improve test to also validate error messageRené 'Necoro' Neumann1-42/+39 2023-04-22Fix/improve testsRené 'Necoro' Neumann1-59/+104 2023-04-22Improve error handlingRené 'Necoro' Neumann1-1/+11 2023-04-21Fix workflow: '1.20' needs to be quotedRené 'Necoro' Neumann2-2/+2