mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 06:55:08 -04:00
lint
This commit is contained in:
parent
14875dba34
commit
c268891bbf
1 changed files with 6 additions and 6 deletions
|
@ -71,7 +71,7 @@ class WebSocketDecode extends Operation {
|
||||||
throw new OperationError(`Expected size: ${(pos + payloadLength + maskSize)}`);
|
throw new OperationError(`Expected size: ${(pos + payloadLength + maskSize)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let maskBytes = Buffer.alloc(4);
|
const maskBytes = Buffer.alloc(4);
|
||||||
|
|
||||||
if (mask) {
|
if (mask) {
|
||||||
maskBytes[0] = buf[pos];
|
maskBytes[0] = buf[pos];
|
||||||
|
@ -81,10 +81,10 @@ class WebSocketDecode extends Operation {
|
||||||
pos += 4;
|
pos += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
let payload = buf.slice(pos, buf.length);
|
const payload = buf.slice(pos, buf.length);
|
||||||
|
|
||||||
if (mask) {
|
if (mask) {
|
||||||
for(var i = 0; i < payload.length; i++) {
|
for (let i = 0; i < payload.length; i++) {
|
||||||
payload[i] = payload[i] ^ maskBytes[i % 4];
|
payload[i] = payload[i] ^ maskBytes[i % 4];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,14 +94,14 @@ class WebSocketDecode extends Operation {
|
||||||
if ((b0 & 1) === 1) {
|
if ((b0 & 1) === 1) {
|
||||||
content = payload.toString();
|
content = payload.toString();
|
||||||
} else {
|
} else {
|
||||||
content = payload.toString('hex');
|
content = payload.toString("hex");
|
||||||
}
|
}
|
||||||
|
|
||||||
const ws = {
|
const ws = {
|
||||||
fin: fin,
|
fin: fin,
|
||||||
opcode: opcode,
|
opcode: opcode,
|
||||||
mask_present: mask,
|
maskPresent: mask,
|
||||||
mask: maskBytes.toString('hex'),
|
mask: maskBytes.toString("hex"),
|
||||||
payloadLength: payloadLength,
|
payloadLength: payloadLength,
|
||||||
payload: content
|
payload: content
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue