proseltd / Telepathy-Community

Public release of Telepathy, an OSINT toolkit for investigating Telegram chats.
MIT License
949 stars 133 forks source link

Trouble running it in a Colab notebook #44

Open untergeekDE opened 1 year ago

untergeekDE commented 1 year ago

I tried to build a simple Colab notebook for using the tool (this, it's in German, unfortunately), to make the tool usable for people who are not allowed to install Python on their computers.

This works fine as long as there is no saved login data, if the 1234567.session and telepathy_files/login.txt files exist, the programm crashes:

Traceback (most recent call last):
  File "/usr/local/bin/telepathy", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/telepathy/telepathy.py", line 226, in cli
    client = TelegramClient(phone_number, api_id, api_hash)
  File "/usr/local/lib/python3.8/dist-packages/telethon/client/telegrambaseclient.py", line 275, in __init__
    session = SQLiteSession(session)
  File "/usr/local/lib/python3.8/dist-packages/telethon/sessions/sqlite.py", line 47, in __init__
    c = self._cursor()
  File "/usr/local/lib/python3.8/dist-packages/telethon/sessions/sqlite.py", line 242, in _cursor
    self._conn = sqlite3.connect(self.filename,
sqlite3.OperationalError: unable to open database file

I guess there might be a very simple solution to this (apart from deleting the files, and starting from scratch). Have you got an idea?

proseltd commented 1 year ago

Hi there! There's a potential method to do this by using string sessions instead of storing the API credentials in the form they currently are in. I'm looking to do a rehaul of how logging in to Telegram with Telepathy works to fix a handful of issues that come with relying on sqlite, so will see if that can solve this issue too.