tlambertz / seedvault_backup_parser Goto Github PK
View Code? Open in Web Editor NEWDecrypt, Modify and Reencrypt Seedvault Android Backups
License: Apache License 2.0
Decrypt, Modify and Reencrypt Seedvault Android Backups
License: Apache License 2.0
I'm a CalyxOS user and found this. It seems reasonable to add it to a packaging system, but there are no releases. If the current commit is stable a 0.1 release would signal that belief and be something to package. If the recommendation is that only people trying to debug/finish the package should try to run it, that's good to know too but it looks like decrypting and kv re-encryption are known to work on at least GNU/Linux.
I followed the instructions in the section Wifi Key Import
and copied the same wifi config from the successful decryption. I used the same key to re-encrypt as I used to decrypt. Any ideas on what might be going on?
Here's the relevant logcat:
03-10 12:36:27.673 8573 8573 D AndroidRuntime: Calling main entry com.android.commands.bmgr.Bmgr
--------- beginning of system
03-10 12:36:27.675 8573 8573 V Bmgr : Running restore for user:0
03-10 12:36:27.675 1454 6073 V BackupManagerService: [UserID:0] beginRestoreSession: pkg=null transport=null
03-10 12:36:27.677 1454 6073 V BackupManagerService: [UserID:0] Acquired wakelock:*backup*-0-3379
03-10 12:36:27.681 7839 7839 D ConfigurableBackupTransportService: Service created.
03-10 12:36:27.682 7839 7839 D ConfigurableBackupTransportService: Transport bound.
03-10 12:36:27.683 1454 1454 I TransportClient: ConfigurableBackupTransportService#316: Notifying [BH/MSG_RUN_GET_RESTORE_SETS] transport = IBackupTransport
03-10 12:36:28.734 7839 7968 E JavaBinder: *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
03-10 12:36:28.734 7839 7968 E JavaBinder: java.security.InvalidKeyException: Keystore operation failed
03-10 12:36:28.734 7839 7968 E JavaBinder: at android.security.KeyStore.getInvalidKeyException(KeyStore.java:1378)
03-10 12:36:28.734 7839 7968 E JavaBinder: at android.security.KeyStore.getInvalidKeyException(KeyStore.java:1388)
03-10 12:36:28.734 7839 7968 E JavaBinder: at android.security.keystore.KeyStoreCryptoOperationUtils.getInvalidKeyExceptionForInit(KeyStoreCryptoOperationUtils.java:54)
03-10 12:36:28.734 7839 7968 E JavaBinder: at android.security.keystore.KeyStoreCryptoOperationUtils.getExceptionForCipherInit(KeyStoreCryptoOperationUtils.java:89)
03-10 12:36:28.734 7839 7968 E JavaBinder: at android.security.keystore.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized(AndroidKeyStoreCipherSpiBase.java:265)
03-10 12:36:28.734 7839 7968 E JavaBinder: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineInit(AndroidKeyStoreCipherSpiBase.java:148)
03-10 12:36:28.734 7839 7968 E JavaBinder: at javax.crypto.Cipher.tryTransformWithProvider(Cipher.java:2980)
03-10 12:36:28.734 7839 7968 E JavaBinder: at javax.crypto.Cipher.tryCombinations(Cipher.java:2891)
03-10 12:36:28.734 7839 7968 E JavaBinder: at javax.crypto.Cipher$SpiAndProviderUpdater.updateAndGetSpiAndProvider(Cipher.java:2796)
03-10 12:36:28.734 7839 7968 E JavaBinder: at javax.crypto.Cipher.chooseProvider(Cipher.java:773)
03-10 12:36:28.734 7839 7968 E JavaBinder: at javax.crypto.Cipher.init(Cipher.java:1288)
03-10 12:36:28.734 7839 7968 E JavaBinder: at javax.crypto.Cipher.init(Cipher.java:1223)
03-10 12:36:28.734 7839 7968 E JavaBinder: at com.stevesoltys.seedvault.crypto.CipherFactoryImpl.createDecryptionCipher(CipherFactory.kt:29)
03-10 12:36:28.734 7839 7968 E JavaBinder: at com.stevesoltys.seedvault.crypto.CryptoImpl.decryptSegment(Crypto.kt:210)
03-10 12:36:28.734 7839 7968 E JavaBinder: at com.stevesoltys.seedvault.crypto.CryptoImpl.decryptMultipleSegments(Crypto.kt:191)
03-10 12:36:28.734 7839 7968 E JavaBinder: at com.stevesoltys.seedvault.metadata.MetadataReaderImpl.readMetadata(MetadataReader.kt:51)
03-10 12:36:28.734 7839 7968 E JavaBinder: at com.stevesoltys.seedvault.transport.restore.RestoreCoordinator.getAvailableRestoreSets(RestoreCoordinator.kt:73)
03-10 12:36:28.734 7839 7968 E JavaBinder: at com.stevesoltys.seedvault.transport.ConfigurableBackupTransport$getAvailableRestoreSets$1.invokeSuspend(ConfigurableBackupTransport.kt:200)
03-10 12:36:28.734 7839 7968 E JavaBinder: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
03-10 12:36:28.734 7839 7968 E JavaBinder: at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
03-10 12:36:28.734 7839 7968 E JavaBinder: at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:270)
03-10 12:36:28.734 7839 7968 E JavaBinder: at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:79)
03-10 12:36:28.734 7839 7968 E JavaBinder: at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:54)
03-10 12:36:28.734 7839 7968 E JavaBinder: at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
03-10 12:36:28.734 7839 7968 E JavaBinder: at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:36)
03-10 12:36:28.734 7839 7968 E JavaBinder: at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1)
03-10 12:36:28.734 7839 7968 E JavaBinder: at com.stevesoltys.seedvault.transport.ConfigurableBackupTransport.getAvailableRestoreSets(ConfigurableBackupTransport.kt:199)
03-10 12:36:28.734 7839 7968 E JavaBinder: at android.app.backup.BackupTransport$TransportImpl.getAvailableRestoreSets(BackupTransport.java:719)
03-10 12:36:28.734 7839 7968 E JavaBinder: at com.android.internal.backup.IBackupTransport$Stub.onTransact(IBackupTransport.java:657)
03-10 12:36:28.734 7839 7968 E JavaBinder: at android.os.Binder.execTransactInternal(Binder.java:1159)
03-10 12:36:28.734 7839 7968 E JavaBinder: at android.os.Binder.execTransact(Binder.java:1123)
03-10 12:36:28.734 7839 7968 E JavaBinder: Caused by: android.security.KeyStoreException: Device locked
03-10 12:36:28.734 7839 7968 E JavaBinder: at android.security.KeyStore.getKeyStoreException(KeyStore.java:1301)
03-10 12:36:28.734 7839 7968 E JavaBinder: ... 30 more
03-10 12:36:28.739 1454 6073 D RestoreSession: endRestoreSession
03-10 12:36:28.741 8573 8573 D AndroidRuntime: Shutting down VM
03-10 12:36:28.747 7839 7839 D ConfigurableBackupTransportService: Service destroyed.
03-10 12:36:28.753 1454 3379 V BackupManagerService: [UserID:0] Released wakelock:*backup*-0-3379
03-10 12:36:28.753 1454 3379 V BackupManagerService: [UserID:0] Clearing restore session and halting timeout
Version: cda9f67
Platform: Debian buster
Changing line 10 to say Cryptodome was enough to fix AttributeError: module 'Crypto.Cipher.AES' has no attribute 'MODE_GCM'
. Please consider adding some form of check for supported modes and switching implementation depending on availability.
with the update to android 12, seedvault has also bumped the metadata version.
it would be great to be able to use this tool with newer backups.
I'm trying to decrypt a SeedVault backup on Ubuntu running in WSL. Here's my command:
laura@lauralaptop:~/android/seedvault_backup_parser$ ./parse.py decrypt /mnt/c/Users/laura/Dropbox/Backup/Fairphone/.See
dVaultAndroidBackup/1614124366878 tempdecrypted
It finds the list of APKs, then gives this error:
Decrypting Key-Value files:
for app c/Users/laura/Dropbox/Backup/Fairphone/.SeedVaultAndroidBackup/1614124366878/kv/@pm@
Traceback (most recent call last):
File "./parse.py", line 376, in <module>
main()
File "./parse.py", line 365, in main
kv_parsed = parse_backup(backupfolder, targetfolder, userkey)
File "./parse.py", line 156, in parse_backup
kv_parsed = parse_kv_backup(backupfolder, targetfolder, key)
File "./parse.py", line 64, in parse_kv_backup
assert versionheader['name'].decode() == appname
AssertionError
Any help would be appreciated!
I'm trying to decrypt a SeedVault backup on Windows 10/x64 . Here's my command:
parse.py decrypt 1615637348786 decrypted
keep getting AssertionError:
Decrypting Key-Value files:
for app kv@pm@
Traceback (most recent call last):
File "F:\Programms\python\parse.py", line 389, in
main()
File "F:\Programms\python\parse.py", line 378, in main
kv_parsed = parse_backup(backupfolder, targetfolder, userkey)
File "F:\Programms\python\parse.py", line 169, in parse_backup
kv_parsed = parse_kv_backup(backupfolder, targetfolder, key)
File "F:\Programms\python\parse.py", line 77, in parse_kv_backup
assert versionheader['name'].decode() == appname
AssertionError
i could´t resolve my issue from #7 as i don´t specified absolute paths.
What else could i do?
Hello. I tried the method for decrypting, extracting and re-encrypting the WiFi keys from a backup (since Seedvault itself does not restore them by default for some reason). I followed every step carefully, but when I ran the last adb command to restore them in the settings I got the following output:
No available restore sets; no restore performed
done
And as you can tell the keys were not imported in the settings.
Please let me know if there is something I did wrong or if this is not related to your program.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.