From f7d0a17afccf505e10af6817ac7a20b2357f421d Mon Sep 17 00:00:00 2001 From: 7cc5c4f330d47060 Date: Fri, 6 Sep 2024 16:55:01 -0400 Subject: [PATCH] Add uuid to hash --- plugins/command.js | 2 +- util/hashcheck.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/command.js b/plugins/command.js index 604aaaf..03aa441 100755 --- a/plugins/command.js +++ b/plugins/command.js @@ -38,7 +38,7 @@ module.exports = { b.lastCmd = Date.now() const cmd = text.split(' ') const lang = settings.defaultLang - const verify = hashcheck(cmd) + const verify = hashcheck(cmd, uuid) if (verify > 0) { text = cmd.slice(0, cmd.length - 1).join(' ') } diff --git a/util/hashcheck.js b/util/hashcheck.js index 7934bd4..e0c1dc8 100644 --- a/util/hashcheck.js +++ b/util/hashcheck.js @@ -1,11 +1,11 @@ const crypto = require('crypto') const secret = require('../secret.json') -module.exports = function (cmd) { +module.exports = function (cmd, uuid) { const cmdWithoutHash = cmd.slice(0, cmd.length - 1).join(' ') const _dateString = Date.now().toString() const dateString = _dateString.slice(0, _dateString.length - 4) - const hashTrusted = `babyboom:${secret.keyTrusted}:${cmdWithoutHash}:${dateString}` - const hashOwner = `babyboom:${secret.keyOwner}:${cmdWithoutHash}:${dateString}` + const hashTrusted = `babyboom:${secret.keyTrusted}:${uuid}:${cmdWithoutHash}:${dateString}` + const hashOwner = `babyboom:${secret.keyOwner}:${uuid}:${cmdWithoutHash}:${dateString}` const validhashT = crypto.createHash('sha256').update(hashTrusted).digest('hex') const validhashO = crypto.createHash('sha256').update(hashOwner).digest('hex') if (cmd[cmd.length - 1] === validhashT) {