From a69a90e2f5970efb23dba5ca900e9624b35cfa36 Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Thu, 8 Jul 2021 23:04:56 +0200 Subject: 21.07 (2) --- app.js | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) (limited to 'app.js') diff --git a/app.js b/app.js index c82f9bd..3135b2c 100644 --- a/app.js +++ b/app.js @@ -320,23 +320,65 @@ const { app, BrowserWindow } = require('electron'); console.log(" * Checking signatures"); sigdb = require("./bin/signatures.json"); - total = Object.keys(sigdb).length; + total = Object.keys(sigdb["v1"]).length * 3; processed = 0; - for (file in sigdb) { + for (file in sigdb["v1"]) { if (fs.existsSync(file)) { try { hash = require('crypto').createHash('sha512').update(fs.readFileSync(file)).digest('base64'); - if (hash !== sigdb[file]) { + if (hash !== sigdb["v1"][file]) { require('electron').dialog.showMessageBoxSync( { type: "warning", title: "Source modification detected", - message: "File " + file + " has been flagged as modified. If this is normal, please run the signing process again.\n\nExpected: " + sigdb[file] + "\nGot: " + hash + "\n\nYou are running a modified version of Kartik, do not expect to get support!" + message: "File " + file + " has been flagged as modified (signing V1). If this is normal, please run the signing process again.\n\nExpected: " + sigdb["v1"][file] + "\nGot: " + hash + "\n\nYou are running a modified version of Kartik, do not expect to get support!" } ) } } catch (e) { - console.warn(" ! Could not compute hash for " + file); + console.warn(" ! Could not V1 compute hash for " + file); + } + } + + processed++; + load.webContents.send('progress', (processed/total)*100); + } + for (file in sigdb["v2"]) { + if (fs.existsSync(file)) { + try { + hash = require('crypto').createHash('sha1').update(fs.readFileSync(file)).digest('base64'); + if (hash !== sigdb["v2"][file]) { + require('electron').dialog.showMessageBoxSync( + { + type: "warning", + title: "Source modification detected", + message: "File " + file + " has been flagged as modified (signing V2). If this is normal, please run the signing process again.\n\nExpected: " + sigdb["v2"][file] + "\nGot: " + hash + "\n\nYou are running a modified version of Kartik, do not expect to get support!" + } + ) + } + } catch (e) { + console.warn(" ! Could not compute V2 hash for " + file); + } + } + + processed++; + load.webContents.send('progress', (processed/total)*100); + } + for (file in sigdb["v3"]) { + if (fs.existsSync(file)) { + try { + hash = require('crypto').createHash('md5').update(fs.readFileSync(file)).digest('base64'); + if (hash !== sigdb["v3"][file]) { + require('electron').dialog.showMessageBoxSync( + { + type: "warning", + title: "Source modification detected", + message: "File " + file + " has been flagged as modified (signing V3). If this is normal, please run the signing process again.\n\nExpected: " + sigdb["v3"][file] + "\nGot: " + hash + "\n\nYou are running a modified version of Kartik, do not expect to get support!" + } + ) + } + } catch (e) { + console.warn(" ! Could not compute V3 hash for " + file); } } -- cgit