Skip to content

Commit

Permalink
Update ECODFF to 2.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye116477 committed Sep 16, 2023
1 parent 4e888fb commit adfdd19
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/ECODFF.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import git

# Version number
SCRIPT_VERSION = "2.0.12"
SCRIPT_VERSION = "2.0.13"

# Parse arguments
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -279,13 +279,15 @@ async def get_status_code(session: aiohttp.ClientSession, url: str, limit):
print("Checking the status of domains...")
resp = await session.head(f"http://{url}")
status_code = resp.status
if status_code == "301":
if status_code == 301:
print("Checking the status of domains...")
resp = await session.head(f"https://{url}")
status_code = resp.status
except (aiohttp.ClientConnectorError, asyncio.TimeoutError, aiohttp.ClientOSError) as e:
print(e)
except aiohttp.ClientConnectorError as ex:
print(ex)
status_code = "000"
except (aiohttp.ClientOSError, asyncio.TimeoutError) as ex2:
print(ex2)
finally:
result = ""
if "status_code" in locals():
Expand All @@ -296,7 +298,8 @@ async def save_status_code(timeout_time, limit_value):
session_timeout = aiohttp.ClientTimeout(
total=None, sock_connect=timeout_time, sock_read=timeout_time)
limit = asyncio.Semaphore(limit_value)
async with aiohttp.ClientSession(timeout=session_timeout) as session:
resolver = aiohttp.AsyncResolver(nameservers=["1.1.1.1", "1.0.0.1"])
async with aiohttp.ClientSession(timeout=session_timeout, connector=aiohttp.TCPConnector(resolver=resolver)) as session:
statuses = await asyncio.gather(*[get_status_code(session, url, limit) for url in unknown_pages])
with open(UNKNOWN_FILE, 'w', encoding="utf-8") as u_f:
for status in statuses:
Expand Down

0 comments on commit adfdd19

Please sign in to comment.