mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Made TAR extractor and MACHO signature more robust
This commit is contained in:
parent
acf5c733c2
commit
e1cb62848c
1 changed files with 11 additions and 2 deletions
|
@ -1297,7 +1297,12 @@ export const FILE_SIGNATURES = {
|
||||||
0: 0xce,
|
0: 0xce,
|
||||||
1: 0xfa,
|
1: 0xfa,
|
||||||
2: 0xed,
|
2: 0xed,
|
||||||
3: 0xfe
|
3: 0xfe,
|
||||||
|
4: 0x07,
|
||||||
|
5: 0x00,
|
||||||
|
6: 0x00,
|
||||||
|
7: 0x00,
|
||||||
|
8: 0x03
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
extractor: extractMACHO
|
extractor: extractMACHO
|
||||||
|
@ -2850,8 +2855,12 @@ export function extractTAR(bytes, offset) {
|
||||||
|
|
||||||
// Move to ustar identifier.
|
// Move to ustar identifier.
|
||||||
stream.moveForwardsBy(0x101);
|
stream.moveForwardsBy(0x101);
|
||||||
if (stream.getBytes(5).join("") !== [0x75, 0x73, 0x74, 0x61, 0x72].join(""))
|
if (stream.getBytes(5).join("") !== [0x75, 0x73, 0x74, 0x61, 0x72].join("")) {
|
||||||
|
|
||||||
|
// This is needed since if it were not here it relies on there being at least 0x106 padding of 0s at the end of the TAR
|
||||||
|
stream.moveBackwardsBy(0x101);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Move back to file size field.
|
// Move back to file size field.
|
||||||
stream.moveBackwardsBy(0x8a);
|
stream.moveBackwardsBy(0x8a);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue