mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
Merge branch 'n1073645-ICOextractor'
This commit is contained in:
commit
5e771c521c
1 changed files with 27 additions and 1 deletions
|
@ -280,7 +280,7 @@ export const FILE_SIGNATURES = {
|
||||||
9: 0x0,
|
9: 0x0,
|
||||||
10: [0x0, 0x1]
|
10: [0x0, 0x1]
|
||||||
},
|
},
|
||||||
extractor: null
|
extractor: extractICO
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Radiance High Dynamic Range image",
|
name: "Radiance High Dynamic Range image",
|
||||||
|
@ -2933,6 +2933,32 @@ export function extractBMP(bytes, offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ICO extractor.
|
||||||
|
*
|
||||||
|
* @param {Uint8Array} bytes
|
||||||
|
* @param {number} offset
|
||||||
|
*/
|
||||||
|
export function extractICO(bytes, offset) {
|
||||||
|
const stream = new Stream(bytes.slice(offset));
|
||||||
|
|
||||||
|
// Move to number of files there are.
|
||||||
|
stream.moveTo(4);
|
||||||
|
|
||||||
|
// Read the number of files stored in the ICO
|
||||||
|
const numberFiles = stream.readInt(2, "le");
|
||||||
|
|
||||||
|
// Move forward to the last file header.
|
||||||
|
stream.moveForwardsBy(8 + ((numberFiles-1) * 16));
|
||||||
|
const fileSize = stream.readInt(4, "le");
|
||||||
|
const fileOffset = stream.readInt(4, "le");
|
||||||
|
|
||||||
|
// Move to the end of the last file.
|
||||||
|
stream.moveTo(fileOffset + fileSize);
|
||||||
|
return stream.carve();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WAV extractor.
|
* WAV extractor.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue