batreller / AndroidTelePorter

Converts Android's telegram session into telethon / tdata session, can also be used to exctract any data from mobile session (auth key, dc id, user id and other)
MIT License
92 stars 28 forks source link

How can I extract the account ID from an Android session and convert it to tdata? #7

Closed nullname0396 closed 5 months ago

nullname0396 commented 6 months ago

I apologize for my limited programming foundation. I have successfully extracted the session_string using the tool you provided, but how can I extract the account ID from the Android session and convert it to tdata? How can this be achieved?

batreller commented 6 months ago

Unfortunately, I am not sure if it is possible, I do not think that mobile session needs user id and it might be not stored in it at all. What you can do is login via telethon, get user id and convert it to tdata, but it might increase chances of your account being blocked by telegram. Another possible solution is to start the telegram from the mobile and in cache4.db might be created some rows that will contain id of your user.

Try to research about cache.db and other cache files, you might find it there.

nullname0396 commented 6 months ago

a4ea8373b6f27375bb48ce7d4bf00f7 In the screenshot, you mentioned the process of generating a tdata. Can this be achieved through your tool?

batreller commented 6 months ago

Not through my tool, no

What I did back to then is I extracted account id manually by just logging into the mobile session from the phone

Unfortunately account id is not stored in tgnet.dat file, I do not think that it's even stored somewhere before you log into session using phone

amao12580 commented 6 months ago

i can do this

nullname0396 commented 6 months ago

我可以做这个

How can this process be implemented, is Telethon required?

batreller commented 6 months ago

So I decided to do some research on this because it does seem like useful function so I will do my best in order to implement extraction of User ID and even convertion to tdata

Repository will receive updates in nearest future

What I can tell you for now is try searching it in cache4.db in "user_settings" table, it is SQLite database and it seem to contain id of user

amao12580 commented 6 months ago

So I decided to do some research on this because it does seem like useful function so I will do my best in order to implement extraction of User ID and even convertion to tdata

Repository will receive updates in nearest future

What I can tell you for now is try searching it in cache4.db in "user_settings" table, it is SQLite database and it seem to contain id of user

1.There is no need to read from the cache4.db file, which is large and has a large number of table rows, resulting in poor performance

amao12580 commented 6 months ago

So I decided to do some research on this because it does seem like useful function so I will do my best in order to implement extraction of User ID and even convertion to tdata

Repository will receive updates in nearest future

What I can tell you for now is try searching it in cache4.db in "user_settings" table, it is SQLite database and it seem to contain id of user

  1. I have completed these research tasks: using userid Authkey and other data are converted offline to tdata, but the tdata file is invalid and cannot be logged in correctly by Windows clients. Error: 401
amao12580 commented 6 months ago

我可以做这个

How can this process be implemented, is Telethon required?

No need for it

batreller commented 5 months ago

Hi, this functionality has been implemented in newer version of AndroidTelePorter, I suggest you reading documentation as it will answer all your questions.