jiru / kakaodecrypt

Decrypt chat history from the local database of Kakaotalk’s Android app
Do What The F*ck You Want To Public License
64 stars 26 forks source link

Support of encoding type 23 and 24 needed #2

Closed JohnChu101 closed 6 years ago

JohnChu101 commented 6 years ago

I did my research and the new prefix should be "tony".

And I always have the following error running the program. I don't know what's wrong.

Traceback (most recent call last):
  File "kakaodecrypt.py", line 166, in <module>
    KakaoDbDecrypt.run(db_file, enc_table, dec_table, do_print)
  File "kakaodecrypt.py", line 135, in run
    contents = KakaoDecrypt.decrypt(user_id, enc_type, contents)
  File "kakaodecrypt.py", line 88, in decrypt
    key = KakaoDecrypt.deriveKey(key, salt, 2, 32)
  File "kakaodecrypt.py", line 72, in deriveKey
    KakaoDecrypt.pkcs16adjust(I, j * v, B)
  File "kakaodecrypt.py", line 24, in pkcs16adjust
    x = (b[len(b) - 1] & 0xff) + (a[aOff + len(b) - 1] & 0xff) + 1
TypeError: unsupported operand type(s) for &: 'str' and 'int'
jiru commented 6 years ago

Thank you John.

For testing purposes, could you provide me with a complete row encrypted with "enc":23, like in #1?

JohnChu101 commented 6 years ago

@jiru I found that the latest database uses enc 24:

1|1714824122888697856|1|199681262821716|185911128|RrODdJ7LDIcozGqjIHvEZ2x+U8hunYSaFCULVnY/A8YZhE3njV19nT1JIEzn/NUS|{}|1525360165|0|646846704|1714818457667575808|0|None|{"notDecoded":false,"origin":"MCHATLOGS","c":"05-06 21:58:19","isSingleDefaultEmoticon":false,"defaultEmoticonsCount":0,"isMine":false,"enc":24}
2|1714824624108150785|1|199681262821716|195847548|GvH+4xyB2hzOpbATZlNMJQ==|{}|1525360225|0|646907080|1714824122888697856|0|None|{"notDecoded":false,"origin":"MCHATLOGS","c":"05-06 21:58:19","isSingleDefaultEmoticon":false,"defaultEmoticonsCount":0,"isMine":true,"enc":24}
3|1714824645146779648|1|199681262821716|195847548|1pPepn0lJSCRLxK9P5kaNQ==|{}|1525360227|0|646909580|1714824624108150785|0|None|{"notDecoded":false,"origin":"MCHATLOGS","c":"05-06 21:58:19","isSingleDefaultEmoticon":false,"defaultEmoticonsCount":0,"isMine":true,"enc":24}
4|1714824678197895168|1|199681262821716|195847548|IICZJO/83CXZWZhNmiWmHg==|{}|1525360231|0|646913580|1714824645146779648|0|None|{"notDecoded":false,"origin":"MCHATLOGS","c":"05-06 21:58:19","isSingleDefaultEmoticon":false,"defaultEmoticonsCount":0,"isMine":true,"enc":24}
jiru commented 6 years ago

I see. I don’t think that messages that have been encoded with enc:23 in the database are converted to enc:24 after updating the app, so you should still be able to find some using a command like: ./kakaodecrypt.py -p KakaoTalk.db | grep '"enc":23'

JohnChu101 commented 6 years ago

But some of them are using enc 24 I think. I'm seeking for support for enc 24 as well.

jiru commented 6 years ago

Yes, I will add support for enc 24 since you provided me with data encrypted with enc 24. But I would like to add support for enc 23 too, and I can't do that unless you provide me with data encrypted with enc 23. You may find some relevant enc 23 data using the command I mentioned.

JohnChu101 commented 6 years ago

I've got only 278 lines, all of them end with "enc":24.