From dc9819ecb5844fa0d95b7b0cb59a0388ef9a2b45 Mon Sep 17 00:00:00 2001 From: "ErnestsLavrinovicsalias]" Date: Wed, 18 Jan 2023 18:02:17 +0100 Subject: [PATCH] Add workaround for out-of-order certificates --- OpenAttack/utils/zip_downloader.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenAttack/utils/zip_downloader.py b/OpenAttack/utils/zip_downloader.py index 639e5ce9..0115c463 100644 --- a/OpenAttack/utils/zip_downloader.py +++ b/OpenAttack/utils/zip_downloader.py @@ -2,7 +2,7 @@ import zipfile import os from tqdm import tqdm - +import ssl def make_zip_downloader(URL : str, file_list=None, resource_name = None): """ @@ -28,7 +28,11 @@ def DOWNLOAD(path : str, source : str): else: name = resource_name - with urllib.request.urlopen(remote_url) as fin: + ctx = ssl.create_default_context() + ctx.check_hostname = False + ctx.verify_mode = ssl.CERT_NONE + + with urllib.request.urlopen(remote_url, context=ctx) as fin: CHUNK_SIZE = 4 * 1024 total_length = int(fin.headers["content-length"]) with open(path + ".zip", "wb") as ftmp: