diff options
author | Minteck <46352972+Minteck@users.noreply.github.com> | 2021-07-08 23:04:56 +0200 |
---|---|---|
committer | Minteck <46352972+Minteck@users.noreply.github.com> | 2021-07-08 23:04:56 +0200 |
commit | a69a90e2f5970efb23dba5ca900e9624b35cfa36 (patch) | |
tree | 199819c1537d2f1d8d7c0c97d113e619a683c660 | |
parent | f3e78ef8dbf6d89999fdfe1a4022ef97c67a7514 (diff) | |
download | kartik-client-a69a90e2f5970efb23dba5ca900e9624b35cfa36.tar.gz kartik-client-a69a90e2f5970efb23dba5ca900e9624b35cfa36.tar.bz2 kartik-client-a69a90e2f5970efb23dba5ca900e9624b35cfa36.zip |
21.07 (2)
-rw-r--r-- | app.js | 52 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | signing/sign.js | 20 |
3 files changed, 63 insertions, 11 deletions
@@ -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); } } diff --git a/package.json b/package.json index 0ac3efe..8dbdbb4 100644 --- a/package.json +++ b/package.json @@ -1 +1 @@ -{"name":"kartik","version":"adabd5f","channel":"git","description":"A multiplatform 2D karting game","main":"app.js","dependencies":{"@electron/remote":"^1.0.4","discord-rpc":"^3.2.0","electron":"^12.0.1","ini":"^1.3.8","jquery":"^3.6.0","os-locale":"^5.0.0","systeminformation":"^5.7.7","uuid":"^8.3.2","yaml":"^1.10.2"},"scripts":{"test":"node_modules\\electron\\dist\\electron.exe app.js"},"author":"Minteck Projects","license":"GPL-3.0-or-later","serial":"XXX99999999999"}
\ No newline at end of file +{"name":"kartik","version":"f3e78ef","channel":"git","description":"A multiplatform 2D karting game","main":"app.js","dependencies":{"@electron/remote":"^1.0.4","discord-rpc":"^3.2.0","electron":"^12.0.1","ini":"^1.3.8","jquery":"^3.6.0","os-locale":"^5.0.0","systeminformation":"^5.7.7","uuid":"^8.3.2","yaml":"^1.10.2"},"scripts":{"test":"node_modules\\electron\\dist\\electron.exe app.js"},"author":"Minteck Projects","license":"GPL-3.0-or-later","serial":"XXX99999999999"}
\ No newline at end of file diff --git a/signing/sign.js b/signing/sign.js index 116a6a9..2e1c23d 100644 --- a/signing/sign.js +++ b/signing/sign.js @@ -1,6 +1,10 @@ const fs = require('fs'); const crypto = require('crypto'); -global.sdb = {}; +global.sdb = { + "v1": {}, + "v2": {}, + "v3": {} +}; function scan(start) { rt = fs.readdirSync(start); @@ -10,14 +14,20 @@ function scan(start) { scan(start + "/" + file); } else { sign = crypto.createHash('sha512').update(fs.readFileSync(start + "/" + file)).digest('base64') - console.log("Signed: " + start + "/" + file + ": " + sign); - sdb[(start + "/" + file).substr(1)] = sign; + console.log("Signed (SHA-512): " + start + "/" + file + ": " + sign); + sdb["v1"][(start + "/" + file).substr(1)] = sign; + + sign = crypto.createHash('sha1').update(fs.readFileSync(start + "/" + file)).digest('base64') + console.log("Signed (SHA-1): " + start + "/" + file + ": " + sign); + sdb["v2"][(start + "/" + file).substr(1)] = sign; + + sign = crypto.createHash('md5').update(fs.readFileSync(start + "/" + file)).digest('base64') + console.log("Signed (MD5): " + start + "/" + file + ": " + sign); + sdb["v3"][(start + "/" + file).substr(1)] = sign; } } } } scan(".."); -scan("../node_modules/electron"); -scan("../node_modules/@electron"); fs.writeFileSync("../bin/signatures.json", JSON.stringify(sdb));
\ No newline at end of file |