hackappcom / iloot

OpenSource tool for iCloud backup extraction
https://hackapp.com/
640 stars 202 forks source link

AttributeError #73

Open lennartbunk opened 8 years ago

lennartbunk commented 8 years ago

Hi, its my first attempt to use python. Maybe the solution is obvious for someone else. I'm running Win 10 with Python 2.7.7.

C:\Python27\iloot-master>iloot.py EMAIL PASSWORD Working with EMAIL PASSWORD Output directory : output Traceback (most recent call last): File "C:\Python27\iloot-master\iloot.py", line 679, in download_backup(args.apple_id, args.password, args.output, args.item_types, args.snapshot, args.combined, args.itunes_style, args.domain, args.threads, args.keep_existing) File "C:\Python27\iloot-master\iloot.py", line 605, in download_backup account_settings = plist_request("setup.icloud.com", "POST", "/setup/get_account_settings", "", headers) File "C:\Python27\iloot-master\iloot.py", line 89, in plist_request print "{}: {}".format(plist_data.title, plist_data.message) File "C:\Python27\lib\plistlib.py", line 301, in getattr raise AttributeError, attr AttributeError: title

ifnull commented 8 years ago

Add a print data to https://github.com/hackappcom/iloot/blob/master/iloot.py#L79. Sounds like get_account_settings didn't return the settings. May be 2 factor auth issue. You should see an error in the print statement.

lennartbunk commented 8 years ago

I added "print data" to line 79, line 80, line 379 and 380. It results in syntax error or makes no difference at all. Sorry, i'm a total newbie in python.

ifnull commented 8 years ago

it should look like this ...

def plist_request(host, method, url, body, headers):
    conn = HTTPSConnection(host)
    sock = socket.create_connection((conn.host, conn.port), conn.timeout, conn.source_address)
    conn.sock = ssl.wrap_socket(sock, conn.key_file, conn.cert_file, ssl_version=ssl.PROTOCOL_TLSv1)
    request = conn.request(method, url, body, headers)
    response = conn.getresponse()

    data = response.read()
    print data
    try:
        plist_data = plistlib.readPlistFromString(data)
    except:
        plist_data = None
lennartbunk commented 8 years ago

Okay, now that's the result:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

protocolVersion 1.0 ``` appleAccountInfo dsid 123123123 dsPrsID 123123123 tokens mmeAuthToken 123123123 ```

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

protocolVersion 2 ``` localizedError MOBILEME_TERMS_OF_SERVICE_UPDATE ```

Traceback (most recent call last): File "iloot.py", line 679, in download_backup(args.apple_id, args.password, args.output, args.item_types, args.snapshot, args.combined, args.itunes_style, args.domain, args.threads, args.keep_existing) File "iloot.py", line 605, in download_backup account_settings = plist_request("setup.icloud.com", "POST", "/setup/get_account_settings", "", headers) File "iloot.py", line 89, in plist_request print "{}: {}".format(plist_data.title, plist_data.message) File "C:\Python27\lib\plistlib.py", line 301, in getattr raise AttributeError, attr AttributeError: title

mca-gif commented 8 years ago

The issue is that you have not approved the terms and conditions released when iOS 9 was released. Back in October iloot was changed to pretend to be iOS 9 in a vain attempt to get it to fetch iOS 9 backups. Aside from perhaps a recent version of iTunes, I'm not sure anything but signing in on an iOS 9 device can trigger the approval process. You could also roll back the changes made in commit bcc5052f08ecea266d955ef134121c8f2605434c and it would begin working again.

lennartbunk commented 8 years ago

The MOBILEME_TERMS_OF_SERVICE_UPDATE line made me think of that problem too but i didn't found a solution. I installed the newest iTunes and iCloud but there wasn't an option to accept the new TOS.

I now rolled back the changes made in commit bcc5052 and - it's working! The reason might be that it's an old iPhone 4s Backup from iOS 8.1.1.

Now it stopps after about 5mb with that:

Traceback (most recent call last): File "iloot.py", line 679, in download_backup(args.apple_id, args.password, args.output, args.item_types, args.snapshot, args.combined, args.itunes_style, args.domain, args.threads, args.keep_existing) File "iloot.py", line 635, in download_backup client.download(UDID, types) File "iloot.py", line 510, in download self.authorize_get(authTokens, snapshot) File "iloot.py", line 281, in authorize_get self.write_file(file, decrypted_chunks, snapshot) File "iloot.py", line 345, in write_file with open(path, "wb") as ff: IOError: [Errno 2] No such file or directory: u'output[...]/store/CloudUserDictionary.sqlite'

The backup has a size of 1.81gb. I successfully downloaded it with wondershare dr.fone.

AnonyMoouse commented 8 years ago

Hi, I am a total and complete noob when it comes to programming of any kind. I was wondering if you could post the version without the ios9 changes on MEGA or email them to me at gatfagmyshitup@gmail.com. It would be greatly appreciated.

sbasmanov commented 7 years ago

I needed sms.db to restore dialog deleted by accident. On my 5s script worked fine. On wife's 5s it gave MOBILEME_TERMS_OF_SERVICE_UPDATE error. Googling shows that no easy solution. But above link to commit bcc5052 that did the trick. In current script I changed only 3 lines: ` CLIENT_INFO = "<iPhone2,1> <iPhone OS;5.1.1;9B206> <com.apple.AppleAccount/1.0 ((null)/(null))>"

CLIENT_INFO = "<iPhone6,2> <iPhone OS;9.0.2;13A452> <com.apple.AppleAccount/1.0 ((null)/(null))>"

USER_AGENT_MOBILE_BACKUP = "MobileBackup/5.1.1 (9B206; iPhone3,1)"

USER_AGENT_MOBILE_BACKUP = "MobileBackup/9.0.2 (13A452; iPhone6,2)"

CLIENT_INFO_BACKUP = " <iPhone OS;5.1.1;9B206> <com.apple.icloud.content/211.1 (com.apple.MobileBackup/9B206)>"

CLIENT_INFO_BACKUP = " <iPhone OS;9.0.2;13A452> <com.apple.icloud.content/211.1 (com.apple.MobileBackup/13A452)>"

` And that worked. I think apple returns response depending on device version. So, reverting to old version strings makes it work.