In my Python web app, I would need to decrypt a file that was encrypted using VIM. Assuming the web app knows the password used to encrypt the file in VIM, how do I write code to decrypt ?
Turns out that vim uses the same encryption as PKZIP:
from zipfile import _ZipDecrypter
fp = open(somefile, 'rb')
zd = _ZipDecrypter(somekey)
fp.read(12)
print ''.join(zd(c) for c in fp.read())
fp.close()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With