#1383 #1487 fix zoomeyesearch.py

This commit is contained in:
yoonthegoon 2023-07-23 21:07:43 -04:00
parent 747592450b
commit 2579d60e50
2 changed files with 7 additions and 7 deletions

View file

@ -28,7 +28,7 @@ def __init__(self, word, limit) -> None:
# Regex used is directly from: https://github.com/GerbenJavado/LinkFinder/blob/master/linkfinder.py#L29
# Maybe one day it will be a pip package
# Regardless LinkFinder is an amazing tool!
self.iurl_regex = r"""
regex_str = r"""
(?:"|') # Start newline delimiter
(
((?:[a-zA-Z]{1,10}://|//) # Match a scheme [a-Z]*1-10 or //
@ -55,7 +55,7 @@ def __init__(self, word, limit) -> None:
)
(?:"|') # End newline delimiter
"""
self.iurl_regex = re.compile(self.iurl_regex, re.VERBOSE)
self.iurl_regex = re.compile(regex_str, re.VERBOSE)
async def fetch_subdomains(self) -> None:
# Based on docs from: https://www.zoomeye.org/doc#search-sub-domain-ip

View file

@ -4,7 +4,7 @@
import asyncio
import random
import ssl
from typing import Any, List, Tuple, Union
from typing import Any, List, Sized, Tuple, Union
import aiohttp
import certifi
@ -336,7 +336,7 @@ async def post_fetch(
@classmethod
async def fetch(
cls, session, url, params: str = "", json: bool = False, proxy: str = ""
cls, session, url, params: Sized = "", json: bool = False, proxy: str = ""
) -> Union[str, dict, list, bool]:
# This fetch method solely focuses on get requests
try:
@ -344,7 +344,7 @@ async def fetch(
# This fetch method solely focuses on get requests
if proxy != "":
proxy = str(random.choice(cls().proxy_list))
if params != "":
if len(params) != 0:
sslcontext = ssl.create_default_context(cafile=certifi.where())
async with session.get(
url, ssl=sslcontext, params=params, proxy=proxy
@ -366,7 +366,7 @@ async def fetch(
else await response.json()
)
if params != "":
if len(params) != 0:
sslcontext = ssl.create_default_context(cafile=certifi.where())
async with session.get(url, ssl=sslcontext, params=params) as response:
await asyncio.sleep(5)
@ -431,7 +431,7 @@ async def fetch_all(
cls,
urls,
headers: dict[str, str] = {},
params: str = "",
params: Sized = "",
json: bool = False,
takeover: bool = False,
proxy: bool = False,