You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows can be very slow with asyncio especially when invoking too many tcp connections and on top of that uvloop is not supported with windows. That was until I came along and took a crack at it myself and got it to work with changing a lot of code hence the reason for making it into a separate library in the first place. I found that my library winloop to be pretty successful at being faster than the WindowsSelectorEventLoopPolicy as well as the WindowsProactorEventLoopPolicy which the ProactorEventLoop is known to have ssl issues with version 3.9. Since TheHarvester uses a lot of tcp connections to webscrape search engines, I thought it might be a good idea if we were to go ahead and give winloop a try with this amazing software.
If you need any benchmarks, I have them in the readme of my github repository and on pypi.
Where do we use winloop?
The only place it would have to be implemented is at the beginning where theHarvester.py file is located because at the end of the day it's using window's C APIs instead of any Posix Only Apis. My idea is to try and import the winloop module after freezing multiprocessesing before falling back to using the SelectorEventLoopPolicy if winloop is unavalible or for anyone who doesn't have windows C/C++ libraries installed yet. That way those who don't want to install the C/C++ libraries can still use TheHarvester. But for those who have the C/C++ Extensions can have some performance benefits.
The Plan
Here is where I would like this to go/be and how it should go about being implemented.
if__name__=='__main__':
platform=sys.platformifplatform=='win32':
# Required or things will break if trying to take screenshotsimportmultiprocessingmultiprocessing.freeze_support()
# Check for asyncio performance benefitstry:
importwinloopwinloop.install()
exceptModuleNotFoundError:
# Fallback to using the SelectorEventLoopPolicyasyncio.DefaultEventLoopPolicy=asyncio.WindowsSelectorEventLoopPolicy
Expected Outcome
I hope that by implementing this feature we can start to see faster performance and acceleration for windows users and that the speed will help benefit the tcp connections made as well as the dns lookups and hopefully there will be less drag and lag when it's collecting things and maybe some improvements with taking screenshots of specific sites.
P.S. I'm also the developer of Winloop. If you have any problems with using this library you can forward those issues to my repository I'll be happy to take a look at them and try and solve any issues arising from it.
The text was updated successfully, but these errors were encountered:
This is extremely cool and I will have to look more into this. Out of curiousity, why not create a PR for uvloop and have uvloop support both windows and linux with the winloop code? I have not looked at the codebase for winloop yet but just a thought. I have also faced errors in the past when running this tool on Windows before which is why I lowered the number of asyncio tasks from 3 to 2 a while ago which seems to be more stable at least from testing the tool.
@NotoriousRebel
I would love to do that with uvloop but the problem is that it would be really hard to compile as well as figure it out.
There were a couple of libraries and a dozen functions that had to be dropped out or replaced. But I'll definitely try to merge my project to uvloop in the future but it will be an entire obstacle of it's own. Many system checks would need to be in place in order to make it work. But thank you for the suggestion I'll try to reach out again to the Magicstack team on how winloop can be implemented in uvloop in a clean manner. Let me know if you still want me to make a pull request for implementing winloop until uvloop has support for windows.
The issue
Windows can be very slow with asyncio especially when invoking too many tcp connections and on top of that
uvloop
is not supported with windows. That was until I came along and took a crack at it myself and got it to work with changing a lot of code hence the reason for making it into a separate library in the first place. I found that my library winloop to be pretty successful at being faster than theWindowsSelectorEventLoopPolicy
as well as theWindowsProactorEventLoopPolicy
which the ProactorEventLoop is known to have ssl issues with version 3.9. Since TheHarvester uses a lot of tcp connections to webscrape search engines, I thought it might be a good idea if we were to go ahead and givewinloop
a try with this amazing software.If you need any benchmarks, I have them in the readme of my github repository and on pypi.
Where do we use winloop?
The only place it would have to be implemented is at the beginning where
theHarvester.py
file is located because at the end of the day it's using window's C APIs instead of any Posix Only Apis. My idea is to try and import the winloop module after freezing multiprocessesing before falling back to using the SelectorEventLoopPolicy if winloop is unavalible or for anyone who doesn't have windows C/C++ libraries installed yet. That way those who don't want to install the C/C++ libraries can still use TheHarvester. But for those who have the C/C++ Extensions can have some performance benefits.The Plan
Here is where I would like this to go/be and how it should go about being implemented.
Expected Outcome
I hope that by implementing this feature we can start to see faster performance and acceleration for windows users and that the speed will help benefit the tcp connections made as well as the dns lookups and hopefully there will be less drag and lag when it's collecting things and maybe some improvements with taking screenshots of specific sites.
The Systems/OS In Question
Nothing more and nothing less :)
The Python Package and Github Repository
P.S. I'm also the developer of Winloop. If you have any problems with using this library you can forward those issues to my repository I'll be happy to take a look at them and try and solve any issues arising from it.
The text was updated successfully, but these errors were encountered: