1
0
Fork 0

various additions

refactor/models
Matthew 2020-05-17 06:43:52 -04:00
parent fb82ee1a60
commit 02a9526752
No known key found for this signature in database
GPG Key ID: D499B75C1390E321
1 changed files with 3 additions and 5 deletions

View File

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