forked from engineering/cloudservices
various additions
parent
fb82ee1a60
commit
02a9526752
|
@ -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':
|
||||
|
|
Loading…
Reference in New Issue