various additions
parent
fb82ee1a60
commit
02a9526752
|
@ -29,15 +29,13 @@ export default class CSCLI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async handle(socket: net.Socket, data: Buffer) {
|
public async handle(socket: net.Socket, data: Buffer) {
|
||||||
const parsed: { Username: string, Type: string, Message?: string, HMAC: string } = JSON.parse(data.toString().trim());
|
const args = data.toString().trim().split('$');
|
||||||
let verificationParsed: any = parsed;
|
const verification = this.verifyConnection(args[1], args[0]);
|
||||||
delete verificationParsed.HMAC;
|
|
||||||
verificationParsed = JSON.stringify(verificationParsed);
|
|
||||||
const verification = this.verifyConnection(parsed.HMAC, verificationParsed);
|
|
||||||
if (!verification) {
|
if (!verification) {
|
||||||
socket.write('UNAUTHORIZED TO EXECUTE ON THIS SERVER\n');
|
socket.write('UNAUTHORIZED TO EXECUTE ON THIS SERVER\n');
|
||||||
return socket.destroy();
|
return socket.destroy();
|
||||||
}
|
}
|
||||||
|
const parsed: { Username: string, Type: string, Message?: string, HMAC: string } = JSON.parse(args[1]);
|
||||||
// FINISH VERIFICATION CHECKS
|
// FINISH VERIFICATION CHECKS
|
||||||
switch (parsed.Type) {
|
switch (parsed.Type) {
|
||||||
case 'lock':
|
case 'lock':
|
||||||
|
|
Loading…
Reference in New Issue