mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
fix linting
This commit is contained in:
parent
eda9a40aa2
commit
a0546c8a3d
2 changed files with 22 additions and 14 deletions
|
@ -116,16 +116,22 @@ class Protobuf {
|
||||||
return this.mergeDecodes(input);
|
return this.mergeDecodes(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse Protobuf stream data
|
||||||
|
* @param {byteArray} input
|
||||||
|
* @param {any[]} args
|
||||||
|
* @returns {any[]}
|
||||||
|
*/
|
||||||
static decodeStream(input, args) {
|
static decodeStream(input, args) {
|
||||||
this.updateProtoRoot(args[0]);
|
this.updateProtoRoot(args[0]);
|
||||||
this.showUnknownFields = args[1];
|
this.showUnknownFields = args[1];
|
||||||
this.showTypes = args[2];
|
this.showTypes = args[2];
|
||||||
|
|
||||||
let streams = new Protobuf(input);
|
const streams = new Protobuf(input);
|
||||||
let output = [];
|
const output = [];
|
||||||
let objLength = streams._varInt();
|
let objLength = streams._varInt();
|
||||||
while (!isNaN(objLength) && objLength > 0) {
|
while (!isNaN(objLength) && objLength > 0) {
|
||||||
let subData = streams.data.slice(streams.offset, streams.offset + objLength);
|
const subData = streams.data.slice(streams.offset, streams.offset + objLength);
|
||||||
output.push(this.mergeDecodes(subData));
|
output.push(this.mergeDecodes(subData));
|
||||||
streams.offset += objLength;
|
streams.offset += objLength;
|
||||||
objLength = streams._varInt();
|
objLength = streams._varInt();
|
||||||
|
|
|
@ -306,18 +306,20 @@ TestRegister.addTests([
|
||||||
{
|
{
|
||||||
name: "Protobuf Stream Decode: no schema",
|
name: "Protobuf Stream Decode: no schema",
|
||||||
input: "0d081c1203596f751a024d65202b0c0a0a0a066162633132331200",
|
input: "0d081c1203596f751a024d65202b0c0a0a0a066162633132331200",
|
||||||
expectedOutput: JSON.stringify([{
|
expectedOutput: JSON.stringify([
|
||||||
"1": 28,
|
{
|
||||||
"2": "You",
|
"1": 28,
|
||||||
"3": "Me",
|
"2": "You",
|
||||||
"4": 43
|
"3": "Me",
|
||||||
},
|
"4": 43
|
||||||
{
|
},
|
||||||
"1": {
|
{
|
||||||
"1": "abc123",
|
"1": {
|
||||||
"2": {}
|
"1": "abc123",
|
||||||
|
"2": {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}], null, 4),
|
], null, 4),
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
"op": "From Hex",
|
"op": "From Hex",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue