CyberChef/test/tests/operations/ParseQRCode.mjs

72 lines
256 KiB
JavaScript
Raw Normal View History

2018-12-25 22:54:38 +01:00
/**
2018-12-21 12:26:03 +01:00
* Parse QR Code tests
2018-12-25 22:54:38 +01:00
*
2018-12-21 12:26:03 +01:00
* @author j433866 [j433866@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
TestRegister.addTests([
{
name: "Parse QR Code : JPEG",
input: "ffd8ffe000104a46494600010100004800480000ffe1008c4578696600004d4d002a000000080005011200030000000100010000011a0005000000010000004a011b0005000000010000005201280003000000010002000087690004000000010000005a00000000000000480000000100000048000000010003a00100030000000100010000a002000400000001000001e0a003000400000001000001e000000000ffed003850686f746f73686f7020332e30003842494d04040000000000003842494d0425000000000010d41d8cd98f00b204e9800998ecf8427effc000110801e001e003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffdb004300020202020202030202030403030304050404040405070505050505070807070707070708080808080808080a0a0a0a0a0a0b0b0b0b0b0d0d0d0d0d0d0d0d0d0dffdb004301020202030303060303060d0907090d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0dffdd0004001effda000c03010002110311003f00fdfca28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2803ffd0fdfca28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2803ffd1fdfca28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2803ffd2fdfca28a2800a28a2800a28a2803f3c7f6e8fdba2f3f636bcf06da5a78362f15ff00c25716a72b34ba99d3becdfd9c6d86062dae37effb47fb38dbdf3c7c07ff000fc4d5bfe88f5aff00e14adffcaea4ff0082e27fc85be0f7fd7af89bff0042d3abf03a803f7cbfe1f89ab7fd11eb5ffc295bff0095d47fc3f1356ffa23d6bff852b7ff002babf0505bc8c010539f59107e99a5fb349eb1ff00dfc4ff001a00fdeaff0087e26adff447ad7ff0a56ffe5751ff000fc4d5bfe88f5aff00e14adffcaeafc15fb349eb1ffdfc4ff1a3ecd27ac7ff007f13fc6803f7abfe1f89ab7fd11eb5ff00c295bff95d47fc3f1356ff00a23d6bff00852b7ff2babf057ecd27ac7ff7f13fc68fb349eb1ffdfc4ff1a00fdeaff87e26adff00447ad7ff000a56ff00e5751ff0fc4d5bfe88f5affe14adff00caeafc15fb349eb1ff00dfc4ff001a3ecd27ac7ff7f13fc6803f7abfe1f89ab7fd11eb5ffc295bff0095d5ec5f00bfe0adbaa7c6df8bfe13f85b27c30b6d223f12ea9169cd7cbaf35d35bf9aaedbc45f618c3e3674debd6bf9ad6528db4e3f0208fcc715f61fec0fff00276ff0b7fec67b4ffd153d007f66f4514500078afc2cf891ff000592d57e1f78efc41e0c5f8516b7aba26aba8e9ab727c42d0998585dcd6de614fb03eddfe56edbb8e338c9eb5fba47a7e22bf876fda4ff00e4ba78f3fec68f107fe9d6ee803fa2afd8fbfe0a5da8fed51f17edbe175c7c3e83c371dc69f7f7bf6e8f596be606c9633b3ca36900f9bccebbf8c74afd60afe55ffe090bff002765a77fd80b5dff00d02dabfaa7cfd7f2a00fcaff00db27fe0a45a87eca1f1507c37b6f0041e268ce9561a97db24d61ac0e6f5ee5767962d271f2fd9f39ddceee9c73f39f813fe0b35ab78d7c61a37854fc26b5b41aaea36360671e22694c42f2e62b7de13ec0bbb6f99bb1919c6322be4fff0082c400ff00b51a4419439f0b686c159829204ba8824648ce0919fad7e797c0a4f27e2ff834c8d18dde21d11540914927fb46d8e00073d013401fdcd5140a2800a2933f5fca96803c9fe3afc4a93e0dfc1ef17fc54874f5d59fc2ba4dcea8b64d31b71706dd777966508e53774ddb5b1e86bf152ebfe0b7babdadccd6c7e0fda3186468c9ff008495c6769c7fd03abf56ff006e0ff9344f8b9ff629ea5ffa2
expectedOutput: "http://en.m.wikipedia.org",
recipeConfig: [
{
"op": "From Hex",
2018-12-25 22:54:38 +01:00
"args": ["None"]
2018-12-21 12:26:03 +01:00
},
{
"op": "Parse QR Code",
"args": [false]
}
]
},
{
name: "Parse QR Code : PNG",
input: "89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 7d 00 00 00 7d 08 00 00 00 00 aa eb 33 f9 00 00 01 06 49 44 41 54 78 da ed da cb 0e c3 20 0c 44 51 fe ff a7 db 5d a4 54 d8 99 29 01 24 73 59 75 91 f8 b0 70 79 38 6e 9f 9d a3 a1 a3 a3 a3 af d6 db f3 c8 9f b3 a2 a0 a3 5f ef c5 e9 79 8f 2f fc ca a3 a0 a3 77 22 f4 72 b9 17 eb 37 a0 13 05 1d 5d 7c cf 7a 0e 1d 7d 46 ce e7 2b 32 3a fa 2b fb 7b b8 c8 2e 39 5d a0 17 d4 d5 bb 8c ba fa ce b9 49 a1 97 d1 e5 62 4b 94 ee 4b aa 46 e8 b5 f4 5e de 86 1b b5 ba e7 87 41 d1 d1 c5 ac 56 27 28 ac d2 e8 e8 e9 dd c3 af e0 c8 45 1e f4 d3 75 f5 b3 47 5e b7 b6 8a d7 e8 e8 cf b5 67 6b f5 f5 6e d0 e8 a7 eb ea 5d 26 9f a5 90 f8 e8 c7 eb 23 75 1b 61 5a 6f 76 bc a0 d7 d2 d5 de 03 6b 82 61 64 74 74 eb 4b 9a d3 e2 12 9f 0d d0 d1 ff ea 3d b0 56 5f 74 f4 51 5d a8 4c e7 7f 0b 74 74 bb f7 40 d8 f8 27 76 3e a0 97 d1 47 8e 8c d6 77 3b 74 f4 4d 03 1d 1d 1d 7d cd f8 02 b8 db 6e a8 48 1e c7 f1 00 00 00 00 49 45 4e 44 ae 42 60 82",
expectedOutput: "Hello world!",
recipeConfig: [
{
"op": "From Hex",
"args": ["Space"]
},
{
"op": "Parse QR Code",
2018-12-25 22:54:38 +01:00
"args": [false]
2018-12-21 12:26:03 +01:00
},
],
},
{
name: "Parse QR Code : Transparent PNG",
input: "89504e470d0a1a0a0000000d49484452000000e8000000e80806000000e5a9a878000000017352474200aece1ce900000a49494441547801edddcb6e6db90d04d09ba0ffff97936b0499b20e4ccbb51fab8120035a22b5740a7b2024fdaf3f7ffefce7ef7f9efccfbf96874b3e69ffedfae5f8ebfb4de74bf3a5f3a7f5a9ff76ffd4bf5aff77b5bbe604088c02023af22812e80a0868d75f7702a380808e3c8a04ba0202daf5d79dc02820a0238f2281ae808076fd7527300afc3356ff574cef501f6c71f44fdaef60a9ffd6eff4feedf9d2f9b63f9eedf9b6fdd3faf1fcbea0894f9d405140408bf85a134802029a84d409140504b488af35812420a049489d405140408bf85a134802029a84d40914053e79074de38def3869f107f5f63b56ea7ffafc1f108d7f727afed3fb8f87fb81e2e9fb4b3ee3117c41471e45025d0101edfaeb4e601410d091479140574040bbfeba1318050474e45124d01510d0aebfee044601011d79140974057ee21db47b827df7f40e96deb1527d3fe1bc439a7f5efde74f9afff4fe69be57d77d415f7dfd0e7f750101bdfa0d99efd50202faeaeb77f8ab0b08e8d56fc87caf1610d0575fbfc35f5d4040af7e43e67bb58080befafa1dfeea02de41f33be0f60ed33b627a87dcf64ffb6fe7dbaedf9eefd1eb7d411f7dbd0e77770101bdfb0d9affd10202fae8eb75b8bb0b08e8dd6fd0fc8f1610d0475fafc3dd5d4040ef7e83e67fb480803efa7a1deeee023ff10e9aded9ae6e94def1d2fce9fca99efa6fd7a7f9533dcd97d65fbd9e7cabf3fb8256f93527300b08e8eca34aa02a20a0557ecd09cc02023afba812a80a0868955f7302b38080ce3eaa04aa02025ae5d79cc02cf0c93be8d3dfc166a1fcbf174d3e977e674b87ff5b4ff3a7f3a716697deabfdd3fadafd67d41abfc9a1398050474f65125501510d02abfe6046601019d7d5409540504b4caaf3981594040671f5502550101adf26b4e6016d8be31cdbbdfa39adee1d229b686dbfe69be544ff3a7f9b6ebb7f3a5f5b7aefb82defafa0cff7401017dfa0d3bdfad0504f4d6d767f8a70b08e8d36fd8f96e2d20a0b7be3ec33f5d40409f7ec3ce776b0101bdf5f519fee902e90debebfce91d2c197dd223ed31d5d37cdbfe69ff69b6afdad5fb5ffd7cc9eff4fc69ff345ffa7d8c755fd091479140574040bbfeba1318050474e45124d01510d0aebfee044601011d791409740504b4ebaf3b81514040471e45025d814ffe7f714f4f98de9952ffed3bd4b67f9a2fd553ff74beb43ef53fbd7feafff4faea7e7c419ffef370be5b0b08e8adafcff04f1710d0a7dfb0f3dd5a40406f7d7d867fba80803efd869defd602027aebeb33fcd30504f4e937ec7cb716486f603f71b8f40eb49d61bb7f5abf35d89e6fdb3fad4fe73f3dffe9fe57df7f9ccf1734fd7cd509140504b488af35812420a049489d405140408bf85a134802029a84d409140504b488af35812420a049489d4051e0eb8d6b7c87f95b3ffd0e76faf8e97ca97f3a7fda3fad4ffdb7f5f67ca9fff67cedf547efd717b47dbdfa1318040474c05122d01610d0f60de84f601010d0014789405b4040db37a03f81414040071c25026d01016ddf80fe040681af379cb7bf539d3effd177b2e16e3f2da5f39f9e3ff5fff41cdffdbb74be34dfd1f5bea0dfbd56eb08fc828080fe02b21604be2b20a0df95b38ec02f0808e82f206b41e0bb0202fa5d39eb08fc828080fe02b21604be2b20a0df95b38ec02f08fcc4bf1f74fb0eb43de6b6ff76fd76feedfaed3bdde9fe69ffe49fd6b7cf9fe64be71be7f7054dbcea048a02025ac4d79a401210d024a44ea02820a0457cad092401014d42ea048a02025ac4d79a401210d024a44ea02890de688aa37ddc7a7c47fabbcbddcfd83e5feafff1457df30fb7f797e64ffba7f5e958abfd7d4113af3a81a2808016f1b5269004043409a913280a0868115f6b0249404093903a81a2808016f1b5269004043409a913280aa4379a9f186dfb8e9466d89e613b5fea9ff6dfae3fed93f64fe74beb4fd76fedeb0b7afae7617f020b01015de0594ae0b480809e16b63f818580802ef02c25705a40404f0bdb9fc042404017789612382d20a0a785ed4f6021f0f546b47dc74aef4c8bf13e5a9ae6dfceb7ddfff4fa8f908a7f94fcdb3e69be2d5d3adfb8bf2fe8c8a348a02b20a05d7fdd098c02023af22812e80a0868d75f7702a380808e3c8a04ba0202daf5d79dc02820a0238f2281aec0d71b507aa749ef44edf549703bdf76ffb47e5b4ff793f6dffa6cd76fe74bebdb3e69bed1cf1734f1a913280a0868115f6b0249404093903a81a2808016f1b5269004043409a913280a0868115f6b0249404093903a81a2c0f68de86bf4f11da778b6ffb74e67dcce7f7affff9fe3bbffbd9d2fad4f7325dfedfea97faaa7f9d2fa544fe71bfbfb82265e75024501012de26b4d20090868125227501410d022bed604928080262175024501012de26b4d200908681252275014f87aa319df617e60b6f40e945aa4f9d2fea7d7a7f9b7f5edf9eedefff4fc69ffd3bf9ff17e7d41d3f5a813280a0868115f6b0249404093903a81a2808016f1b5269004043409a913280a0868115f6b0249404093903a81a2c0f806f3e15ca7df893e1ce3d89f25a3f6f9d37c09663bff76ffb4feeaf5e4bff2f505bdfaf59befd50202faeaeb77f8ab0b08e8d56fc87caf1610d0575fbfc35f5d4040af7e43e67bb58080befafa1dfeea02027af51b32dfab05d21bce1b70d23b5532681b6ee74fe74bf5edf9d3fcdbfdd3fca97f5a9fe65bedef0b9af8d509140504b488af35812420a049489d405140408bf85a13480
expectedOutput: "http://en.m.wikipedia.org",
recipeConfig: [
{
"op": "From Hex",
2018-12-25 22:54:38 +01:00
"args": ["None"]
2018-12-21 12:26:03 +01:00
},
{
"op": "Parse QR Code",
"args": [true]
},
],
},
{
name: "Parse QR Code : Angled code",
input: "89504e470d0a1a0a0000000d49484452000000d9000001010806000000f5a4008000000c45694343504943432050726f66696c65000048899557075853c9169e5b52496881084809bd89d2ab94105aa44a156c84249050624c082276655905d72e2260435744145d5d01592bf6b228f6fe5017959575b16043e54d0aaceb7eefbdef9d7c73ef7fcf9cf94fc9dcb93300e8d4f2a4d27c5417800249a12c31329435213d83457a0468f087003fe0c9e3cba5ec8484180065e8fe77797b035a42b9eaa2e4fa67ff7f153d8150ce07004980384b20e71740fc330078295f2a2b0480e80bf5d6330aa54a3c096203190c1062a912e7a871a91267a97195ca26399103f12e00c8341e4f960380762bd4b38af8399047fb16c4ae12815802800e19e220be882780380ae2510505d39418da0187acaf7872fec69935ccc9e3e50c63752e2a218789e5d27cdeccffb31cff5b0af215433eec60a389645189ca9c61dd6ee54d8b56621ac4bd92acb87888f5217e2f16a8ec2146a92245548ada1e35e5cb39b0668009b1ab8017160db129c41192fcb8188d3e2b5b1cc18518ce10b4585cc84dd68c5d2c94872769386b65d312e38770b68cc3d68c6de2c9547e95f6271579296c0dff2d91903bc4ffa644949ca68e19a3168953e320d6869829cf4b8a56db603625224edc908d4c91a88cdf06627fa1243254cd8f4dc99645246aec6505f2a17cb1c52231374e83ab0b45c9511a9e5d7c9e2a7e23885b851276ca108f503e2166281781302c5c9d3b76592849d1e48b75490b431335635f49f31334f63855981fa9d45b416c2a2f4ad28cc5830ae18454f3e371d2c28464759c78562e6f5c823a1ebc18c4000e08032ca0802d0b4c03b940dcd1dbd20b9fd43d11800764200708818b463334224dd52381d7245002fe804808e4c3e34255bd425004f59f87b5eaab0bc856f516a946e4812710178068900f9f15aa5192616fa9e037a811ffc33b1fc69a0f9bb2ef9f3a36d4c468348a215e96ce9025319c18468c2246101d71133c080fc063e035043677dc17f71b8af62f7bc2134227e111e13aa18b707baa78a1ec9b7c58201674410f119a9cb3bece19b783ac5e78281e08f92137cec44d800bee093db1f160e8db0b6a399ac895d97fcbfdb71cbeaabac68ee24a412923282114876f476a3b697b0db3286bfa7585d4b1660dd79533dcf3ad7fce579516c07bf4b796d8626c3f76063b8e9dc30e612d80851dc55ab18bd861251e9e45bfa966d190b744553c799047fc0f7f3c8d4f6525e5ae8dae3dae9fd47d85c262e5fa0838d3a43365e21c51218b0d577e218b2be18f1ec572777583abb6f23ba25ea65e3355df078479fe2fdda20b00049e1b1c1cfce52f5d743600fb4e0040fdcace7e9b7a2d3e5bcf57c88ad43a5c7921002ad0816f94313007d6c001e6e30ebc41000801e1601c8807c9201d4c815516c1f92c0333c06cb00094810ab002ac05d56013d80a7680dd601f680187c071701a5c0097c1757017ce9e6ef01cf481b7600041101242471888316281d822ce883be28b0421e1480c9288a42399480e224114c86c64115281ac42aa912d4803f2137210398e9c433a91dbc843a40779857c443194861aa066a81d3a06f545d968349a8c4e4673d0e968095a8a2e43abd03a7417da8c1e472fa0d7d12ef439da8f014c0b636296980be68b71b0782c03cbc664d85cac1cabc4eab026ac0dfecf57b12eac17fb80137106cec25de00c8ec253703e3e1d9f8b2fc5abf11d78337e12bf8a3fc4fbf02f043ac194e04cf0277009130839841984324225613be100e1147c9bba096f89442293684ff4816f633a3197388bb894b881b887788cd8497c4cec279148c624675220299ec4231592ca48eb49bb4847495748dda4f7642db205d99d1c41ce204bc80bc995e49de423e42be4a7e4018a2ec596e24f89a708283329cb29db286d944b946eca00558f6a4f0da4265373a90ba855d426ea29ea3dea6b2d2d2d2b2d3fadf15a62adf95a555a7bb5ce6a3dd4fa40d3a739d138b44934056d19ad9e768c769bf69a4ea7dbd143e819f442fa327a03fd04fd01fdbd36437bb436575ba03d4fbb46bb59fb8af60b1d8a8ead0e5b678a4e894ea5ce7e9d4b3abdba145d3b5d8e2e4f77ae6e8dee41dd9bbafd7a0c3d37bd78bd02bda57a3bf5cee93dd327e9dbe987eb0bf44bf5b7ea9fd07fccc018d60c0e83cf58c4d8c638c5e836201ad81b700d720d2a0c761b7418f419ea1b7a1aa61a161bd6181e36ec62624c3b269799cf5ccedcc7bcc1fc38c26c047b8470c492114d23ae8c786734d228c44868546eb4c7e8bad147639671b8719ef14ae316e3fb26b88993c9789319261b4d4e99f48e34181930923fb27ce4be91774c515327d344d359a65b4d2f9af69b999b459a49cdd69b9d30eb35679a8798e79aaf313f62de63c1b008b2105bacb1386af13bcb90c566e5b3aa5827597d96a69651960acb2d961d960356f65629560badf658ddb7a65afb5a675bafb16eb7eeb3b1b089b5996dd36873c79662eb6b2bb25d677bc6f69d9dbd5d9addf7762d76cfec8decb9f625f68df6f71ce80ec10ed31dea1cae39121d7d1df31c37385e76429dbc9c444e354e979c51676f67b1f306e7ce5184517ea324a3ea46dd74a1b9b05d8a5c1a5d1e8e668e8e19bd7074cbe817636cc6648c5939e6cc982fae5eaef9aedb5cefbae9bb8d735be8d6e6f6caddc99def5ee37ecd83ee11e131cfa3d5e3a5a7b3a7d073a3e72d2f8657acd7f75eed5e9fbd7dbc65de4dde3d3e363e993eb53e377d0d7c137c97fa9ef523f885facdf33be4f7c1dfdbbfd07f9fff9f012e0179013b039e8db51f2b1cbb6dece340a
expectedOutput: "https://globeon.mobi/jyri",
recipeConfig: [
{
"op": "From Hex",
2018-12-25 22:54:38 +01:00
"args": ["None"]
2018-12-21 12:26:03 +01:00
},
{
"op": "Parse QR Code",
"args": [true]
}
]
}
]);