MCPcopy
hub / github.com/gchq/CyberChef / extractICO

Function extractICO

src/core/lib/FileSignatures.mjs:3109–3126  ·  view source on GitHub ↗
(bytes, offset)

Source from the content-addressed store, hash-verified

3107 * @param {number} offset
3108 */
3109export function extractICO(bytes, offset) {
3110 const stream = new Stream(bytes.slice(offset));
3111
3112 // Move to number of files there are.
3113 stream.moveTo(4);
3114
3115 // Read the number of files stored in the ICO
3116 const numberFiles = stream.readInt(2, "le");
3117
3118 // Move forward to the last file header.
3119 stream.moveForwardsBy(8 + ((numberFiles-1) * 16));
3120 const fileSize = stream.readInt(4, "le");
3121 const fileOffset = stream.readInt(4, "le");
3122
3123 // Move to the end of the last file.
3124 stream.moveTo(fileOffset + fileSize);
3125 return stream.carve();
3126}
3127
3128
3129/**

Callers

nothing calls this directly

Calls 4

moveToMethod · 0.95
readIntMethod · 0.95
moveForwardsByMethod · 0.95
carveMethod · 0.95

Tested by

no test coverage detected