From 091aecf2b6210f8612a26091baddc053e56f70a5 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Sun, 7 Apr 2024 11:17:24 -0700 Subject: [PATCH] Update Cease to Breathe fix - Prefer hardcoding the digest in the module and comparing it to the computed digest. This way only 1 request is made and can avoid applying the fix when the server gets compromised --- gamefixes-steam/1873170.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamefixes-steam/1873170.py b/gamefixes-steam/1873170.py index dc8a121c..32ee20ba 100644 --- a/gamefixes-steam/1873170.py +++ b/gamefixes-steam/1873170.py @@ -20,12 +20,12 @@ def main(): install_dir = glob.escape(util.get_game_install_path()) if not os.path.isfile(os.path.join(install_dir, 'nw.exe')): url = 'https://dl.nwjs.io/v0.86.0/nwjs-v0.86.0-win-x64.zip' + hashsum = 'ed2681847162e0fa457dd55e293b6f331ccd58acedd934a98e7fe1406c26dd4f' nwjs = os.path.basename(url) urllib.request.urlretrieve(url, nwjs) with open(nwjs, "rb") as f: nwjs_sum = hashlib.sha256(f.read()).hexdigest() - urllib.request.urlretrieve(f"https://dl.nwjs.io/{nwjs.split('-', 2)[1]}/SHASUMS256.txt", 'SHASUMS256.txt') - if subprocess.check_output(f"grep -F '{nwjs}' ./SHASUMS256.txt", shell=True,universal_newlines=True)[:64] == nwjs_sum: + if hashsum == nwjs_sum: with zipfile.ZipFile(nwjs, 'r') as zip_ref: zip_ref.extractall(install_dir) nwjs = os.path.join(install_dir, nwjs.rsplit('.', 1)[0])