Skip to content

Commit

Permalink
Update Cease to Breathe fix
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
R1kaB3rN committed Apr 7, 2024
1 parent 1690b76 commit 091aecf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gamefixes-steam/1873170.py
Expand Up @@ -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])
Expand Down

0 comments on commit 091aecf

Please sign in to comment.