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':