proseltd / Telepathy-Community

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

task was destroyed but it is pending #42

Open AcidkoHorkaCokolada opened 1 year ago

AcidkoHorkaCokolada commented 1 year ago

Hi, i use this code to run Telepathy

for channel in channels:
    start = datetime.now()
    os.system('telepathy -t' + channel+' -c')   
    file = open('notes.txt', 'a')
    stop = datetime.now()
    final_time = format(stop - start)
    file.write(final_time+';'+channel+'\n')
    file.close()

but usually don't get all results from all channels as i get:

error

any idea how to fix it?

proseltd commented 1 year ago

Hello! Sorry for taking so long to come to this. I'm curious as to why you're running multiple channels this way? Telepathy supports working with multiple channels at the same time, for example "$ telepathy -t CHANNELONE -t CHANNELTWO -t CHANNEL3 -c"

However, to address your issue directly, this seems to be a clash with multiple processes running at the same time, causing the .session file Telepathy runs on to crash. I'm working on alternative methods for this file (at the moment it's a sqlite database that cannot be opened more than once before being closed). There's a potential that a future update will fix this.

AcidkoHorkaCokolada commented 1 year ago

Hi Jordan, thank you for reply, i need to scrap over 200 channels(the list changes form time to time), thats why i use loop. is there a know workaround? i can use? like for example: subprocess.run('telepathy -t' + channel+' -f',shell=True) ?

proseltd commented 1 year ago

Hi there!

I would (and have in the past done) a shell script for this, like so:

#!/bin/bash
declare -a StringArray=("CHANNEL_ONE" "CHANNEL_TWO" "CHANNEL_THREE")
for val in ${StringArray[@]}; do
python3 /path/to/telepathy -t $val -c
done

Once you've put that in a file, make it executable with:

chmod +x FILENAME.sh

and then you can run it simply with:

./FILENAME.sh

You'll need to declare the full list in the string array, but I'm sure there's also a way to enumerate over a list in a file. This also works with throwing the bash script into a cron job if you want to automatically do this every x amount of days.

Let me know if you need anything else!