proseltd / Telepathy-Community

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

Errors trying to run on OS X #2

Closed ejfox closed 2 years ago

ejfox commented 2 years ago

Hey Jordan,

Have been still trying to get this running locally. I've tried 3 times starting from scratch and re-cloning and setting up the repo but I consistently get errors when trying to scrape forwarded messages and would love your help figuring out what I am doing wrong.

OS X 11.6.1 + Python 3.9.10

~/Desktop
➜  git clone https://github.com/jordanwildon/Telepathy.git
Cloning into 'Telepathy'...
remote: Enumerating objects: 151, done.
remote: Counting objects: 100% (151/151), done.
remote: Compressing objects: 100% (148/148), done.
remote: Total 151 (delta 86), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (151/151), 43.00 KiB | 3.58 MiB/s, done.
Resolving deltas: 100% (86/86), done.

~/Desktop
➜  cd Telepathy/

~/Desktop/Telepathy  main via 🐍 v3.9.10
➜  vim requirements.txt                                                                      [git:main] ✔

~/Desktop/Telepathy  main [!] via 🐍 v3.9.10 // 29s
➜  pip install -r requirements.txt                                                          [git:main] ✖
Requirement already satisfied: pandas==1.3.4 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (1.3.4)
Collecting Telethon==1.24.0
  Using cached Telethon-1.24.0-py3-none-any.whl (528 kB)
Requirement already satisfied: pytz>=2017.3 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pandas==1.3.4->-r requirements.txt (line 1)) (2021.3)
Requirement already satisfied: numpy>=1.17.3 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pandas==1.3.4->-r requirements.txt (line 1)) (1.22.2)
Requirement already satisfied: python-dateutil>=2.7.3 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pandas==1.3.4->-r requirements.txt (line 1)) (2.8.2)
Requirement already satisfied: rsa in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from Telethon==1.24.0->-r requirements.txt (line 2)) (4.8)
Requirement already satisfied: pyaes in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from Telethon==1.24.0->-r requirements.txt (line 2)) (1.6.1)
Requirement already satisfied: six>=1.5 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from python-dateutil>=2.7.3->pandas==1.3.4->-r requirements.txt (line 1)) (1.16.0)
Requirement already satisfied: pyasn1>=0.1.3 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from rsa->Telethon==1.24.0->-r requirements.txt (line 2)) (0.4.8)
Installing collected packages: Telethon
  Attempting uninstall: Telethon
    Found existing installation: Telethon 1.21.1
    Uninstalling Telethon-1.21.1:
      Successfully uninstalled Telethon-1.21.1
Successfully installed Telethon-1.24.0

~/Desktop/Telepathy  main [!] via 🐍 v3.9.10
➜  python3 setup.py                                                                         [git:main] ✖
Welcome to the Telepathy setup.
This file wil save your Telegram login information to allow API access.
Follow the README instructions to get your credentials.
Please enter your API ID:
******
You entered "******"
Is this correct? (y/n)y
Updating...
Please enter your API Hash:
******
You entered "******"
Is this correct? (y/n)y
Updating...
Please enter your phone number:
+******
You entered "+******"
Is this correct? (y/n)y
Updating...
Setup is complete.
Telepathy is now ready and can be used. You may now close the terminal.

~/Desktop/Telepathy  main [!?] via 🐍 v3.9.10 // 55s
➜  python3 telepathy.py                                                                     [git:main] ✖
Welcome to Telepathy
Please select a function:
1. Batch chat archiver
2. Archive within a timeframe
3. Scrape group members
4. Scrape forwarded messages in a chat
5. Lookup a user ID

Pick a number:4
Loading Scrape forwarded messages in a chat ...
Launching channel forward scraper...
Enter the code: ******
Welcome to channel forward scraper.
This tool will scrape a Telegram channel for all forwarded messages and their original sources.
Do you want to print forwards to terminal while Telepathy runs? (y/n)y
Please enter a Telegram channel name:
convoytodc22
You entered "convoytodc22"
Is this correct? (y/n)y
Scraping forwards from convoytodc22 This may take a while...
Traceback (most recent call last):
  File "<string>", line 53, in main
NameError: name 'get_display_name' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ejfox/Desktop/Telepathy/telepathy.py", line 49, in <module>
    exec(open("forwards.py").read())
  File "<string>", line 97, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "<string>", line 91, in main
NameError: name 'user_selection_media' is not defined

I tried to use a more recent version of Telethon by updating requirements.txt so that Telethon==1.24.0 but I still get the same error. Any help deeply appreciated!

proseltd commented 2 years ago

This was an error on my part. The reason 'user_selection_media' was not defined is because I named it incorrectly. Now fixed!

ejfox commented 2 years ago

Works great now, thank you!

ejfox commented 2 years ago

@jordanwildon Actually, I ran into the same error again when trying to scrape forwards from discovered channels. Scraping a single channel's forwards worked great though.

Forwards scraped successfully.
Do you also want to scrape forwards from the discovered channels? (y/n)y
Scraping forwards from channels discovered in convoytodc22 ...
Dr. Vladimir Zelenko (Zelenko Protocol) >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Nicholas Veniamin >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
The Vigilant Fox 🦊 >>> Dr. Vladimir Zelenko (Zelenko Protocol)
The Vigilant Fox 🦊 >>> Dr. Vladimir Zelenko (Zelenko Protocol)
AprilMossTV >>> Dr. Vladimir Zelenko (Zelenko Protocol)
We The Media ⭐️⭐️⭐️ >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Project Veritas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Chief Nerd >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Seth Keshel - "Captain K" >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Vladimir Zelenko (Zelenko Protocol) >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Robert W Malone, MD >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Health Ranger >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Publius >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Vladimir Zelenko (Zelenko Protocol) >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Chief Nerd >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Publius >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Publius >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Lynn Fynn’s Science Enlightenment Channel & Stuff >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Pinkie Feinstein >>> Dr. Vladimir Zelenko (Zelenko Protocol)
KanekoaTheGreat >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Chief Nerd >>> Dr. Vladimir Zelenko (Zelenko Protocol)
KanekoaTheGreat >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Seth Keshel - "Captain K" >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
KanekoaTheGreat >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Charlie Kirk >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Covid Truth Network >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Ron Watkins [CodeMonkeyZ] >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Chief Nerd >>> Dr. Vladimir Zelenko (Zelenko Protocol)
KanekoaTheGreat >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Vladimir Zelenko (Zelenko Protocol) >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Ron Watkins [CodeMonkeyZ] >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Blue-Eyes Zone >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Covid Truth Network >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dschlopes >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Robert W Malone, MD >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Vladimir Zelenko (Zelenko Protocol) >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Robert W Malone, MD >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
General Flynn ⭐️⭐️⭐️ >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Chief Nerd >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Ron Watkins [CodeMonkeyZ] >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Ron Watkins [CodeMonkeyZ] >>> Dr. Vladimir Zelenko (Zelenko Protocol)
CRAIG KELLY MP - Leader United Australia Party - keeping the bastards honest. >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Vladimir Zelenko (Zelenko Protocol) >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Vladimir Zelenko (Zelenko Protocol) >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Vladimir Zelenko (Zelenko Protocol) >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Ron Watkins [CodeMonkeyZ] >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Vladimir Zelenko (Zelenko Protocol) >>> Dr. Vladimir Zelenko (Zelenko Protocol)
KanekoaTheGreat >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Publius >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Publius >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Ron Watkins [CodeMonkeyZ] >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
JasonNelson4Texas >>> Dr. Vladimir Zelenko (Zelenko Protocol)
KanekoaTheGreat >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Official Plandemic >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Dr. Vladimir Zelenko (Zelenko Protocol) >>> Dr. Vladimir Zelenko (Zelenko Protocol)
Traceback (most recent call last):
  File "<string>", line 119, in new_main
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telethon/client/users.py", line 319, in get_entity
    channels = (await self(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telethon/client/users.py", line 84, in _call
    result = await future
telethon.errors.rpcerrorlist.ChannelPrivateError: The channel specified is private and you lack permission to access it. Another reason may be that you were banned from it (caused by GetChannelsRequest)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ejfox/Desktop/telegram-attempt-4/Telepathy/telepathy.py", line 49, in <module>
    exec(open("forwards.py").read())
  File "<string>", line 166, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "<string>", line 157, in new_main
NameError: name 'user_selection_media' is not defined
proseltd commented 2 years ago

Fixed! Same issue as before, but with error handling, needed to be more thorough with testing before updating it before!

ejfox commented 2 years ago

Updated with the latest, got further than before, but hit a new error.

I wish I knew Python better so I could submit fixes as PRs instead of endless bugs, I really appreciate your help- let me know if there is anything I can do to be helpful.

Do you also want to scrape forwards from the discovered channels? (y/n)y
Scraping forwards from channels discovered in convoytodc22 ...
Traceback (most recent call last):
  File "/Users/ejfox/Desktop/telegram-attempt-4/Telepathy/telepathy.py", line 49, in <module>
    exec(open("forwards.py").read())
  File "<string>", line 166, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "<string>", line 114, in new_main
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telethon/requestiter.py", line 58, in __anext__
    if await self._init(**self.kwargs):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telethon/client/messages.py", line 27, in _init
    self.entity = await self.client.get_input_entity(entity)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telethon/client/users.py", line 437, in get_input_entity
    await self._get_entity_from_string(peer))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telethon/client/users.py", line 574, in _get_entity_from_string
    raise ValueError(
ValueError: Cannot find any entity corresponding to "BH BL Parents For Choice"

~/Desktop/telegram-attempt-4/Telepathy  main [?] via 🐍 v3.9.10 // 14m14s
✗