CyberChef/tests/operations/tests/Magic.mjs

135 lines
22 KiB
JavaScript
Raw Normal View History

/**
* Magic tests.
*
* @author n1474335 [n1474335@gmail.com]
*
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Magic: nothing",
input: "",
expectedOutput: "Nothing of interest could be detected about the input data.\nHave you tried modifying the operation arguments?",
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
],
},
{
name: "Magic: hex",
input: "41 42 43 44 45",
expectedMatch: /"#recipe=From_Hex\('Space'\)"/,
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
],
},
{
name: "Magic: jpeg",
input: "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x48\x00\x48\x00\x00\xff\xdb\x00\x43\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\x0a\x07\x07\x06\x08\x0c\x0a\x0c\x0c\x0b\x0a\x0b\x0b\x0d\x0e\x12\x10\x0d\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f\x17\x18\x16\x14\x18\x12\x14\x15\x14\xff\xdb\x00\x43\x01\x03\x04\x04\x05\x04\x05\x09\x05\x05\x09\x14\x0d\x0b\x0d\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\xff\xc2\x00\x11\x08\x00\x32\x00\x32\x03\x01\x11\x00\x02\x11\x01\x03\x11\x01\xff\xc4\x00\x1c\x00\x00\x02\x02\x03\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x07\x04\x05\x00\x02\x03\x01\x08\xff\xc4\x00\x1a\x01\x00\x03\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x05\x06\x03\x02\x01\x07\xff\xda\x00\x0c\x03\x01\x00\x02\x10\x03\x10\x00\x00\x01\xe7\x14\xd4\x6e\x92\x6e\xe0\x67\xd3\x01\x2e\xe2\x61\x94\xcc\xb8\xa2\x6a\x9e\xa0\x8a\x71\xfa\xde\xdc\x52\xd3\xd5\x89\x16\xe1\xbd\x57\x6b\x4c\xc9\xc9\x02\xad\xcd\x3f\x3d\xe3\x0e\xfc\xcd\x61\x95\xe9\x08\xa8\x74\x05\x4e\xc3\x14\x07\x5d\x62\xc5\x22\x57\xb8\x0f\xbd\x49\xd9\x50\xd2\x6b\x46\x3c\xe3\x8f\xa1\xd5\x83\x2d\x27\xa5\xbd\xf3\x24\x99\x82\x11\xf5\xd5\xf3\xf0\x05\x8f\x34\xbc\x16\xa5\x83\x00\x74\xaa\x86\x66\xb4\x8e\xf2\x89\x13\x88\xd9\xe2\x16\x56\xe5\xb3\x4a\x8c\xc9\xc9\x61\xa1\x95\xa5\x1d\x7e\xb8\xa8\x67\x65\xf3\xbd\xa4\xa7\xff\xc4\x00\x21\x10\x00\x02\x03\x00\x02\x02\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x04\x01\x02\x05\x00\x06\x11\x12\x13\x14\x16\x21\x24\xff\xda\x00\x08\x01\x01\x00\x01\x05\x02\xd9\xa5\x49\x5a\x1d\x6a\x39\xf8\xfa\xd5\x03\x98\xe6\x61\x44\x16\xa2\xc9\x82\xb4\xbc\x97\xae\x9e\xe4\x63\xec\x33\xd6\x24\x4b\x29\xa4\x98\xad\x5c\x4a\x68\xae\x4e\x5e\x41\x3c\x3f\xc8\x20\x0c\x4b\xc8\xd4\x42\x34\xb8\x7c\x2f\x3a\xd1\xea\x3a\x36\x19\xf4\x4d\x42\xd9\x41\xe9\x02\xc5\x8d\xbc\xd1\x45\xeb\xf5\x12\xcc\xb3\x9b\xc0\x8b\x17\x23\x99\x8e\xad\x9a\x67\xb7\x46\x65\x35\xd6\xa5\x9c\x81\xf8\x8b\x5e\x9f\x2e\x83\x4c\x35\xcd\xb3\x83\x45\x1c\xe1\xd9\x85\x35\xf3\x1c\xd2\x73\xad\x3a\x1a\xbd\x67\x87\xed\x89\x96\x96\x79\xb6\x11\x45\x9c\x9e\xb3\x03\x9d\x0c\x77\x06\xf2\xb8\x9b\x9f\x0b\x5a\x42\xaa\x4b\x58\xa4\xf6\x14\x45\xf4\x3b\x1d\x2a\x4c\x6c\xe5\x82\xba\x7d\x8f\xf9\x91\xcf\xa5\x46\xa6\xbf\xeb\x12\x0d\x7f\x1f\xff\xc4\x00\x2f\x11\x00\x01\x04\x01\x02\x03\x06\x04\x07\x00\x00\x00\x00\x00\x00\x00\x01\x00\x02\x03\x04\x11\x12\x31\x05\x13\x21\x14\x22\x41\x51\xa1\xf0\x32\x42\x71\x81\x23\x24\x52\x53\x61\x91\xf1\xff\xda\x00\x08\x01\x03\x01\x01\x3f\x01\xbf\x0e\x98\xc3\xc0\xfb\xa1\x19\x71\xca\xa8\x5b\x5d\xed\x73\xd3\x38\xe3\x98\xf7\x35\xad\x1a\x73\xfc\xa7\xcf\xda\x7b\xce\xf1\x4d\xb0\x21\x69\x0d\x0b\x4b\xcf\xce\x54\x5f\x98\xac\x1b\x28\xdf\x1f\xd6\x56\x98\x23\x9a\x37\x39\xbd\x4e\xde\xfd\x17\x16\xae\xd7\x5a\xdf\xa1\xea\x9d\x0c\x6d\x6e\x85\x2b\x66\x2d\x0d\x8c\x74\x5c\x2a\x06\x13\x87\x0c\xe1\x3d\xa0\x38\x85\x74\x4d\x5a\x00\xe8\xc6\xdf\x4f\xa2\xb1\x62\x6b\x04\x03\xd7\xc9\x43\x34\x92\x3f\x4b\xdd\x9c\xa6\x70\xfa\xad\xf9\x7b\xde\x6a\xd5\xc8\xe0\x7e\x83\xb8\x50\xdb\x9f\x99\xad\x87\x01\x3a\xce\xb7\x17\x13\xba\x3a\x2d\xf0\xf1\x8d\xb4\xfa\xff\x00\xaa\x0a\xd6\x2a\x1e\x7e\x94\x6a\x56\xbc\xe6\xcf\x19\xeb\xef\xd5\x5d\x12\x4b\x16\x23\x2a\xd5\x52\x23\x2e\x27\x38\x5c\x3e\x28\xa5\x92\x31\x27\xc3\xe2\xb1\x18\xe8\x1a\x14\x1c\x4a\x0a\xf0\xb7\x4e\xe0\x6c\xac\xf1\x37\xd8\xee\xe3\xba\x9c\x49\x87\x9b\x0e\xe3\x65\xda\x6c\xb2\x42\xf2\xed\xf7\x54\xa4\x80\xc4\xd9\x2c\x63\x27\xcf\x65\xc4\xed\x40\xf7\x35\x91\xbb\xa8\x59\x72\xbf\x15\x53\x8e\x46\xfe\xfe\xcb\x46\x32\x15\x2c\xb4\x38\x65\x5c\x8f\x97\x28\x78\xf1\xea\xa4\xa3\xda\x86\xac\xe1\x4b\xc3\xa1\x90\x08\x88\xc1\xf3\x43\x81\xd2\xfd\xc3\xe8\x9d\xf1\x39\x40\x01\x99\x80\xf9\x85\x60\x72\xec\x38\x33\xa7\x54\xd3\xf8\x79\x55\x09\x70\x76\xa5\x6f\x67\x95\xce\x93\xf5\x15\xff\xc4\x00\x2f\x11\x00\x01\x03\x02\x03\x06\x05\x03\x05\x00\x00\x00\x00\x00\x00\x00\x01\x00\x02\x03\x04\x21\x11\x13\x31\x05\x12\x22\x41\x51\x61\x71\xa1\xb1\xc1\xf0\x23\x32\xd1\x33\x81\x9
expectedMatch: /Render_Image\('Raw'\)/,
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
],
},
{
name: "Magic: mojibake",
input: "d091d18bd100d182d180d0b0d10020d0bad0bed180d0b8d187d0bdd0b5d0b2d0b0d10020d0bbd0b8d100d0b020d0bfd180d18bd0b3d0b0d0b5d18220d187d0b5d180d0b5d0b720d0bbd0b5d0bdd0b8d0b2d183d18e20d100d0bed0b1d0b0d0bad1832e",
expectedMatch: /Быртрар коричневар лира прыгает через ленивую робаку./,
recipeConfig: [
{
op: "Magic",
args: [3, true, false]
}
],
},
2020-03-10 10:39:13 +01:00
{
name: "Magic Chain of Base64",
input: "WkVkV2VtUkRRbnBrU0Vwd1ltMWpQUT09",
expectedMatch: /From_Base64\('A-Za-z0-9\+\/=',true\)\nFrom_Base64\('A-Za-z0-9\+\/=',true\)\nFrom_Base64\('A-Za-z0-9\+\/=',true\)/,
recipeConfig: [
{
op: "Magic",
args: [3, true, false]
}
],
},
{
name: "Magic Chain of Hex to Hexdump to Base64",
input: "MDAwMDAwMDAgIDM3IDM0IDIwIDM2IDM1IDIwIDM3IDMzIDIwIDM3IDM0IDIwIDMyIDMwIDIwIDM3ICB8NzQgNjUgNzMgNzQgMjAgN3wKMDAwMDAwMTAgIDMzIDIwIDM3IDM0IDIwIDM3IDMyIDIwIDM2IDM5IDIwIDM2IDY1IDIwIDM2IDM3ICB8MyA3NCA3MiA2OSA2ZSA2N3w=",
expectedMatch: /From_Base64\('A-Za-z0-9\+\/=',true\)\nFrom_Hexdump\(\)\nFrom_Hex\('Space'\)/,
recipeConfig: [
{
op: "Magic",
args: [3, true, false]
}
],
},
{
name: "Magic Chain of Charcode to Octal to Base32",
input: "GY3SANRUEA2DAIBWGYQDMNJAGQYCANRXEA3DGIBUGAQDMNZAGY2CANBQEA3DEIBWGAQDIMBAGY3SANRTEA2DAIBWG4QDMNBAGQYCANRXEA3DEIBUGAQDMNRAG4YSANBQEA3DMIBRGQ2SANBQEA3DMIBWG4======",
expectedMatch: /From_Base32\('A-Z2-7=',false\)\nFrom_Octal\('Space'\)\nFrom_Hex\('Space'\)/,
recipeConfig: [
{
op: "Magic",
args: [3, true, false]
}
],
},
{
name: "Magic Chain of Base64 Output Check",
input: "WkVkV2VtUkRRbnBrU0Vwd1ltMWpQUT09",
expectedMatch: /test string/,
recipeConfig: [
{
op: "Magic",
args: [3, true, false]
}
],
},
{
name: "Magic Chain of Decimal to Base32 to Base32",
input: "I5CVSVCNJFBFER2BLFJUCTKKKJDVKUKEINGUUV2FIFNFIRKJIJJEORJSKNAU2SSSI5MVCRCDJVFFKRKBLFKECTSKIFDUKWKUIFEUEUSHIFNFCPJ5HU6Q====",
expectedMatch: /test string/,
recipeConfig: [
{
op: "Magic",
args: [3, true, false]
}
],
},
2020-03-11 13:51:46 +01:00
{
name: "Raw Inflate from Entropy",
input: "\x4d\x52\xb1\x6e\xdc\x30\x0c\xdd\xf3\x15\x44\x80\x6e\xae\x91\x02\x4d\x80\x8e\x4d\x9a\x21\x53\x8b\xa6\x43\x56\x5a\xe2\x9d\x84\x93\x25\x43\x94\xed\xf8\xef\xf3\xe8\x6b\x0e\xb7\x1c\xce\xd4\x7b\x8f\x8f\x7c\x7c\xda\x06\xa9\x4f\x41\x0e\x14\x95\x98\x34\x8e\x53\x92\x8e\x62\x6e\x73\x6c\x71\x11\x5a\x65\x20\x9e\x26\x3a\x94\x4a\x8e\x6b\xdd\x62\x3e\x52\x99\x1b\x71\x4a\x34\x72\xce\x52\xa9\x1c\xe8\xd6\x99\xd0\x2d\x95\x49\x2a\xb7\x58\xb2\xd2\x1a\x5b\x88\x19\xa2\x26\x31\xd4\xb2\xaa\xd4\x9e\xfe\x05\x51\xb9\x86\xc5\xec\xd2\xec\xe5\x7f\x6b\x92\xec\x8a\xb7\x1e\x29\x9e\x84\xde\x7e\xff\x25\x34\x7e\x64\x95\x87\xef\x1d\x8d\xa5\x0a\xb9\x62\xc0\x77\x43\xd6\x6d\x32\x91\x33\xf6\xe7\xf3\x6b\x47\xbf\x9e\x5f\x89\xb3\xa7\xc7\x54\xd6\x43\xd4\xd0\x91\xab\x82\x4e\x10\x1c\x62\xe6\xba\xed\xaf\x41\xde\xfd\x3c\x4e\x8a\x57\x88\x55\x51\x35\x15\x7b\xf1\x72\x5d\xc1\x60\x9e\x1b\x03\xc6\xc9\xcd\xe9\xac\x13\x58\x31\xc3\x8e\x76\x41\xdc\x49\xe7\x11\x42\x2f\x7f\x96\x87\xbd\xf6\xd6\xdf\xdf\xfd\xa0\x89\xab\x02\x0c\x66\xe0\x7c\x34\x1a\xfe\x54\x76\x0d\xeb\xfa\x1c\x11\x2c\x23\x8c\xb3\x0b\xfb\x64\xfd\xcd\x0d\xb6\x43\xad\x94\x64\x69\x78\xd1\x78\xcc\xe2\x51\x00\x85\x07\x2c\x67\x28\x2d\x50\x13\x17\x72\x84\xa3\x9d\x9d\x4b\xfe\x7a\x5d\xe1\xb4\x69\x53\xe3\x20\x9c\x38\x99\x69\xd9\x87\xc0\xa2\x2f\xab\x5b\x79\x3b\xe7\x63\x41\x06\x5e\xcc\x1f\x18\x5e\x20\x61\xe5\x0b\xd0\xbc\xa8\x25\xc0\xe9\x58\x2a\x5e\x46\xed\xe9\xa5\x41\x40\x81\xc9\x4e\x70\x22\xbe\xbb\x58\xed\x68\x98\x63\xc2\x6d\xc0\x18\x72\xad\x32\x4a\x6e\x38\x94\x8d\x10\x6e\x2d\xc0\xd2\x60\x09\x7c\xfa\x34\x4f\x2d\x48\xac\xf4\xed\xee\x0b\x3e\x72\x59\xf6\xab\xa0\x16\x47\x1c\xc9\x82\x65\xa9\xe0\x17\xb6\x36\xc1\x46\xfb\x0f",
expectedMatch: /#recipe=Raw_Inflate/,
recipeConfig: [
{
op: "Magic",
args: [3, true, false]
}
]
},
{
name: "Raw Inflate Result Text",
input: "\x4d\x52\xb1\x6e\xdc\x30\x0c\xdd\xf3\x15\x44\x80\x6e\xae\x91\x02\x4d\x80\x8e\x4d\x9a\x21\x53\x8b\xa6\x43\x56\x5a\xe2\x9d\x84\x93\x25\x43\x94\xed\xf8\xef\xf3\xe8\x6b\x0e\xb7\x1c\xce\xd4\x7b\x8f\x8f\x7c\x7c\xda\x06\xa9\x4f\x41\x0e\x14\x95\x98\x34\x8e\x53\x92\x8e\x62\x6e\x73\x6c\x71\x11\x5a\x65\x20\x9e\x26\x3a\x94\x4a\x8e\x6b\xdd\x62\x3e\x52\x99\x1b\x71\x4a\x34\x72\xce\x52\xa9\x1c\xe8\xd6\x99\xd0\x2d\x95\x49\x2a\xb7\x58\xb2\xd2\x1a\x5b\x88\x19\xa2\x26\x31\xd4\xb2\xaa\xd4\x9e\xfe\x05\x51\xb9\x86\xc5\xec\xd2\xec\xe5\x7f\x6b\x92\xec\x8a\xb7\x1e\x29\x9e\x84\xde\x7e\xff\x25\x34\x7e\x64\x95\x87\xef\x1d\x8d\xa5\x0a\xb9\x62\xc0\x77\x43\xd6\x6d\x32\x91\x33\xf6\xe7\xf3\x6b\x47\xbf\x9e\x5f\x89\xb3\xa7\xc7\x54\xd6\x43\xd4\xd0\x91\xab\x82\x4e\x10\x1c\x62\xe6\xba\xed\xaf\x41\xde\xfd\x3c\x4e\x8a\x57\x88\x55\x51\x35\x15\x7b\xf1\x72\x5d\xc1\x60\x9e\x1b\x03\xc6\xc9\xcd\xe9\xac\x13\x58\x31\xc3\x8e\x76\x41\xdc\x49\xe7\x11\x42\x2f\x7f\x96\x87\xbd\xf6\xd6\xdf\xdf\xfd\xa0\x89\xab\x02\x0c\x66\xe0\x7c\x34\x1a\xfe\x54\x76\x0d\xeb\xfa\x1c\x11\x2c\x23\x8c\xb3\x0b\xfb\x64\xfd\xcd\x0d\xb6\x43\xad\x94\x64\x69\x78\xd1\x78\xcc\xe2\x51\x00\x85\x07\x2c\x67\x28\x2d\x50\x13\x17\x72\x84\xa3\x9d\x9d\x4b\xfe\x7a\x5d\xe1\xb4\x69\x53\xe3\x20\x9c\x38\x99\x69\xd9\x87\xc0\xa2\x2f\xab\x5b\x79\x3b\xe7\x63\x41\x06\x5e\xcc\x1f\x18\x5e\x20\x61\xe5\x0b\xd0\xbc\xa8\x25\xc0\xe9\x58\x2a\x5e\x46\xed\xe9\xa5\x41\x40\x81\xc9\x4e\x70\x22\xbe\xbb\x58\xed\x68\x98\x63\xc2\x6d\xc0\x18\x72\xad\x32\x4a\x6e\x38\x94\x8d\x10\x6e\x2d\xc0\xd2\x60\x09\x7c\xfa\x34\x4f\x2d\x48\xac\xf4\xed\xee\x0b\x3e\x72\x59\xf6\xab\xa0\x16\x47\x1c\xc9\x82\x65\xa9\xe0\x17\xb6\x36\xc1\x46\xfb\x0f",
expectedMatch: /CyberChef is a simple, intuitive web app for carrying out all manner of /,
recipeConfig: [
{
op: "Magic",
args: [3, true, false]
}
]
}
]);