From 02933f16ecc3d9069314f2223d39e07b13834fe9 Mon Sep 17 00:00:00 2001 From: mxrch Date: Sat, 24 Jun 2023 00:42:53 +0200 Subject: [PATCH] Added Windows support --- aiodnsbrute/cli.py | 10 +++++++--- main.py | 1 + setup.py | 8 +++++++- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 main.py diff --git a/aiodnsbrute/cli.py b/aiodnsbrute/cli.py index 706b1f3..1eb89a1 100644 --- a/aiodnsbrute/cli.py +++ b/aiodnsbrute/cli.py @@ -3,14 +3,18 @@ import asyncio import functools import os -import uvloop import aiodns import click import socket -import sys from tqdm import tqdm from aiodnsbrute.logger import ConsoleLogger +import platform +if platform.system() == "Windows": + import winloop +else: + import uvloop + class aioDNSBrute(object): """aiodnsbrute implements fast domain name brute forcing using Python's asyncio module.""" @@ -26,7 +30,7 @@ def __init__(self, verbosity=0, max_tasks=512): self.errors = [] self.fqdn = [] self.ignore_hosts = [] - asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) + asyncio.set_event_loop_policy(winloop.WinLoopPolicy() if platform.system() == "Windows" else uvloop.EventLoopPolicy()) self.loop = asyncio.get_event_loop() self.resolver = aiodns.DNSResolver(loop=self.loop, rotate=True) self.sem = asyncio.BoundedSemaphore(max_tasks) diff --git a/main.py b/main.py new file mode 100644 index 0000000..990792a --- /dev/null +++ b/main.py @@ -0,0 +1 @@ +from aiodnsbrute.cli import main; main() \ No newline at end of file diff --git a/setup.py b/setup.py index 81c90f2..7d58199 100644 --- a/setup.py +++ b/setup.py @@ -2,8 +2,14 @@ Brute force DNS domain names asynchronously """ from setuptools import find_packages, setup +import platform -dependencies = ['click', 'asyncio', 'uvloop', 'tqdm', 'aiodns'] +dependencies = ['click', 'asyncio', 'tqdm', 'aiodns'] + +if platform.system() == "Windows": + dependencies.append('winloop') +else: + dependencies.append('uvloop') setup( name='aiodnsbrute',