cyberchef 10.22.0 → 10.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +131 -0
- package/CONTRIBUTING.md +37 -0
- package/Dockerfile +2 -0
- package/Gruntfile.js +0 -12
- package/README.md +1 -1
- package/babel.config.js +0 -6
- package/package.json +63 -62
- package/src/core/Chef.mjs +8 -1
- package/src/core/Ingredient.mjs +5 -2
- package/src/core/Operation.mjs +6 -1
- package/src/core/Recipe.mjs +10 -5
- package/src/core/config/Categories.json +18 -3
- package/src/core/config/OperationConfig.json +22310 -0
- package/src/core/config/modules/Bletchley.mjs +28 -0
- package/src/core/config/modules/Charts.mjs +24 -0
- package/src/core/config/modules/Ciphers.mjs +128 -0
- package/src/core/config/modules/Code.mjs +60 -0
- package/src/core/config/modules/Compression.mjs +52 -0
- package/src/core/config/modules/Crypto.mjs +134 -0
- package/src/core/config/modules/Default.mjs +424 -0
- package/src/core/config/modules/Diff.mjs +16 -0
- package/src/core/config/modules/Encodings.mjs +42 -0
- package/src/core/config/modules/Handlebars.mjs +16 -0
- package/src/core/config/modules/Hashing.mjs +30 -0
- package/src/core/config/modules/Image.mjs +70 -0
- package/src/core/config/modules/Jq.mjs +16 -0
- package/src/core/config/modules/OCR.mjs +16 -0
- package/src/core/config/modules/OpModules.mjs +63 -0
- package/src/core/config/modules/PGP.mjs +26 -0
- package/src/core/config/modules/Protobuf.mjs +18 -0
- package/src/core/config/modules/PublicKey.mjs +36 -0
- package/src/core/config/modules/Regex.mjs +40 -0
- package/src/core/config/modules/Serialise.mjs +26 -0
- package/src/core/config/modules/Shellcode.mjs +18 -0
- package/src/core/config/modules/URL.mjs +20 -0
- package/src/core/config/modules/UserAgent.mjs +16 -0
- package/src/core/config/modules/Yara.mjs +16 -0
- package/src/core/lib/AudioBytes.mjs +103 -0
- package/src/core/lib/AudioMetaSchema.mjs +82 -0
- package/src/core/lib/AudioParsers.mjs +630 -0
- package/src/core/lib/BigIntUtils.mjs +73 -0
- package/src/core/lib/Modhex.mjs +2 -0
- package/src/core/lib/QRCode.mjs +30 -10
- package/src/core/lib/RC6.mjs +625 -0
- package/src/core/operations/A1Z26CipherDecode.mjs +1 -1
- package/src/core/operations/AddTextToImage.mjs +116 -64
- package/src/core/operations/BlurImage.mjs +10 -12
- package/src/core/operations/ContainImage.mjs +50 -40
- package/src/core/operations/ConvertImageFormat.mjs +33 -39
- package/src/core/operations/CoverImage.mjs +39 -37
- package/src/core/operations/CropImage.mjs +35 -21
- package/src/core/operations/DisassembleARM.mjs +193 -0
- package/src/core/operations/DitherImage.mjs +8 -8
- package/src/core/operations/EscapeUnicodeCharacters.mjs +0 -17
- package/src/core/operations/ExtractAudioMetadata.mjs +175 -0
- package/src/core/operations/ExtractLSB.mjs +17 -11
- package/src/core/operations/ExtractRGBA.mjs +12 -10
- package/src/core/operations/FlaskSessionDecode.mjs +80 -0
- package/src/core/operations/FlaskSessionSign.mjs +89 -0
- package/src/core/operations/FlaskSessionVerify.mjs +136 -0
- package/src/core/operations/FlipImage.mjs +14 -10
- package/src/core/operations/GenerateImage.mjs +39 -32
- package/src/core/operations/ImageBrightnessContrast.mjs +10 -10
- package/src/core/operations/ImageFilter.mjs +14 -13
- package/src/core/operations/ImageHueSaturationLightness.mjs +22 -20
- package/src/core/operations/ImageOpacity.mjs +6 -8
- package/src/core/operations/InvertImage.mjs +4 -6
- package/src/core/operations/Jq.mjs +12 -4
- package/src/core/operations/NormaliseImage.mjs +5 -7
- package/src/core/operations/OffsetChecker.mjs +1 -1
- package/src/core/operations/ParseEthernetFrame.mjs +112 -0
- package/src/core/operations/ParseIPv4Header.mjs +23 -6
- package/src/core/operations/ParseQRCode.mjs +13 -13
- package/src/core/operations/PseudoRandomIntegerGenerator.mjs +164 -0
- package/src/core/operations/RC6Decrypt.mjs +119 -0
- package/src/core/operations/RC6Encrypt.mjs +119 -0
- package/src/core/operations/RandomizeColourPalette.mjs +11 -11
- package/src/core/operations/ResizeImage.mjs +30 -23
- package/src/core/operations/RotateImage.mjs +8 -9
- package/src/core/operations/SQLBeautify.mjs +21 -3
- package/src/core/operations/SharpenImage.mjs +94 -62
- package/src/core/operations/SplitColourChannels.mjs +47 -21
- package/src/core/operations/TextIntegerConverter.mjs +123 -0
- package/src/core/operations/UnescapeUnicodeCharacters.mjs +17 -0
- package/src/core/operations/ViewBitPlane.mjs +16 -20
- package/src/core/operations/index.mjs +960 -0
- package/src/node/index.mjs +2423 -0
- package/src/web/HTMLIngredient.mjs +24 -43
- package/src/web/Manager.mjs +1 -0
- package/src/web/html/index.html +6 -6
- package/src/web/static/fonts/bmfonts/Roboto72White.fnt +491 -485
- package/src/web/static/fonts/bmfonts/RobotoBlack72White.fnt +494 -488
- package/src/web/static/fonts/bmfonts/RobotoMono72White.fnt +110 -103
- package/src/web/static/fonts/bmfonts/RobotoSlab72White.fnt +498 -492
- package/src/web/stylesheets/layout/_banner.css +30 -0
- package/src/web/stylesheets/layout/_modals.css +5 -0
- package/src/web/stylesheets/utils/_overrides.css +7 -0
- package/src/web/waiters/ControlsWaiter.mjs +82 -0
- package/src/web/waiters/InputWaiter.mjs +12 -6
- package/src/web/waiters/RecipeWaiter.mjs +2 -2
- package/tests/browser/02_ops.js +23 -3
- package/tests/node/index.mjs +1 -0
- package/tests/node/tests/lib/BigIntUtils.mjs +150 -0
- package/tests/node/tests/operations.mjs +9 -7
- package/tests/operations/index.mjs +8 -0
- package/tests/operations/tests/A1Z26CipherDecode.mjs +33 -0
- package/tests/operations/tests/DisassembleARM.mjs +377 -0
- package/tests/operations/tests/ExtractAudioMetadata.mjs +287 -0
- package/tests/operations/tests/FlaskSession.mjs +246 -0
- package/tests/operations/tests/GenerateQRCode.mjs +67 -0
- package/tests/operations/tests/JWTSign.mjs +83 -8
- package/tests/operations/tests/Jq.mjs +32 -0
- package/tests/operations/tests/Modhex.mjs +20 -0
- package/tests/operations/tests/ParseEthernetFrame.mjs +45 -0
- package/tests/operations/tests/RC6.mjs +487 -0
- package/tests/operations/tests/SQLBeautify.mjs +54 -0
- package/tests/operations/tests/TextIntegerConverter.mjs +199 -0
- package/tests/samples/Audio.mjs +73 -0
- package/tests/samples/Images.mjs +0 -12
- package/webpack.config.js +10 -7
- package/src/core/lib/ImageManipulation.mjs +0 -251
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
|
|
3
|
+
*
|
|
4
|
+
* Imports all modules for builds which do not load modules separately.
|
|
5
|
+
*
|
|
6
|
+
* @author n1474335 [n1474335@gmail.com]
|
|
7
|
+
* @copyright Crown Copyright 2026
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
import CiphersModule from "./Ciphers.mjs";
|
|
11
|
+
import DefaultModule from "./Default.mjs";
|
|
12
|
+
import EncodingsModule from "./Encodings.mjs";
|
|
13
|
+
import ImageModule from "./Image.mjs";
|
|
14
|
+
import CryptoModule from "./Crypto.mjs";
|
|
15
|
+
import SerialiseModule from "./Serialise.mjs";
|
|
16
|
+
import HashingModule from "./Hashing.mjs";
|
|
17
|
+
import BletchleyModule from "./Bletchley.mjs";
|
|
18
|
+
import CompressionModule from "./Compression.mjs";
|
|
19
|
+
import CodeModule from "./Code.mjs";
|
|
20
|
+
import DiffModule from "./Diff.mjs";
|
|
21
|
+
import ShellcodeModule from "./Shellcode.mjs";
|
|
22
|
+
import ChartsModule from "./Charts.mjs";
|
|
23
|
+
import RegexModule from "./Regex.mjs";
|
|
24
|
+
import PGPModule from "./PGP.mjs";
|
|
25
|
+
import PublicKeyModule from "./PublicKey.mjs";
|
|
26
|
+
import JqModule from "./Jq.mjs";
|
|
27
|
+
import OCRModule from "./OCR.mjs";
|
|
28
|
+
import URLModule from "./URL.mjs";
|
|
29
|
+
import UserAgentModule from "./UserAgent.mjs";
|
|
30
|
+
import ProtobufModule from "./Protobuf.mjs";
|
|
31
|
+
import HandlebarsModule from "./Handlebars.mjs";
|
|
32
|
+
import YaraModule from "./Yara.mjs";
|
|
33
|
+
|
|
34
|
+
const OpModules = {};
|
|
35
|
+
|
|
36
|
+
Object.assign(
|
|
37
|
+
OpModules,
|
|
38
|
+
CiphersModule,
|
|
39
|
+
DefaultModule,
|
|
40
|
+
EncodingsModule,
|
|
41
|
+
ImageModule,
|
|
42
|
+
CryptoModule,
|
|
43
|
+
SerialiseModule,
|
|
44
|
+
HashingModule,
|
|
45
|
+
BletchleyModule,
|
|
46
|
+
CompressionModule,
|
|
47
|
+
CodeModule,
|
|
48
|
+
DiffModule,
|
|
49
|
+
ShellcodeModule,
|
|
50
|
+
ChartsModule,
|
|
51
|
+
RegexModule,
|
|
52
|
+
PGPModule,
|
|
53
|
+
PublicKeyModule,
|
|
54
|
+
JqModule,
|
|
55
|
+
OCRModule,
|
|
56
|
+
URLModule,
|
|
57
|
+
UserAgentModule,
|
|
58
|
+
ProtobufModule,
|
|
59
|
+
HandlebarsModule,
|
|
60
|
+
YaraModule,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
export default OpModules;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
|
|
3
|
+
*
|
|
4
|
+
* @author n1474335 [n1474335@gmail.com]
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import GeneratePGPKeyPair from "../../operations/GeneratePGPKeyPair.mjs";
|
|
9
|
+
import PGPDecrypt from "../../operations/PGPDecrypt.mjs";
|
|
10
|
+
import PGPDecryptAndVerify from "../../operations/PGPDecryptAndVerify.mjs";
|
|
11
|
+
import PGPEncrypt from "../../operations/PGPEncrypt.mjs";
|
|
12
|
+
import PGPEncryptAndSign from "../../operations/PGPEncryptAndSign.mjs";
|
|
13
|
+
import PGPVerify from "../../operations/PGPVerify.mjs";
|
|
14
|
+
|
|
15
|
+
const OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
|
|
16
|
+
|
|
17
|
+
OpModules.PGP = {
|
|
18
|
+
"Generate PGP Key Pair": GeneratePGPKeyPair,
|
|
19
|
+
"PGP Decrypt": PGPDecrypt,
|
|
20
|
+
"PGP Decrypt and Verify": PGPDecryptAndVerify,
|
|
21
|
+
"PGP Encrypt": PGPEncrypt,
|
|
22
|
+
"PGP Encrypt and Sign": PGPEncryptAndSign,
|
|
23
|
+
"PGP Verify": PGPVerify,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default OpModules;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
|
|
3
|
+
*
|
|
4
|
+
* @author n1474335 [n1474335@gmail.com]
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import ProtobufDecode from "../../operations/ProtobufDecode.mjs";
|
|
9
|
+
import ProtobufEncode from "../../operations/ProtobufEncode.mjs";
|
|
10
|
+
|
|
11
|
+
const OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
|
|
12
|
+
|
|
13
|
+
OpModules.Protobuf = {
|
|
14
|
+
"Protobuf Decode": ProtobufDecode,
|
|
15
|
+
"Protobuf Encode": ProtobufEncode,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default OpModules;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
|
|
3
|
+
*
|
|
4
|
+
* @author n1474335 [n1474335@gmail.com]
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import HexToObjectIdentifier from "../../operations/HexToObjectIdentifier.mjs";
|
|
9
|
+
import HexToPEM from "../../operations/HexToPEM.mjs";
|
|
10
|
+
import JWKToPem from "../../operations/JWKToPem.mjs";
|
|
11
|
+
import ObjectIdentifierToHex from "../../operations/ObjectIdentifierToHex.mjs";
|
|
12
|
+
import PEMToJWK from "../../operations/PEMToJWK.mjs";
|
|
13
|
+
import ParseASN1HexString from "../../operations/ParseASN1HexString.mjs";
|
|
14
|
+
import ParseCSR from "../../operations/ParseCSR.mjs";
|
|
15
|
+
import ParseX509CRL from "../../operations/ParseX509CRL.mjs";
|
|
16
|
+
import ParseX509Certificate from "../../operations/ParseX509Certificate.mjs";
|
|
17
|
+
import PubKeyFromCert from "../../operations/PubKeyFromCert.mjs";
|
|
18
|
+
import PubKeyFromPrivKey from "../../operations/PubKeyFromPrivKey.mjs";
|
|
19
|
+
|
|
20
|
+
const OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
|
|
21
|
+
|
|
22
|
+
OpModules.PublicKey = {
|
|
23
|
+
"Hex to Object Identifier": HexToObjectIdentifier,
|
|
24
|
+
"Hex to PEM": HexToPEM,
|
|
25
|
+
"JWK to PEM": JWKToPem,
|
|
26
|
+
"Object Identifier to Hex": ObjectIdentifierToHex,
|
|
27
|
+
"PEM to JWK": PEMToJWK,
|
|
28
|
+
"Parse ASN.1 hex string": ParseASN1HexString,
|
|
29
|
+
"Parse CSR": ParseCSR,
|
|
30
|
+
"Parse X.509 CRL": ParseX509CRL,
|
|
31
|
+
"Parse X.509 certificate": ParseX509Certificate,
|
|
32
|
+
"Public Key from Certificate": PubKeyFromCert,
|
|
33
|
+
"Public Key from Private Key": PubKeyFromPrivKey,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default OpModules;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
|
|
3
|
+
*
|
|
4
|
+
* @author n1474335 [n1474335@gmail.com]
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import ExtractDates from "../../operations/ExtractDates.mjs";
|
|
9
|
+
import ExtractDomains from "../../operations/ExtractDomains.mjs";
|
|
10
|
+
import ExtractEmailAddresses from "../../operations/ExtractEmailAddresses.mjs";
|
|
11
|
+
import ExtractFilePaths from "../../operations/ExtractFilePaths.mjs";
|
|
12
|
+
import ExtractHashes from "../../operations/ExtractHashes.mjs";
|
|
13
|
+
import ExtractIPAddresses from "../../operations/ExtractIPAddresses.mjs";
|
|
14
|
+
import ExtractMACAddresses from "../../operations/ExtractMACAddresses.mjs";
|
|
15
|
+
import ExtractURLs from "../../operations/ExtractURLs.mjs";
|
|
16
|
+
import Filter from "../../operations/Filter.mjs";
|
|
17
|
+
import FindReplace from "../../operations/FindReplace.mjs";
|
|
18
|
+
import Register from "../../operations/Register.mjs";
|
|
19
|
+
import RegularExpression from "../../operations/RegularExpression.mjs";
|
|
20
|
+
import Strings from "../../operations/Strings.mjs";
|
|
21
|
+
|
|
22
|
+
const OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
|
|
23
|
+
|
|
24
|
+
OpModules.Regex = {
|
|
25
|
+
"Extract dates": ExtractDates,
|
|
26
|
+
"Extract domains": ExtractDomains,
|
|
27
|
+
"Extract email addresses": ExtractEmailAddresses,
|
|
28
|
+
"Extract file paths": ExtractFilePaths,
|
|
29
|
+
"Extract hashes": ExtractHashes,
|
|
30
|
+
"Extract IP addresses": ExtractIPAddresses,
|
|
31
|
+
"Extract MAC addresses": ExtractMACAddresses,
|
|
32
|
+
"Extract URLs": ExtractURLs,
|
|
33
|
+
"Filter": Filter,
|
|
34
|
+
"Find / Replace": FindReplace,
|
|
35
|
+
"Register": Register,
|
|
36
|
+
"Regular expression": RegularExpression,
|
|
37
|
+
"Strings": Strings,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default OpModules;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
|
|
3
|
+
*
|
|
4
|
+
* @author n1474335 [n1474335@gmail.com]
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import AvroToJSON from "../../operations/AvroToJSON.mjs";
|
|
9
|
+
import BSONDeserialise from "../../operations/BSONDeserialise.mjs";
|
|
10
|
+
import BSONSerialise from "../../operations/BSONSerialise.mjs";
|
|
11
|
+
import CBORDecode from "../../operations/CBORDecode.mjs";
|
|
12
|
+
import CBOREncode from "../../operations/CBOREncode.mjs";
|
|
13
|
+
import ParseObjectIDTimestamp from "../../operations/ParseObjectIDTimestamp.mjs";
|
|
14
|
+
|
|
15
|
+
const OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
|
|
16
|
+
|
|
17
|
+
OpModules.Serialise = {
|
|
18
|
+
"Avro to JSON": AvroToJSON,
|
|
19
|
+
"BSON deserialise": BSONDeserialise,
|
|
20
|
+
"BSON serialise": BSONSerialise,
|
|
21
|
+
"CBOR Decode": CBORDecode,
|
|
22
|
+
"CBOR Encode": CBOREncode,
|
|
23
|
+
"Parse ObjectID timestamp": ParseObjectIDTimestamp,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default OpModules;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
|
|
3
|
+
*
|
|
4
|
+
* @author n1474335 [n1474335@gmail.com]
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import DisassembleARM from "../../operations/DisassembleARM.mjs";
|
|
9
|
+
import DisassembleX86 from "../../operations/DisassembleX86.mjs";
|
|
10
|
+
|
|
11
|
+
const OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
|
|
12
|
+
|
|
13
|
+
OpModules.Shellcode = {
|
|
14
|
+
"Disassemble ARM": DisassembleARM,
|
|
15
|
+
"Disassemble x86": DisassembleX86,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default OpModules;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
|
|
3
|
+
*
|
|
4
|
+
* @author n1474335 [n1474335@gmail.com]
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import ParseURI from "../../operations/ParseURI.mjs";
|
|
9
|
+
import URLDecode from "../../operations/URLDecode.mjs";
|
|
10
|
+
import URLEncode from "../../operations/URLEncode.mjs";
|
|
11
|
+
|
|
12
|
+
const OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
|
|
13
|
+
|
|
14
|
+
OpModules.URL = {
|
|
15
|
+
"Parse URI": ParseURI,
|
|
16
|
+
"URL Decode": URLDecode,
|
|
17
|
+
"URL Encode": URLEncode,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default OpModules;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
|
|
3
|
+
*
|
|
4
|
+
* @author n1474335 [n1474335@gmail.com]
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import ParseUserAgent from "../../operations/ParseUserAgent.mjs";
|
|
9
|
+
|
|
10
|
+
const OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
|
|
11
|
+
|
|
12
|
+
OpModules.UserAgent = {
|
|
13
|
+
"Parse User Agent": ParseUserAgent,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default OpModules;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
|
|
3
|
+
*
|
|
4
|
+
* @author n1474335 [n1474335@gmail.com]
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import YARARules from "../../operations/YARARules.mjs";
|
|
9
|
+
|
|
10
|
+
const OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
|
|
11
|
+
|
|
12
|
+
OpModules.Yara = {
|
|
13
|
+
"YARA Rules": YARARules,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default OpModules;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Byte-reading and text-decoding utilities for audio metadata parsing.
|
|
3
|
+
*
|
|
4
|
+
* @author d0s1nt [d0s1nt@cyberchefaudio]
|
|
5
|
+
* @copyright Crown Copyright 2025
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @returns {string} 4-byte ASCII at offset, or "" if out of bounds. */
|
|
10
|
+
export function ascii4(b, off) {
|
|
11
|
+
if (off + 4 > b.length) return "";
|
|
12
|
+
return String.fromCharCode(b[off], b[off + 1], b[off + 2], b[off + 3]);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** @returns {number} Byte offset of ASCII needle `s`, or -1. */
|
|
16
|
+
export function indexOfAscii(b, s, start, end) {
|
|
17
|
+
const limit = Math.max(0, Math.min(end, b.length) - s.length);
|
|
18
|
+
for (let i = start; i <= limit; i++) {
|
|
19
|
+
let ok = true;
|
|
20
|
+
for (let j = 0; j < s.length; j++) {
|
|
21
|
+
if (b[i + j] !== s.charCodeAt(j)) {
|
|
22
|
+
ok = false;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (ok) return i;
|
|
27
|
+
}
|
|
28
|
+
return -1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** @returns {number} Unsigned 32-bit big-endian read. */
|
|
32
|
+
export function u32be(bytes, off) {
|
|
33
|
+
return ((bytes[off] << 24) >>> 0) | (bytes[off + 1] << 16) | (bytes[off + 2] << 8) | bytes[off + 3];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** @returns {number} Unsigned 32-bit little-endian read. */
|
|
37
|
+
export function u32le(bytes, off) {
|
|
38
|
+
return (bytes[off] | (bytes[off + 1] << 8) | (bytes[off + 2] << 16) | (bytes[off + 3] << 24)) >>> 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @returns {number} Unsigned 16-bit little-endian read. */
|
|
42
|
+
export function u16le(bytes, off) {
|
|
43
|
+
return bytes[off] | (bytes[off + 1] << 8);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** @returns {BigInt} Unsigned 64-bit little-endian read. */
|
|
47
|
+
export function u64le(bytes, off) {
|
|
48
|
+
return BigInt(u32le(bytes, off)) | (BigInt(u32le(bytes, off + 4)) << 32n);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** @returns {number} Decoded ID3v2 synchsafe integer from four 7-bit bytes. */
|
|
52
|
+
export function synchsafeToInt(b0, b1, b2, b3) {
|
|
53
|
+
return ((b0 & 0x7f) << 21) | ((b1 & 0x7f) << 14) | ((b2 & 0x7f) << 7) | (b3 & 0x7f);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** @returns {string} Decoded UTF-16LE byte range, nulls stripped. */
|
|
57
|
+
export function decodeUtf16LE(b, off, len) {
|
|
58
|
+
if (len <= 0 || off + len > b.length) return "";
|
|
59
|
+
try {
|
|
60
|
+
return new TextDecoder("utf-16le").decode(b.slice(off, off + len)).replace(/\u0000/g, "").trim();
|
|
61
|
+
} catch {
|
|
62
|
+
return "";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** @returns {{valueBytes: Uint8Array, next: number}} Bytes until null terminator, UTF-16 aware. */
|
|
67
|
+
export function readNullTerminated(bytes, start, encoding) {
|
|
68
|
+
const isUtf16 = encoding === 1 || encoding === 2;
|
|
69
|
+
if (!isUtf16) {
|
|
70
|
+
let i = start;
|
|
71
|
+
while (i < bytes.length && bytes[i] !== 0x00) i++;
|
|
72
|
+
return { valueBytes: bytes.slice(start, i), next: i + 1 };
|
|
73
|
+
}
|
|
74
|
+
let i = start;
|
|
75
|
+
while (i + 1 < bytes.length && !(bytes[i] === 0x00 && bytes[i + 1] === 0x00)) i += 2;
|
|
76
|
+
return { valueBytes: bytes.slice(start, i), next: i + 2 };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const ID3_ENCODINGS = ["iso-8859-1", "utf-16", "utf-16be", "utf-8"];
|
|
80
|
+
|
|
81
|
+
/** @returns {string} Text decoded using ID3v2 encoding byte (0=latin1, 1=utf16, 2=utf16be, 3=utf8). */
|
|
82
|
+
export function decodeText(bytes, encoding) {
|
|
83
|
+
if (!bytes || bytes.length === 0) return "";
|
|
84
|
+
try {
|
|
85
|
+
return new TextDecoder(ID3_ENCODINGS[encoding] || "utf-16").decode(bytes);
|
|
86
|
+
} catch {
|
|
87
|
+
return safeUtf8(bytes);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** @returns {string} UTF-8 decode with replacement (never throws). */
|
|
92
|
+
export function safeUtf8(bytes) {
|
|
93
|
+
try {
|
|
94
|
+
return new TextDecoder("utf-8", { fatal: false }).decode(bytes);
|
|
95
|
+
} catch {
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** @returns {string} ISO-8859-1 decode, nulls stripped, trimmed. */
|
|
101
|
+
export function decodeLatin1Trim(bytes) {
|
|
102
|
+
return decodeText(bytes, 0).replace(/\u0000/g, "").trim();
|
|
103
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report skeleton and container detection for audio metadata extraction.
|
|
3
|
+
*
|
|
4
|
+
* @author d0s1nt [d0s1nt@cyberchefaudio]
|
|
5
|
+
* @copyright Crown Copyright 2025
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/* eslint-disable camelcase */
|
|
10
|
+
|
|
11
|
+
import { ascii4, indexOfAscii } from "./AudioBytes.mjs";
|
|
12
|
+
|
|
13
|
+
/** Builds the empty report skeleton ready for a format parser to populate. */
|
|
14
|
+
export function makeEmptyReport(filename, byteLength, container) {
|
|
15
|
+
return {
|
|
16
|
+
schema_version: "audio-meta-1.0",
|
|
17
|
+
artifact: {
|
|
18
|
+
filename,
|
|
19
|
+
byte_length: byteLength,
|
|
20
|
+
container: { type: container.type, brand: container.brand || null, mime: container.mime || null },
|
|
21
|
+
},
|
|
22
|
+
detections: { metadata_systems: [], provenance_systems: [] },
|
|
23
|
+
tags: {
|
|
24
|
+
common: {
|
|
25
|
+
title: null, artist: null, album: null, date: null, track: null,
|
|
26
|
+
genre: null, comment: null, composer: null, copyright: null, language: null,
|
|
27
|
+
},
|
|
28
|
+
raw: {},
|
|
29
|
+
},
|
|
30
|
+
embedded: [],
|
|
31
|
+
provenance: {
|
|
32
|
+
c2pa: {
|
|
33
|
+
present: false,
|
|
34
|
+
embedding: [],
|
|
35
|
+
manifest_store: { active_manifest_urn: null, instance_id: null, claim_generator: null },
|
|
36
|
+
assertions: [],
|
|
37
|
+
signature: {
|
|
38
|
+
algorithm: null, signing_time: null,
|
|
39
|
+
certificate: { subject_cn: null, issuer_cn: null, serial_number: null },
|
|
40
|
+
},
|
|
41
|
+
validation: { validation_state: "Unknown", reasons: [], details_raw: null },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
errors: [],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Detects the audio container format from magic bytes. */
|
|
49
|
+
export function sniffContainer(b) {
|
|
50
|
+
if (b.length >= 3 && b[0] === 0x49 && b[1] === 0x44 && b[2] === 0x33)
|
|
51
|
+
return { type: "mp3", mime: "audio/mpeg" };
|
|
52
|
+
if (b.length >= 2 && b[0] === 0xff && (b[1] & 0xe0) === 0xe0) {
|
|
53
|
+
if ((b[1] & 0x06) === 0x00) return { type: "aac", mime: "audio/aac" };
|
|
54
|
+
return { type: "mp3", mime: "audio/mpeg" };
|
|
55
|
+
}
|
|
56
|
+
if (b.length >= 8 && b[0] === 0x0b && b[1] === 0x77)
|
|
57
|
+
return { type: "ac3", mime: "audio/ac3" };
|
|
58
|
+
if (b.length >= 16 &&
|
|
59
|
+
b[0] === 0x30 && b[1] === 0x26 && b[2] === 0xb2 && b[3] === 0x75 &&
|
|
60
|
+
b[4] === 0x8e && b[5] === 0x66 && b[6] === 0xcf && b[7] === 0x11)
|
|
61
|
+
return { type: "wma", mime: "audio/x-ms-wma" };
|
|
62
|
+
if (b.length >= 12 && ascii4(b, 0) === "RIFF" && ascii4(b, 8) === "WAVE")
|
|
63
|
+
return { type: "wav", mime: "audio/wav" };
|
|
64
|
+
if (b.length >= 12 && ascii4(b, 0) === "BW64" && ascii4(b, 8) === "WAVE")
|
|
65
|
+
return { type: "bw64", mime: "audio/wav" };
|
|
66
|
+
if (b.length >= 4 && ascii4(b, 0) === "fLaC")
|
|
67
|
+
return { type: "flac", mime: "audio/flac" };
|
|
68
|
+
if (b.length >= 4 && ascii4(b, 0) === "OggS") {
|
|
69
|
+
const idx = indexOfAscii(b, "OpusHead", 0, Math.min(b.length, 65536));
|
|
70
|
+
return idx >= 0 ? { type: "opus", mime: "audio/ogg" } : { type: "ogg", mime: "audio/ogg" };
|
|
71
|
+
}
|
|
72
|
+
if (b.length >= 12 && ascii4(b, 4) === "ftyp") {
|
|
73
|
+
const brand = ascii4(b, 8);
|
|
74
|
+
const isM4A = brand === "M4A " || brand === "M4B " || brand === "M4P ";
|
|
75
|
+
return { type: isM4A ? "m4a" : "mp4", mime: isM4A ? "audio/mp4" : "video/mp4", brand };
|
|
76
|
+
}
|
|
77
|
+
if (b.length >= 12 && ascii4(b, 0) === "FORM") {
|
|
78
|
+
const formType = ascii4(b, 8);
|
|
79
|
+
if (formType === "AIFF" || formType === "AIFC") return { type: "aiff", mime: "audio/aiff", brand: formType };
|
|
80
|
+
}
|
|
81
|
+
return { type: "unknown", mime: null };
|
|
82
|
+
}
|