mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
MP3 Extractor
This commit is contained in:
parent
cecae671d8
commit
ff585584f6
1 changed files with 25 additions and 1 deletions
|
@ -780,7 +780,7 @@ export const FILE_SIGNATURES = {
|
||||||
1: 0xfb
|
1: 0xfb
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
extractor: null
|
extractor: extractMP3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "MPEG-4 Part 14 audio",
|
name: "MPEG-4 Part 14 audio",
|
||||||
|
@ -3067,6 +3067,30 @@ export function extractWAV(bytes, offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MP3 extractor.
|
||||||
|
*
|
||||||
|
* @param {Uint8Array} bytes
|
||||||
|
* @param {Number} offset
|
||||||
|
* @returns {Uint8Array}
|
||||||
|
*/
|
||||||
|
export function extractMP3(bytes, offset) {
|
||||||
|
const stream = new Stream(bytes.slice(offset));
|
||||||
|
|
||||||
|
if (stream.readInt(1) === 0xff) {
|
||||||
|
console.log("gggg");
|
||||||
|
} else if (stream.getBytes(3) === [0x49, 0x44, 0x33]) {
|
||||||
|
stream.moveTo(6);
|
||||||
|
const tagSize = (stream.readInt(1)<<23) | (stream.readInt(1)<<15) | (stream.readInt(1)<<7) | stream.readInt(1);
|
||||||
|
stream.moveForwardsBy(tagSize);
|
||||||
|
|
||||||
|
if (stream.getBytes(4) !== [0xff, 0xfb, 0x30, 0xc4])
|
||||||
|
console.log("always bad");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FLV extractor.
|
* FLV extractor.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue