Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for token extraction for Apple users #460

Merged
merged 2 commits into from
Jan 23, 2019

Conversation

domibarton
Copy link
Contributor

Added description how to extract SQLite database from iOS backup & manually extract/decrypt tokens from SQLite database.

@domibarton domibarton changed the title Apple update Docs for token extraction for Apple users Jan 20, 2019
@coveralls
Copy link

Coverage Status

Coverage remained the same at 72.461% when pulling 26bbcaa on confirm:apple-update into 07102a8 on rytilahti:master.

@@ -217,6 +237,29 @@ to the tool with ``--password <password>``.
Token: 476e6b70343055483XXX
MAC: 28:6C:07:XX:XX:XX

Extracting tokens manually
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the automatic way using miio-extract-tokens not working in some cases, or is this just for completeness?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't work for my sqlite database and therefor I've added this part. There was a TypeError exception:

(homeassistant) root@rpi:/opt/homeassistant# miio-extract-tokens /tmp/1672094281_mihome.sqlite
INFO:miio.extract_tokens:Reading database from /tmp/1672094281_mihome.sqlite
INFO:miio.extract_tokens:Reading tokens from Apple DB
Traceback (most recent call last):
  File "/opt/homeassistant/homeassistant/bin/miio-extract-tokens", line 11, in <module>
    sys.exit(main())
  File "/opt/homeassistant/homeassistant/lib/python3.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/opt/homeassistant/homeassistant/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/opt/homeassistant/homeassistant/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/homeassistant/homeassistant/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/homeassistant/homeassistant/lib/python3.5/site-packages/miio/extract_tokens.py", line 155, in main
    devices = list(reader.read_tokens(backup))
  File "/opt/homeassistant/homeassistant/lib/python3.5/site-packages/miio/extract_tokens.py", line 113, in read_tokens
    yield from self.read_apple()
  File "/opt/homeassistant/homeassistant/lib/python3.5/site-packages/miio/extract_tokens.py", line 74, in read_apple
    token = BackupDatabaseReader.decrypt_ztoken(dev['ZTOKEN'])
  File "/opt/homeassistant/homeassistant/lib/python3.5/site-packages/miio/extract_tokens.py", line 50, in decrypt_ztoken
    if len(ztoken) <= 32:
TypeError: object of type 'NoneType' has no len()

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should obviously be fixed. Could you try with --dump-raw to see what it outputs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should obviously be fixed. Could you try with --dump-raw to see what it outputs?

Sorry busy again :) I can test it tonight… let me open an issue for that!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Let's merge this now, it's a good idea still have the manual way documented, too :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants