NodeJS Packet Function

Posts 1–3 of 3 · Page 1 of 1
NodeJS Packet Function
Thought I would release this to help you out

Since NodeJS is so popular and cross platform thought you would need it you can use this to decrypt and send the packets

Code:
function EncryptDecrypt(data) {
    let numArray = Buffer.from([ 250, 158, 179]);
    for (var i = 0; i < data.length; i++) {
        if (data[i] != numArray[i % numArray.length]) {
            data[i] = (data[i] ^ numArray[i % numArray.length]);
        }
    }
    return data;
}

function SendMessage(message, type=255, cmd=255){
    message = Buffer.from(message);
    let length = message.length;
    let bArray = Buffer.alloc(length + 3);
    bArray[0] = type;
    bArray[1] = cmd;
    message.copy(bArray, 2);
    EncryptDecrypt(bArray);
    bArray[length + 2] = 0;
    return bArray;
}
I have no idea what this is
How to use this code?
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us