diff --git a/theHarvester/discovery/bingsearch.py b/theHarvester/discovery/bingsearch.py index 5d2af02c..f7cf25ae 100644 --- a/theHarvester/discovery/bingsearch.py +++ b/theHarvester/discovery/bingsearch.py @@ -8,7 +8,7 @@ from theHarvester.parsers import myparser class SearchBing: def __init__(self, word, limit, start) -> None: self.word = word.replace(" ", "%20") - self.results: tuple[Any, ...] = () + self.results: list[Any] = [] self.total_results = "" self.server = "www.bing.com" self.apiserver = "api.search.live.net" diff --git a/theHarvester/discovery/takeover.py b/theHarvester/discovery/takeover.py index a33e044f..3a121dbf 100644 --- a/theHarvester/discovery/takeover.py +++ b/theHarvester/discovery/takeover.py @@ -93,11 +93,10 @@ class TakeOver: http_hosts = [f"http://{host}" for host in self.hosts] all_hosts = https_hosts + http_hosts shuffle(all_hosts) - tup_resps = await AsyncFetcher.fetch_all( + resps: list = await AsyncFetcher.fetch_all( all_hosts, takeover=True, proxy=self.proxy ) - tup_resps = tuple(tup for tup in tup_resps if len(tup[1]) >= 1) - for url, resp in tup_resps: + for url, resp in tuple(resp for resp in resps if len(resp[1]) >= 1): await self.check(url, resp) else: return diff --git a/theHarvester/lib/core.py b/theHarvester/lib/core.py index 9c7e41c0..2aeea935 100644 --- a/theHarvester/lib/core.py +++ b/theHarvester/lib/core.py @@ -439,7 +439,7 @@ class AsyncFetcher: json: bool = False, takeover: bool = False, proxy: bool = False, - ) -> tuple: + ) -> list: # By default, timeout is 5 minutes; 60 seconds should suffice timeout = aiohttp.ClientTimeout(total=60) if len(headers) == 0: @@ -449,7 +449,7 @@ class AsyncFetcher: headers=headers, timeout=aiohttp.ClientTimeout(total=15) ) as session: if proxy: - tuples = await asyncio.gather( + return await asyncio.gather( *[ AsyncFetcher.takeover_fetch( session, url, proxy=random.choice(cls().proxy_list) @@ -457,19 +457,17 @@ class AsyncFetcher: for url in urls ] ) - return tuples else: - tuples = await asyncio.gather( + return await asyncio.gather( *[AsyncFetcher.takeover_fetch(session, url) for url in urls] ) - return tuples if len(params) == 0: async with aiohttp.ClientSession( headers=headers, timeout=timeout ) as session: if proxy: - texts = await asyncio.gather( + return await asyncio.gather( *[ AsyncFetcher.fetch( session, @@ -480,19 +478,17 @@ class AsyncFetcher: for url in urls ] ) - return texts else: - texts = await asyncio.gather( + return await asyncio.gather( *[AsyncFetcher.fetch(session, url, json=json) for url in urls] ) - return texts else: # Indicates the request has certain params async with aiohttp.ClientSession( headers=headers, timeout=timeout ) as session: if proxy: - texts = await asyncio.gather( + return await asyncio.gather( *[ AsyncFetcher.fetch( session, @@ -504,12 +500,10 @@ class AsyncFetcher: for url in urls ] ) - return texts else: - texts = await asyncio.gather( + return await asyncio.gather( *[ AsyncFetcher.fetch(session, url, params, json) for url in urls ] ) - return texts