From 02a952675266a929041589431684df794066458e Mon Sep 17 00:00:00 2001 From: Matthew Ray Date: Sun, 17 May 2020 06:43:52 -0400 Subject: [PATCH] various additions --- src/cscli/main.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/cscli/main.ts b/src/cscli/main.ts index 930f184..daf4695 100644 --- a/src/cscli/main.ts +++ b/src/cscli/main.ts @@ -29,15 +29,13 @@ export default class CSCLI { } public async handle(socket: net.Socket, data: Buffer) { - const parsed: { Username: string, Type: string, Message?: string, HMAC: string } = JSON.parse(data.toString().trim()); - let verificationParsed: any = parsed; - delete verificationParsed.HMAC; - verificationParsed = JSON.stringify(verificationParsed); - const verification = this.verifyConnection(parsed.HMAC, verificationParsed); + const args = data.toString().trim().split('$'); + const verification = this.verifyConnection(args[1], args[0]); if (!verification) { socket.write('UNAUTHORIZED TO EXECUTE ON THIS SERVER\n'); return socket.destroy(); } + const parsed: { Username: string, Type: string, Message?: string, HMAC: string } = JSON.parse(args[1]); // FINISH VERIFICATION CHECKS switch (parsed.Type) { case 'lock':