avibrazil / iosbackup Goto Github PK
View Code? Open in Web Editor NEWA Python 3 class that reads and extracts files from a password-encrypted iOS backup created by iTunes on Mac and Windows. Compatible with iOS 14. Class works on Linux too.
A Python 3 class that reads and extracts files from a password-encrypted iOS backup created by iTunes on Mac and Windows. Compatible with iOS 14. Class works on Linux too.
Seems it works only on win32. An issue with os.walk observed. As the result root and backuproot=None.
Platform: Windows 10 Pro 64-bit
Python: 3.10.4 (32bit)
iOS version of device backups: iOS 15
I found the album uuid in Photos.sqlite, but cannot continue with my search - I am in desperate need of help to find a certain image from a certain album in my backup.
Thanks in advance.
Whenever I run iOSbackup.getDeviceList()
I get this error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\...\AppData\Roaming\Python\Python39\site-packages\iOSbackup\__init__.py", line 374, in getDeviceList
(_, dirnames, _)=next(os.walk(root))
StopIteration
I really have no idea what this error is, and what I can do to fix it. Can someone please tell me what this error means, and how to fix it?
I am getting:
sqlite3.DatabaseError: database disk image is malformed
after trying to use the db extracted with:
filesms=b.getFileDecryptedCopy(relativePath="Library/SMS/sms.db")
Any idea what's wrong?
I've freshly installed Python 3.9.0 on my Windows 8.1 machine. There were no issues installing the two dependencies through pip and the library itself, but I have no idea how the library is to be used, because everything I do leads to an error.
I have a non-standard backup location.
>>> from iOSbackup import iOSbackup
>>> iOSbackup.getDeviceList()
Exception ignored in: <function iOSbackup.__del__ at 0x035C8148>
Traceback (most recent call last):
File "C:\Python39-32\lib\site-packages\iOSbackup\__init__.py", line 120, in __del__
os.remove(self.manifestDB)
TypeError: remove: path should be string, bytes or os.PathLike, not NoneType
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python39-32\lib\site-packages\iOSbackup\__init__.py", line 328, in getDeviceList
(_, dirnames, _)=next(os.walk(root))
StopIteration
No idea what the issue is. Ok, maybe I need to set the root correctly and luckily there is a method for that.
>>> iOSbackup.setBackupRoot('C:\\my\\path\\to\\backup')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python39-32\lib\site-packages\iOSbackup\__init__.py", line 240, in setBackupRoot
self.backupRoot=iOSbackup.getHintedBackupRoot()
AttributeError: 'str' object has no attribute 'backupRoot'
It seems that iOSbackup
was not initialized, because self
is the path that was passed in.
>>> ib = iOSbackup('myudid', backuproot='C:\\my\\path\\to\\backup')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python39-32\lib\site-packages\iOSbackup\__init__.py", line 161, in __init__
self.unlockKeys()
File "C:\Python39-32\lib\site-packages\iOSbackup\__init__.py", line 757, in unlockKeys
k = iOSbackup.AESUnwrap(self.decryptionKey,classkey[b"WPKY"])
File "C:\Python39-32\lib\site-packages\iOSbackup\__init__.py", line 803, in AESUnwrap
B = AES.new(key, AES.MODE_ECB).decrypt(todec)
File "C:\Python39-32\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "C:\Python39-32\lib\site-packages\Crypto\Cipher\__init__.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "C:\Python39-32\lib\site-packages\Crypto\Cipher\_mode_ecb.py", line 215,in _create_ecb_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "C:\Python39-32\lib\site-packages\Crypto\Cipher\AES.py", line 92, in _create_base_cipher
if len(key) not in key_size:
TypeError: object of type 'NoneType' has no len()
This seems promising because some was likely found, but I've no idea how to move forward.
I would appreciate some assistance. Thank you!
Where can contributors, that can include non-encrypted backup support for the class, start working on it?
//New developer looking to contribute to an open-source project
This is for iOSbackup-0.9.912 from pip.
Extracting an encrypted backup from iOS 14.5.1, I get the error
KeyError: b'KEY'
raised in unwrapKeyForClass(self, protection_class, persistent_key)
:
ck = self.classKeys[protection_class][b"KEY"]
The element self.classKeys[protection_class]
has keys
b'UUID', b'CLAS', b'WRAP', b'KTYP', b'WPKY'
but no b'KEYS'
.
Opening an older backup from iOS 14.4 still works fine.
Hi!
Trying to use this to decrypt and recover files from an old iPhone backup but keep getting this error, any idea what's wrong?
Thanks!
>>> b=iOSbackup(
... udid="64004deb35e37f1ce7e698bd4b9a1926aae37d59",
... cleartextpassword="supersecretpassword",
... backuproot='Backup'
... )
>>>
>>>
>>> b.getFolderDecryptedCopy(
... includeDomains='CameraRollDomain',
... targetFolder='restored-photos',
... )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/iOSbackup/__init__.py", line 654, in getFolderDecryptedCopy
backupFiles = catalog.cursor().execute(query).fetchall()
sqlite3.DatabaseError: file is not a database
>>>
Firstly, thank you for creating iOSbackup!
I am trying to extract all my photos and videos from an encrypted backup, using getFolderDecryptedCopy(). It works for most files, but gives the following error which I suspect is due to one of my video files being 3.2GB in size:
File "./extract_all.py", line 58, in <module>
b.getFolderDecryptedCopy(i, targetFolder=TARGET_FOLDER_MEDIA, includeDomains="CameraRollDomain")
File "/home/username/.local/lib/python3.7/site-packages/iOSbackup/__init__.py", line 466, in getFolderDecryptedCopy
(info,decrypted)=self.getFileDecryptedData(fileNameHash=f['fileID'],manifestData=f['file'])
File "/home/username/.local/lib/python3.7/site-packages/iOSbackup/__init__.py", line 558, in getFileDecryptedData
dataDecrypted = iOSbackup.AESdecryptCBC(dataEncrypted, key)[:fileData['Size']]
File "/home/username/.local/lib/python3.7/site-packages/iOSbackup/__init__.py", line 807, in AESdecryptCBC
dec = Crypto.Cipher.AES.new(key, Crypto.Cipher.AES.MODE_CBC, iv).decrypt(todec)
File "/usr/lib/python3/dist-packages/Crypto/Cipher/blockalgo.py", line 295, in decrypt
return self._cipher.decrypt(ciphertext)
OverflowError: size does not fit in an int
I get a StopIteration
when running getDeviceList()
. I am on MacOS Ventura. Any ideas?
>>> from iOSbackup import iOSbackup
>>> iOSbackup.getDeviceList()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/iphone_backup_extract/venv/lib/python3.8/site-packages/iOSbackup/__init__.py", line 374, in getDeviceList
(_, dirnames, _)=next(os.walk(root))
StopIteration
Hi,
First of all, thank you for the code it is exactly what I have been looking for for a couple of days! I tried to run the code for a few different backups in order to extract my photos from them. It worked well for 2/3 of my backups.
I am basically running the following code with the correct key and udid:
b=iOSbackup(udid="something",
derivedkey="mykey")
b.getFolderDecryptedCopy(
'Media',
targetFolder='restored-photos',
includeDomains='CameraRollDomain',
excludeFiles='%.MOV'
)
For one of the backup I am getting the following error:
Exception ignored in: <function iOSbackup.__del__ at 0x000001D68131BB80>
Traceback (most recent call last):
File "C:...\anaconda3\lib\site-packages\iOSbackup\__init__.py", line 103, in __del__
os.remove(self.manifestDB)
TypeError: remove: path should be string, bytes or os.PathLike, not NoneType
Traceback (most recent call last):
File "D:\....\Recover iphone backup\iphone_photo_backup.py", line 45, in <module>
b.getFolderDecryptedCopy(
File "C:\...\anaconda3\lib\site-packages\iOSbackup\__init__.py", line 459, in getFolderDecryptedCopy
(info,decrypted)=self.getFileDecryptedData(fileNameHash=f['fileID'],manifestData=f['file'])
File "C:\...\anaconda3\lib\site-packages\iOSbackup\__init__.py", line 543, in getFileDecryptedData
with open(os.path.join(self.backupRoot, self.udid, fileNameHash[:2], fileNameHash), 'rb') as infile:
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\Apple\\Path3\\MobileSync\\Backup\\MY-UDID\\78\\7831d13dae1b030538542eec78e456049beebf23'
This file does not exist in the marked folder but I am unsure 1) why it is looking to open it and 2) if there is a way it could be ignored.
Thanks,
An error occurs while creating a iOSbackup object from a password protected backup.
The error is the following:
Exception has occurred: KeyError
b'DPSL'
The error occurs while running this simple code:
from iOSbackup import iOSbackup
def extract_ChatStorage(backup_path, password):
devices = iOSbackup.getDeviceList(backup_path)
backup = iOSbackup(
udid = devices[0]["udid"],
cleartextpassword = password,
backuproot = backup_path
)
return backup.getFileDecryptedCopy("App/net.whatsapp.WhatsApp/Documents/ChatStorage.sqlite")["decryptedFilePath"]
a=extract_ChatStorage("path to a folder containing only one backup", "password")
Firstly, thank you very much for writing this code and making it publicly available. It would be important however that you pick and provide a license for use of your code. The general assumption for code published without a license is that all rights are reserved, and as such that means people can not make any use of the code you release, other than looking at it. If your intention is instead for others to make use of your tool, a LICENSE file would help :).
I noticed that your setup.py indicates that Python >= 3.8 is required. Because Python 3.7 is still the default on many installations and OSes, this is causing some installation issues. Is there a particular reason to require 3.8?
Thank you.
Hi, I notice your code is based on the Google iphone-dataprotection code, which I am using in a similar project. Someone reported a bug in my code, and it looks like yours has the same problem - so I thought I'd let you know too.
Like me, you're using the Size
property from the Manifest file to truncate the decrypted data; it turns out that sometimes this value is shorter than the true byte length of the file, and you inadvertantly remove real file data leading to corruption. You do this here. The original Google code moved away from this, and used a padding=True
argument to AESdecryptCBC
which you seem to have, but without the referenced removePadding
function.
The missing function was:
def removePadding(blocksize, s):
'Remove rfc 1423 padding from string.'
n = ord(s[-1]) # last byte contains number of padding bytes
if n > blocksize or n > len(s):
raise Exception('invalid padding')
return s[:-n]
then you can just modify your code from
dataDecrypted = iOSbackup.AESdecryptCBC(dataEncrypted, key)[:fileData['Size']]
to
dataDecrypted = iOSbackup.AESdecryptCBC(dataEncrypted, key, padding=True)
to fix this bug. I couldn't get your code to run on Windows, so I couldn't easily test this to make a pull request.
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\ivane\AppData\Local\Temp\pip-install-2s3fevrz\pycrypto\setup.py'"'"'; file='"'"'C:\Users\ivane\AppData\Local\Temp\pip-install-2s3fevrz\pycrypto\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\ivane\AppData\Local\Temp\pip-record-3xy8nxgx\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\ivane\AppData\Roaming\Python\Python37\Include\pycrypto'
cwd: C:\Users\ivane\AppData\Local\Temp\pip-install-2s3fevrz\pycrypto
Complete output (157 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\Crypto
copying lib\Crypto\pct_warnings.py -> build\lib.win-amd64-3.7\Crypto
copying lib\Crypto_init_.py -> build\lib.win-amd64-3.7\Crypto
creating build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\hashalgo.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\HMAC.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\MD2.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\MD4.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\MD5.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\RIPEMD.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\SHA.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\SHA224.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\SHA256.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\SHA384.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash\SHA512.py -> build\lib.win-amd64-3.7\Crypto\Hash
copying lib\Crypto\Hash_init_.py -> build\lib.win-amd64-3.7\Crypto\Hash
creating build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\AES.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\ARC2.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\ARC4.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\blockalgo.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\Blowfish.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\CAST.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\DES.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\DES3.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\PKCS1_OAEP.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\PKCS1_v1_5.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher\XOR.py -> build\lib.win-amd64-3.7\Crypto\Cipher
copying lib\Crypto\Cipher_init_.py -> build\lib.win-amd64-3.7\Crypto\Cipher
creating build\lib.win-amd64-3.7\Crypto\Util
copying lib\Crypto\Util\asn1.py -> build\lib.win-amd64-3.7\Crypto\Util
copying lib\Crypto\Util\Counter.py -> build\lib.win-amd64-3.7\Crypto\Util
copying lib\Crypto\Util\number.py -> build\lib.win-amd64-3.7\Crypto\Util
copying lib\Crypto\Util\py3compat.py -> build\lib.win-amd64-3.7\Crypto\Util
copying lib\Crypto\Util\randpool.py -> build\lib.win-amd64-3.7\Crypto\Util
copying lib\Crypto\Util\RFC1751.py -> build\lib.win-amd64-3.7\Crypto\Util
copying lib\Crypto\Util\winrandom.py -> build\lib.win-amd64-3.7\Crypto\Util
copying lib\Crypto\Util_number_new.py -> build\lib.win-amd64-3.7\Crypto\Util
copying lib\Crypto\Util_init_.py -> build\lib.win-amd64-3.7\Crypto\Util
creating build\lib.win-amd64-3.7\Crypto\Random
copying lib\Crypto\Random\random.py -> build\lib.win-amd64-3.7\Crypto\Random
copying lib\Crypto\Random_UserFriendlyRNG.py -> build\lib.win-amd64-3.7\Crypto\Random
copying lib\Crypto\Random_init_.py -> build\lib.win-amd64-3.7\Crypto\Random
creating build\lib.win-amd64-3.7\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\FortunaAccumulator.py -> build\lib.win-amd64-3.7\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\FortunaGenerator.py -> build\lib.win-amd64-3.7\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\SHAd256.py -> build\lib.win-amd64-3.7\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna_init_.py -> build\lib.win-amd64-3.7\Crypto\Random\Fortuna
creating build\lib.win-amd64-3.7\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\fallback.py -> build\lib.win-amd64-3.7\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\nt.py -> build\lib.win-amd64-3.7\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\posix.py -> build\lib.win-amd64-3.7\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\rng_base.py -> build\lib.win-amd64-3.7\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG_init_.py -> build\lib.win-amd64-3.7\Crypto\Random\OSRNG
creating build\lib.win-amd64-3.7\Crypto\SelfTest
copying lib\Crypto\SelfTest\st_common.py -> build\lib.win-amd64-3.7\Crypto\SelfTest
copying lib\Crypto\SelfTest_init_.py -> build\lib.win-amd64-3.7\Crypto\SelfTest
creating build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\common.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_AES.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_ARC2.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_ARC4.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_Blowfish.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_CAST.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_DES.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_DES3.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_pkcs1_15.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_pkcs1_oaep.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_XOR.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher_init_.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Cipher
creating build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\common.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_HMAC.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD2.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD4.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD5.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_RIPEMD.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA224.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA256.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA384.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA512.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash_init_.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Hash
creating build\lib.win-amd64-3.7\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_AllOrNothing.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_chaffing.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_KDF.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_rfc1751.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol_init_.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Protocol
creating build\lib.win-amd64-3.7\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_DSA.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_ElGamal.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_importKey.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_RSA.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey_init_.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\PublicKey
creating build\lib.win-amd64-3.7\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test_random.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test_rpoolcompat.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test__UserFriendlyRNG.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random_init_.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random
creating build\lib.win-amd64-3.7\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_FortunaAccumulator.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_FortunaGenerator.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_SHAd256.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna_init_.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random\Fortuna
creating build\lib.win-amd64-3.7\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_fallback.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_generic.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_nt.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_posix.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_winrandom.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG_init_.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Random\OSRNG
creating build\lib.win-amd64-3.7\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_asn1.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_Counter.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_number.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_winrandom.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util_init_.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Util
creating build\lib.win-amd64-3.7\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature\test_pkcs1_15.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature\test_pkcs1_pss.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature_init_.py -> build\lib.win-amd64-3.7\Crypto\SelfTest\Signature
creating build\lib.win-amd64-3.7\Crypto\Protocol
copying lib\Crypto\Protocol\AllOrNothing.py -> build\lib.win-amd64-3.7\Crypto\Protocol
copying lib\Crypto\Protocol\Chaffing.py -> build\lib.win-amd64-3.7\Crypto\Protocol
copying lib\Crypto\Protocol\KDF.py -> build\lib.win-amd64-3.7\Crypto\Protocol
copying lib\Crypto\Protocol_init_.py -> build\lib.win-amd64-3.7\Crypto\Protocol
creating build\lib.win-amd64-3.7\Crypto\PublicKey
copying lib\Crypto\PublicKey\DSA.py -> build\lib.win-amd64-3.7\Crypto\PublicKey
copying lib\Crypto\PublicKey\ElGamal.py -> build\lib.win-amd64-3.7\Crypto\PublicKey
copying lib\Crypto\PublicKey\pubkey.py -> build\lib.win-amd64-3.7\Crypto\PublicKey
copying lib\Crypto\PublicKey\RSA.py -> build\lib.win-amd64-3.7\Crypto\PublicKey
copying lib\Crypto\PublicKey_DSA.py -> build\lib.win-amd64-3.7\Crypto\PublicKey
copying lib\Crypto\PublicKey_RSA.py -> build\lib.win-amd64-3.7\Crypto\PublicKey
copying lib\Crypto\PublicKey_slowmath.py -> build\lib.win-amd64-3.7\Crypto\PublicKey
copying lib\Crypto\PublicKey_init_.py -> build\lib.win-amd64-3.7\Crypto\PublicKey
creating build\lib.win-amd64-3.7\Crypto\Signature
copying lib\Crypto\Signature\PKCS1_PSS.py -> build\lib.win-amd64-3.7\Crypto\Signature
copying lib\Crypto\Signature\PKCS1_v1_5.py -> build\lib.win-amd64-3.7\Crypto\Signature
copying lib\Crypto\Signature_init_.py -> build\lib.win-amd64-3.7\Crypto\Signature
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Random.OSRNG.winrandom' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ "-Ic:\program files\python37\include" "-Ic:\program files\python37\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" /Tcsrc/winrand.c /Fobuild\temp.win-amd64-3.7\Release\src/winrand.obj
error: command 'cl.exe' failed: No such file or directory
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\ivane\AppData\Local\Temp\pip-install-2s3fevrz\pycrypto\setup.py'"'"'; file='"'"'C:\Users\ivane\AppData\Local\Temp\pip-install-2s3fevrz\pycrypto\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\ivane\AppData\Local\Temp\pip-record-3xy8nxgx\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\ivane\AppData\Roaming\Python\Python37\Include\pycrypto' Check the logs for full command output.
Why don't use PyCryptodome instead of pycrypto. pycrypto is discontinued and is no longer actively supported. PyCryptodome exposes almost the same API as pycrypto.
I am trying to extract data from an encrypted backup of an iPhone7 iOS 13.2.3
I ran all the code in README.md
fine up to the media extraction point:
backup.getFolderDecryptedCopy(
'Media',
targetFolder='./restored-photos',
includeDomains='CameraRollDomain',
excludeFiles='%.MOV'
)
where I get the following error:
Traceback (most recent call last):
File "main.py", line 26, in <module>
backup.getFolderDecryptedCopy(
File "/home/mahmud/.local/lib/python3.8/site-packages/iOSbackup/__init__.py", line 671, in getFolderDecryptedCopy
info=self.getFileDecryptedCopy(
File "/home/mahmud/.local/lib/python3.8/site-packages/iOSbackup/__init__.py", line 944, in getFileDecryptedCopy
info=iOSbackup.getFileInfo(manifestEntry['manifest'])
File "/home/mahmud/.local/lib/python3.8/site-packages/iOSbackup/__init__.py", line 783, in getFileInfo
"size": fileData['Size'],
KeyError: 'Size'
I have tried running it with cleartextpassword
as well as derivedkey
backup = iOSbackup(
udid="86536f75e0143010a3281631c86ac9b6d81473c8",
cleartextpassword="secret :p",
# derivedkey="secret :p",
backuproot="~/Documents/BACKUP_IOS/"
)
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.