sockysec / Telerecon

A reconnaissance framework for researching and investigating Telegram.
830 stars 115 forks source link

Fix the event loop error with importlib method #14

Open NeonBubbles opened 10 months ago

NeonBubbles commented 10 months ago

I used importlib in launcher.py to dynamically import the scripts that need to be run. For those scripts that utilize asynchronous operations, I manage the event loop directly in launcher.py, which helps avoid potential event loop errors. Therefore, to utilize importlib, I've made changes to almost all scripts' structure, but the core code remains largely unchanged. I conducted some manual tests for each script, but I recommend you do some testing again before merging. Feel free to give feedback if there are any issues.

sockysec commented 10 months ago

Hey Neon - A huge thanks for working through these changes to implement the importlib method! I'll conduct some tests after the holiday season, and merge/provide feedback as needed.

sockysec commented 8 months ago

Sorry for the long delay - just got around to beginning some testing. Looking good so far, however, I did experience the following error. Might still be some event loop/asynco issue persisting

Traceback (most recent call last): File "/home/osint/Downloads/Telerecon/launcher.py", line 127, in exec(open(choice).read()) File "", line 185, in File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 181, in main File "", line 127, in File "", line 84, in File "/usr/lib/python3.11/asyncio/runners.py", line 186, in run raise RuntimeError( RuntimeError: asyncio.run() cannot be called from a running event loop sys:1: RuntimeWarning: coroutine 'process_target_channels' was never awaited

NeonBubbles commented 8 months ago

Traceback (most recent call last): File "/home/osint/Downloads/Telerecon/launcher.py", line 127, in exec(open(choice).read())

You seem to be testing with the code from the current main branch instead of this pull request. I have abandoned the exec function.

sockysec commented 8 months ago

Haha that'll do it.

Tested the right one this time and it seems to be working well, resolving the loop issue as intended.

However... Scripts appear to load line by line like a typewriter, making them significantly slower. For example, instead of the whole launcher's text loading instantly, it prints it line by line. The same goes for results returned by queries (i.e. user details). This will need to be resolved before further testing/merging with main.

NeonBubbles commented 8 months ago

I've never come across this issue before. When I rerun the program, it loads and displays the lines almost instantly on both of my computers. Is it possible that other applications are heavily using your system resources? You might want to try rebooting or testing the program on a different computer to see if that helps.