fast workaround for new style of backup

This commit is contained in:
realSnoopy 2020-05-28 15:45:53 +02:00
parent 1030d7d24c
commit 6dd191e504
2 changed files with 35 additions and 12 deletions

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
#ignore all
*
#track dirs
!*/
#track #-DLH-# dir
!/#-DLH-#/
#track python files
!*.py
#track readme
!readme.md
#track .gitignore
!.gitignore

View File

@ -266,21 +266,32 @@ class Decryptor:
logging.debug('SHA256(BKEY)[%s] = %s', len(self._bkey_sha256),
binascii.hexlify(self._bkey_sha256))
salt = self._checkMsg[32:]
logging.debug('SALT[%s] = %s', len(salt), binascii.hexlify(salt))
try:
salt = self._checkMsg[32:]
logging.debug('SALT[%s] = %s', len(salt), binascii.hexlify(salt))
res = PBKDF2(self._bkey, salt, Decryptor.dklen, Decryptor.count,
Decryptor.prf, hmac_hash_module=None)
logging.debug('KEY check expected = %s',
binascii.hexlify(self._checkMsg[:32]))
logging.debug('RESULT = %s', binascii.hexlify(res))
res = PBKDF2(self._bkey, salt, Decryptor.dklen, Decryptor.count,
Decryptor.prf, hmac_hash_module=None)
logging.debug('KEY check expected = %s',
binascii.hexlify(self._checkMsg[:32]))
logging.debug('RESULT = %s', binascii.hexlify(res))
if res == self._checkMsg[:32]:
logging.info('OK, backup key is correct!')
if res == self._checkMsg[:32]:
logging.info('OK, backup key is correct!')
self._good = True
else:
logging.error('KO, backup key is wrong!')
self._good = False
except:
print()
logging.error('NEW TYPE of backup found!')
logging.error('no check for correct key! will try to decrypt anyway...')
logging.error('be SURE that pass is correct!')
print()
input('press ENTER to continue...or cancel script with CTRL + C')
self._good = True
else:
logging.error('KO, backup key is wrong!')
self._good = False
pass
def decrypt_package(self, dec_material, data):
if not self._good: