Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving from threads to asyncio #643

Closed
maurosoria opened this issue Dec 2, 2020 · 14 comments · Fixed by #1391
Closed

Moving from threads to asyncio #643

maurosoria opened this issue Dec 2, 2020 · 14 comments · Fixed by #1391
Labels
enhancement New feature or request help wanted Extra attention is needed Priority: Medium

Comments

@maurosoria
Copy link
Owner

maurosoria commented Dec 2, 2020

Hello folks,

I am opening this issue because I do not have the time to do it myself, but I really think that now is the momentot move from threads to an asyncio based application (at least for requests and some callbacks).

I planned from the beginning to do this, but back then asyncio wasn't widely supported by most of linux distros and wasn't as mature like it is today.

This is a very important step, because it would open the door to add extra scanning capabilities to dirsearch, that now seems very difficult with a normal thread scheme.

What is the feature?

Moving from a regular thread-based system to an asynchronous based requests system would improve the performance.

Take into consideration

  • The idea is using an asyncio executor for processing Jobs.
  • It is important to follow pep8 guidelines and validate the code.
  • It might be a good idea considering a model who may, in the future, support scanning multiple hosts at the same time (like meg)
  • I guess the proper library for doing this may be aiohttp, but I guess for now it is important to stop using threads and keep using requests.
  • It can be very time consuming to code, but maybe using CPU bound executor for certain tasks could make a difference (maybe not).

Obviously, I will assist you if you want to cooperate in all I can, and I will review the code myself.

Thanks for cooperating, and spread the voice!

Regards,
Mauro

@maurosoria maurosoria added help wanted Extra attention is needed enhancement New feature or request labels Dec 2, 2020
@shelld3v
Copy link
Collaborator

shelld3v commented Dec 3, 2020

Should we fully stop using threads and turn into async, or support both?

@shelld3v
Copy link
Collaborator

shelld3v commented Dec 7, 2020

And the fact that it will be really hard to can control the speed if we use asyncio

@maurosoria
Copy link
Owner Author

maurosoria commented Dec 8, 2020

it is possible to mix asyncio with threads, using the proper asyncio executor:

@shelld3v shelld3v added Priority: Critical and removed help wanted Extra attention is needed labels Jul 30, 2022
@shelld3v shelld3v added the help wanted Extra attention is needed label Aug 14, 2022
@shelld3v shelld3v added this to the v0.4.4 milestone Aug 14, 2022
@shelld3v shelld3v removed this from the v0.4.4 milestone Nov 20, 2022
@dbfreem
Copy link

dbfreem commented Nov 18, 2023

@maurosoria I actually have a lot of experience moving code over to asyncio. One thing to keep in mind is it can grow legs really quickly and get complex. Do you have a suggestion on where would be a good section to pull off and move over to asyncio. I would expect to use aiohttp instead of request though, so you get the true benefit of asyncio.

Anyways, thought I would reach out and see if you wall were still moving forward with this, if so if you needed some help.

@maurosoria
Copy link
Owner Author

Hello @dbfreem ! I am very grateful for your interest !

IMO Fuzzer class is the best candidate for starting to move code. You can rewrite that class, create a super class BaseFuzzer, and just move the old class to a subclass (e.g. TheadingFuzzer) and you can write another (eg. AsyncioFuzzer).

In that way we can write universal unit tests for both fuzzers (and make other ones in the future!).

the other candidate (which I'm also looking forward to doing that) is the Controller class. But, in that case, is much more complex because you need to completely rewrite everything (report writing, user input, etc).

If you are really into this please do not hesitate in use this or another communication method you prefer (like twitter!)

@dbfreem
Copy link

dbfreem commented Nov 20, 2023

Hey @maurosoria that sounds like a great plan. I plan on working on this over the holidays, so I will keep you up to date on the progress.

@willjprice
Copy link

Following

@maurosoria
Copy link
Owner Author

maurosoria commented Feb 1, 2024

Hello! Any news about this ?

@Prady18
Copy link

Prady18 commented Feb 3, 2024 via email

@DylanTiger
Copy link

Hey what are you going to use asyncio and aiohttp or asyncio and httpx? or something else that i ignore? I think that with chatgpt help it won't need much to accomplish it :D

@Prady18
Copy link

Prady18 commented May 20, 2024 via email

@asadmins
Copy link

asadmins commented Jul 9, 2024

Is there any progress on this project?

@shelld3v
Copy link
Collaborator

shelld3v commented Aug 6, 2024

Is there any progress on this project?

Not yet

@zrquan zrquan mentioned this issue Sep 7, 2024
12 tasks
@zrquan
Copy link
Contributor

zrquan commented Sep 8, 2024

Hey guys, I've submitted a draft PR to support asynchronous mode, testing and reviews are welcome. The speedup from using coroutines is significant, hopefully it can be merged into the master branch soon 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed Priority: Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants