From 802b8311a7e639c99104884bcad7f6a5adc2e7c5 Mon Sep 17 00:00:00 2001 From: "tv0924@icloud.com" Date: Mon, 2 Jun 2025 20:24:00 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20=EC=97=AC=EB=9F=AC=20url=EC=9D=84=20?= =?UTF-8?q?=EC=97=B0=EC=86=8D=EC=9C=BC=EB=A1=9C=20=EB=8F=8C=EB=A6=B4=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/is_html.py | 29 +++++++++-------------------- main.py | 3 ++- oauth_providers.csv | 3 +++ 3 files changed, 14 insertions(+), 21 deletions(-) create mode 100644 oauth_providers.csv diff --git a/lib/is_html.py b/lib/is_html.py index fe8dcfd..495af22 100644 --- a/lib/is_html.py +++ b/lib/is_html.py @@ -9,28 +9,17 @@ def is_html_url(url: str, timeout: float = 10.0) -> bool: 반환값: - Content-Type이 'text/html' 로 시작하면 True, 그렇지 않으면 False """ - + try: - # HEAD 요청으로 헤더만 가져와도 충분하지만, 일부 서버에서 HEAD를 허용하지 않을 수 있어 - # GET 요청을 사용해도 무방합니다. 단, GET은 바디를 가져오기 때문에 HEAD보다 비용이 높을 수 있음. - response = requests.head(url, timeout=timeout, allow_redirects=True) + with requests.get(url, timeout=timeout, stream=True) as response: + # 응답 코드가 200번대가 아니면 False로 간주 + if not response.ok: + return False - # 만약 HEAD 요청에 실패하거나 서버가 405(Method Not Allowed)를 반환하면, GET 요청으로 재시도 - if response.status_code == 405: - response = requests.get(url, timeout=timeout, stream=True) - - # 응답 코드가 200번대가 아니면 False로 간주 - if not response.ok: - return False - - content_type = response.headers.get('Content-Type', '') - # Content-Type에 'text/html'이 포함되어 있으면 HTML로 간주 - return content_type.lower().startswith('text/html') - - except requests.RequestException as e: - # 네트워크 오류, 타임아웃 등 예외 발생 시 False 반환 - # 필요하다면 로그를 찍거나 예외를 다시 던질 수 있습니다. - print(f"Error fetching URL: {e}") + content_type = response.headers.get('Content-Type', '') + # Content-Type에 'text/html'이 포함되어 있으면 HTML로 간주 + return content_type.lower().startswith('text/html') + except requests.RequestException: return False if __name__ == '__main__': diff --git a/main.py b/main.py index e1c2178..6aaf17f 100644 --- a/main.py +++ b/main.py @@ -171,7 +171,8 @@ async def loop(): "wildwoodcasino.net", "accounts.firefox.com", "addons.allizom.org", -"api.profiler.firefox.com"] +"api.profiler.firefox.com" +] for url in target_list: await scan_one_url(f'https://{url}') diff --git a/oauth_providers.csv b/oauth_providers.csv new file mode 100644 index 0000000..0f35c83 --- /dev/null +++ b/oauth_providers.csv @@ -0,0 +1,3 @@ +issuer,provider,oauth_uri +https://velog.io,Google,https://v3.velog.io/api/auth/v3/social/callback/google +https://velog.io,GitHub,https://v2.velog.io/api/v2/auth/social/callback/github?next=