diff --git a/.travis.yml b/.travis.yml index 805f6b45..bf4549e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ deploy: skip_cleanup: true email: "n1474335@gmail.com" api_key: - secure: "Z3FK6bm4RfQEIRXZ1lBNzQkVIoHpivThr9U+XBHmsBgIfdrK/XUnzs/slugo+NIz8nPiGmMx4gxyJonBCLHDGb1ysky2aEWTl26c0teaF4DeQEjWC1ZaGzv8MV1/GkUamnr1qouXjyUhyEAp33rd8ccN9Rq3QNYB/qLDcA9/FCme7JCW6sCd4zWO0LGEYMJEMc2FzAUkqhqsI05hegGhSDgKXRn5PmLARek4yHD+Hx7pstaTeQIy0WoGJjdzoB3iJIMmo/hWZGzZafktUOh223c5qzx4zMpDRNmMngBUw6R94nKd4KvplYRgB87Y3L/aiVU4CF+axwLmK8RPaC1wbJnlHf06zxHPdiFmsY/zKPpNel+nOnxzRrF5l2KMU4TU6gug3s9Jnzp9T5UMfhp0jW3YkxHGeuOPOeE1i0lTUWUGWrPHLQquAhLfkr2zxaU4ETk/y85hq9W4LAy0ENEDVXX2jP7FnI4Z1fdpmljpmVNJR+outPg6t+Coqgvil7v7XpMtDm8lKQanVYuxwmkb/ncOWFRWuM2j5zIEg3CHnFDcJ9bYrfKRg0b0tb/2BWD14pQnV76goVwzJQYVzdPc8TKIYJw2BZ1Nh9c0iruQVebe/6l1FX9fDCkz8VMmltni61/LxZrf8y0NT1YaU1raeNY2dH5UWvEa9p72FPMI6Eg=" + secure: "UnDQL3Kh+GK2toL0TK3FObO0ujVssU3Eg4BBuYdjwLB81GhiGE5/DTh7THdZPOpbLo6wQeOwfZDuMeKC1OU+0Uf4NsdYFu1aq6xMO20qBQ4qUfgsyiK4Qgywj9gk0p1+OFZdGAZ/j1CNRAaF71XQIY6iV84c+SO4WoizXYrNT0Jh4sr2DA4/97G2xmJtPi0qOzYrJ09R56ZUozmqeik5G0pMRIuJRbpjS/7bZXV+N7WV0ombZc9RkUaetbabEVOLQ+Xx5YAIVq+VuEeMe9VBSnxY/FfCLmy1wJsjGzpLCyBI9nbrG4nw8Wgc2m8NfK9rcpIvBTGner9r2j60NVDkZ8kLZPrqXhq6AZMwa+oz6K5UQCqRo2RRQzSGwXxg67HY5Tcq+oNmjd+DqpPg4LZ3eGlluyP5XfG+hpSr9Ya4d8q8SrUWLxkoLHI6ZKMtoKFbTCSSQPiluW5hsZxjz3yDkkjsJw64M/EM8UyJrgaXqDklQu+7rBGKLfsK6os7RDiqjBWpQ7gwpo8HvY0O8yqEAabPz+QGkanpjcCOZCXFbSkzWxYy37RMAPu88iINVZVlZE4l+WJenCpZY95ueyy0mG9cyMSzVRPyX6A+/n4H6VMFPFjpGDLTD588ACEjY1lmHfS/eXwXJcgqPPD2gW0XdRdUheU/ssqlfCfGWQMTDXs=" on: tags: true branch: master diff --git a/CHANGELOG.md b/CHANGELOG.md index ad6e8be9..28f946b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,36 +1,93 @@ # Changelog -All notable changes to this project will be documented in this file. +All notable changes to CyberChef will be documented in this file. + + +### [8.7.0] - 2018-08-31 +- 'JWT Sign', 'JWT Verify' and 'JWT Decode' operations added [@GCHQ77703] | [#348] + +### [8.6.0] - 2018-08-29 +- 'To Geohash' and 'From Geohash' operations added [@GCHQ77703] | [#344] + +### [8.5.0] - 2018-08-23 +- 'To Braille' and 'From Braille' operations added [@n1474335] | [#255] + +### [8.4.0] - 2018-08-23 +- 'To Base85' and 'From Base85' operations added [@PenguinGeorge] | [#340] + +### [8.3.0] - 2018-08-21 +- 'To MessagePack' and 'From MessagePack' operations added [@artemisbot] | [#338] + +### [8.2.0] - 2018-08-21 +- Information links added to most operations, accessible in the description popover [@PenguinGeorge] | [#298] + +### [8.1.0] - 2018-08-19 +- 'Dechunk HTTP response' operation added [@sevzero] | [#311] ## [8.0.0] - 2018-08-05 -- Codebase rewritten using [ES modules](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/) and [classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) #284 -- Operation architecture restructured to make adding new operations a lot simpler #284 -- A script has been added to aid in the creation of new operations by running `npm run newop` @n1474335 #284 -- 'Magic' operation added - [automated detection of encoded data](https://github.com/gchq/CyberChef/wiki/Automatic-detection-of-encoded-data-using-CyberChef-Magic) @n1474335 #239 -- UI updated to use [Bootstrap Material Design](https://fezvrasta.github.io/bootstrap-material-design/) @n1474335 #248 -- `JSON`, `File` and `List` Dish types added @n1474335 #284 -- `OperationError` type added for better handling of errors thrown by operations @d98762625 #296 -- A `present()` method has been added, allowing operations to pass machine-friendly data to subsequent operations whilst presenting human-friendly data to the user @n1474335 #284 -- Set operations added @d98762625 #281 -- 'To Table' operation added @JustAnotherMark #294 -- 'Haversine distance' operation added @Dachande663 #325 -- Started keeping a changelog @n1474335 +- Codebase rewritten using [ES modules](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/) and [classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) [@n1474335] [@d98762625] [@artemisbot] [@picapi] | [#284] +- Operation architecture restructured to make adding new operations a lot simpler [@n1474335] | [#284] +- A script has been added to aid in the creation of new operations by running `npm run newop` [@n1474335] | [#284] +- 'Magic' operation added - [automated detection of encoded data](https://github.com/gchq/CyberChef/wiki/Automatic-detection-of-encoded-data-using-CyberChef-Magic) [@n1474335] | [#239] +- UI updated to use [Bootstrap Material Design](https://fezvrasta.github.io/bootstrap-material-design/) [@n1474335] | [#248] +- `JSON`, `File` and `List` Dish types added [@n1474335] | [#284] +- `OperationError` type added for better handling of errors thrown by operations [@d98762625] | [#296] +- A `present()` method has been added, allowing operations to pass machine-friendly data to subsequent operations whilst presenting human-friendly data to the user [@n1474335] | [#284] +- Set operations added [@d98762625] | [#281] +- 'To Table' operation added [@JustAnotherMark] | [#294] +- 'Haversine distance' operation added [@Dachande663] | [#325] +- Started keeping a changelog [@n1474335] ## [7.0.0] - 2017-12-28 -- Added support for loading, processing and downloading files up to 500MB @n1474335 #224 +- Added support for loading, processing and downloading files up to 500MB [@n1474335] | [#224] ## [6.0.0] - 2017-09-19 -- Added threading support, moving all recipe processing into a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) to increase performance and allow long-running operations to be cancelled @n1474335 #173 -- Created modules so that operations relying on large libraries can be downloaded separately as required, reducing the initial loading time for the app @n1474335 #173 +- Threading support added. All recipe processing moved into a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) to increase performance and allowing long-running operations to be cancelled [@n1474335] | [#173] +- Module system created so that operations relying on large libraries can be downloaded separately as required, reducing the initial loading time for the app [@n1474335] | [#173] ## [5.0.0] - 2017-03-30 -- Configured Webpack build process, Babel transpilation and ES6 imports and exports @n1474335 #95 +- Webpack build process configured with Babel transpilation and ES6 imports and exports [@n1474335] | [#95] ## [4.0.0] - 2016-11-28 -- Initial open source commit @n1474335 +- Initial open source commit [@n1474335] | [b1d73a72](https://github.com/gchq/CyberChef/commit/b1d73a725dc7ab9fb7eb789296efd2b7e4b08306) +[8.7.0]: https://github.com/gchq/CyberChef/releases/tag/v8.7.0 +[8.6.0]: https://github.com/gchq/CyberChef/releases/tag/v8.6.0 +[8.5.0]: https://github.com/gchq/CyberChef/releases/tag/v8.5.0 +[8.4.0]: https://github.com/gchq/CyberChef/releases/tag/v8.4.0 +[8.3.0]: https://github.com/gchq/CyberChef/releases/tag/v8.3.0 +[8.2.0]: https://github.com/gchq/CyberChef/releases/tag/v8.2.0 +[8.1.0]: https://github.com/gchq/CyberChef/releases/tag/v8.1.0 [8.0.0]: https://github.com/gchq/CyberChef/releases/tag/v8.0.0 [7.0.0]: https://github.com/gchq/CyberChef/releases/tag/v7.0.0 [6.0.0]: https://github.com/gchq/CyberChef/releases/tag/v6.0.0 [5.0.0]: https://github.com/gchq/CyberChef/releases/tag/v5.0.0 [4.0.0]: https://github.com/gchq/CyberChef/commit/b1d73a725dc7ab9fb7eb789296efd2b7e4b08306 + +[@n1474335]: https://github.com/n1474335 +[@d98762625]: https://github.com/d98762625 +[@GCHQ77703]: https://github.com/GCHQ77703 +[@artemisbot]: https://github.com/artemisbot +[@picapi]: https://github.com/picapi +[@Dachande663]: https://github.com/Dachande663 +[@JustAnotherMark]: https://github.com/JustAnotherMark +[@sevzero]: https://github.com/sevzero +[@PenguinGeorge]: https://github.com/PenguinGeorge + +[#95]: https://github.com/gchq/CyberChef/pull/299 +[#173]: https://github.com/gchq/CyberChef/pull/173 +[#224]: https://github.com/gchq/CyberChef/pull/224 +[#239]: https://github.com/gchq/CyberChef/pull/239 +[#248]: https://github.com/gchq/CyberChef/pull/248 +[#255]: https://github.com/gchq/CyberChef/issues/255 +[#281]: https://github.com/gchq/CyberChef/pull/281 +[#284]: https://github.com/gchq/CyberChef/pull/284 +[#294]: https://github.com/gchq/CyberChef/pull/294 +[#296]: https://github.com/gchq/CyberChef/pull/296 +[#298]: https://github.com/gchq/CyberChef/pull/298 +[#311]: https://github.com/gchq/CyberChef/pull/311 +[#325]: https://github.com/gchq/CyberChef/pull/325 +[#338]: https://github.com/gchq/CyberChef/pull/338 +[#340]: https://github.com/gchq/CyberChef/pull/340 +[#344]: https://github.com/gchq/CyberChef/pull/344 +[#348]: https://github.com/gchq/CyberChef/pull/348 diff --git a/Gruntfile.js b/Gruntfile.js index 60241bc7..c6b3fe70 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -22,7 +22,7 @@ module.exports = function (grunt) { // Tasks grunt.registerTask("dev", "A persistent task which creates a development build whenever source files are modified.", - ["clean:dev", "exec:generateConfig", "concurrent:dev"]); + ["clean:dev", "clean:config", "exec:generateConfig", "concurrent:dev"]); grunt.registerTask("node", "Compiles CyberChef into a single NodeJS module.", @@ -38,7 +38,7 @@ module.exports = function (grunt) { grunt.registerTask("prod", "Creates a production-ready build. Use the --msg flag to add a compile message.", - ["eslint", "clean:prod", "exec:generateConfig", "webpack:web", "inline", "chmod"]); + ["eslint", "clean:prod", "clean:config", "exec:generateConfig", "webpack:web", "inline", "chmod"]); grunt.registerTask("default", "Lints the code base", @@ -381,11 +381,12 @@ module.exports = function (grunt) { generateConfig: { command: [ "echo '\n--- Regenerating config files. ---'", - "node --experimental-modules src/core/config/scripts/generateOpsIndex.mjs", + // "node --experimental-modules src/core/config/scripts/generateOpsIndex.mjs", "mkdir -p src/core/config/modules", "echo 'export default {};\n' > src/core/config/modules/OpModules.mjs", "echo '[]\n' > src/core/config/OperationConfig.json", - "node --experimental-modules src/core/config/scripts/generateConfig.mjs", + "node --experimental-modules --no-warnings --no-deprecation src/core/config/scripts/generateOpsIndex.mjs", + "node --experimental-modules --no-warnings --no-deprecation src/core/config/scripts/generateConfig.mjs", "echo '--- Config scripts finished. ---\n'" ].join(";") }, @@ -406,7 +407,7 @@ module.exports = function (grunt) { ].join(";"), }, tests: { - command: "node --experimental-modules test/index.mjs" + command: "node --experimental-modules --no-warnings --no-deprecation test/index.mjs" } }, }); diff --git a/README.md b/README.md index d1960abb..e6d835a8 100755 --- a/README.md +++ b/README.md @@ -88,9 +88,8 @@ Contributing a new operation to CyberChef is super easy! There is a quickstart s An installation walkthrough, how-to guides for adding new operations and themes, descriptions of the repository structure, available data types and coding conventions can all be found in the project [wiki pages](https://github.com/gchq/CyberChef/wiki). - - Sign the [GCHQ Contributor Licence Agreement](https://github.com/gchq/Gaffer/wiki/GCHQ-OSS-Contributor-License-Agreement-V1.0) - Push your changes to your fork. - - Submit a pull request. + - Submit a pull request. If you are doing this for the first time, you will be prompted to sign the [GCHQ Contributor Licence Agreement](https://cla-assistant.io/gchq/CyberChef) via the CLA assistant on the pull request. This will also ask whether you are happy for GCHQ to contact you about a token of thanks for your contribution, or about job opportunities at GCHQ. ## Licencing diff --git a/package-lock.json b/package-lock.json index d58f6c9b..6103983b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.0.1", + "version": "8.7.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1795,6 +1795,11 @@ "isarray": "1.0.0" } }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -2865,6 +2870,13 @@ "repeating": "2.0.1" } }, + "detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", + "dev": true, + "optional": true + }, "detect-node": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.3.tgz", @@ -3038,6 +3050,14 @@ } } }, + "ecdsa-sig-formatter": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz", + "integrity": "sha1-HFlQAPBKiJffuFAAiSoPTDOvhsM=", + "requires": { + "safe-buffer": "5.1.2" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -4218,6 +4238,16 @@ "klaw": "1.3.1" } }, + "fs-minipass": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", + "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", + "dev": true, + "optional": true, + "requires": { + "minipass": "2.3.4" + } + }, "fs-write-stream-atomic": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", @@ -4244,525 +4274,7 @@ "optional": true, "requires": { "nan": "2.10.0", - "node-pre-gyp": "0.10.0" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "delegates": "1.0.0", - "readable-stream": "2.3.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "dev": true, - "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "debug": { - "version": "2.6.9", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ms": "2.0.0" - } - }, - "deep-extend": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "2.2.4" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aproba": "1.2.0", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" - } - }, - "glob": { - "version": "7.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.21", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safer-buffer": "2.1.2" - } - }, - "ignore-walk": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minimatch": "3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true, - "dev": true - }, - "ini": { - "version": "1.3.5", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "1.1.11" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, - "minipass": { - "version": "2.2.4", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "5.1.1", - "yallist": "3.0.2" - } - }, - "minizlib": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "2.2.4" - } - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "needle": { - "version": "2.2.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "2.6.9", - "iconv-lite": "0.4.21", - "sax": "1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.10.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "detect-libc": "1.0.3", - "mkdirp": "0.5.1", - "needle": "2.2.0", - "nopt": "4.0.1", - "npm-packlist": "1.1.10", - "npmlog": "4.1.2", - "rc": "1.2.7", - "rimraf": "2.6.2", - "semver": "5.5.0", - "tar": "4.4.1" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1.1.1", - "osenv": "0.1.5" - } - }, - "npm-bundled": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "npm-packlist": { - "version": "1.1.10", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ignore-walk": "3.0.1", - "npm-bundled": "1.0.3" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1.0.2" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "0.5.1", - "ini": "1.3.5", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.1", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" - } - }, - "rimraf": { - "version": "2.6.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "glob": "7.1.2" - } - }, - "safe-buffer": { - "version": "5.1.1", - "bundled": true, - "dev": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "bundled": true, - "dev": true, - "optional": true - }, - "semver": { - "version": "5.5.0", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "4.4.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "chownr": "1.0.1", - "fs-minipass": "1.2.5", - "minipass": "2.2.4", - "minizlib": "1.1.0", - "mkdirp": "0.5.1", - "safe-buffer": "5.1.1", - "yallist": "3.0.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "wide-align": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "string-width": "1.0.2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "yallist": { - "version": "3.0.2", - "bundled": true, - "dev": true - } + "node-pre-gyp": "0.10.3" } }, "fstream": { @@ -5781,6 +5293,16 @@ "integrity": "sha512-Q2daVnMtQJPacGrcCRyOEiI+syPCt+mR4YotoC0KEYeinV/6HztT5mUuVEj7UYyoNZ1jGYiu2XEem7I8oM44bg==", "dev": true }, + "ignore-walk": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", + "dev": true, + "optional": true, + "requires": { + "minimatch": "3.0.4" + } + }, "import-cwd": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", @@ -6605,6 +6127,29 @@ } } }, + "jsonwebtoken": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.3.0.tgz", + "integrity": "sha512-oge/hvlmeJCH+iIz1DwcO7vKPkNGJHhgkspk8OH3VKlw+mbi42WtD4ig1+VXRln765vxptAv+xT26Fd3cteqag==", + "requires": { + "jws": "3.1.5", + "lodash.includes": "4.3.0", + "lodash.isboolean": "3.0.3", + "lodash.isinteger": "4.0.4", + "lodash.isnumber": "3.0.3", + "lodash.isplainobject": "4.0.6", + "lodash.isstring": "4.0.1", + "lodash.once": "4.1.1", + "ms": "2.1.1" + }, + "dependencies": { + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + } + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -6622,6 +6167,25 @@ "resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-8.0.12.tgz", "integrity": "sha1-Iqu5ZW00owuVMENnIINeicLlwxY=" }, + "jwa": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.6.tgz", + "integrity": "sha512-tBO/cf++BUsJkYql/kBbJroKOgHWEigTKBAjjBEmrMGYd1QMBC74Hr4Wo2zCZw6ZrVhlJPvoMrkcOnlWR/DJfw==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.10", + "safe-buffer": "5.1.2" + } + }, + "jws": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.5.tgz", + "integrity": "sha512-GsCSexFADNQUr8T5HPJvayTjvPIfoyJPtLQBwn5a4WZQchcrPMPMAWcC1AzJVRDKyD6ZPROPAxgv6rfHViO4uQ==", + "requires": { + "jwa": "1.1.6", + "safe-buffer": "5.1.2" + } + }, "kbpgp": { "version": "2.0.77", "resolved": "https://registry.npmjs.org/kbpgp/-/kbpgp-2.0.77.tgz", @@ -6817,17 +6381,35 @@ "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=", "dev": true }, + "lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" + }, + "lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" + }, + "lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" + }, + "lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" + }, "lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", - "dev": true + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" }, "lodash.isstring": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=", - "dev": true + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" }, "lodash.mergewith": { "version": "4.6.1", @@ -6835,6 +6417,11 @@ "integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==", "dev": true }, + "lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" + }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", @@ -7148,6 +6735,34 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, + "minipass": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.4.tgz", + "integrity": "sha512-mlouk1OHlaUE8Odt1drMtG1bAJA4ZA6B/ehysgV0LUIrDHdKgo1KorZq3pK0b/7Z7LJIQ12MNM6aC+Tn6lUZ5w==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2", + "yallist": "3.0.2" + }, + "dependencies": { + "yallist": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", + "dev": true + } + } + }, + "minizlib": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz", + "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", + "dev": true, + "optional": true, + "requires": { + "minipass": "2.3.4" + } + }, "mississippi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", @@ -7333,6 +6948,18 @@ "integrity": "sha1-0VNn5cuHQyuhF9K/gP30Wuz7QkY=", "dev": true }, + "needle": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.2.2.tgz", + "integrity": "sha512-mW7W8dKuVYefCpNzE3Z7xUmPI9wSrSL/1qH31YGMxmSOAnjatS3S9Zv3cmiHrhx3Jkp1SrWWBdOFXjfF48Uq3A==", + "dev": true, + "optional": true, + "requires": { + "debug": "2.6.9", + "iconv-lite": "0.4.23", + "sax": "1.2.4" + } + }, "negotiator": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", @@ -7351,6 +6978,11 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, + "ngeohash": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/ngeohash/-/ngeohash-0.6.0.tgz", + "integrity": "sha1-MpcT6ec9HxpG2SqrC5StuUUz9oc=" + }, "nice-try": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.4.tgz", @@ -7536,6 +7168,61 @@ "resolved": "https://registry.npmjs.org/node-md6/-/node-md6-0.1.0.tgz", "integrity": "sha1-9WH0WyszY1K4KXbFHMoRR9U5N/U=" }, + "node-pre-gyp": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz", + "integrity": "sha512-d1xFs+C/IPS8Id0qPTZ4bUT8wWryfR/OzzAFxweG+uLN85oPzyo2Iw6bVlLQ/JOdgNonXLCoRyqDzDWq4iw72A==", + "dev": true, + "optional": true, + "requires": { + "detect-libc": "1.0.3", + "mkdirp": "0.5.1", + "needle": "2.2.2", + "nopt": "4.0.1", + "npm-packlist": "1.1.11", + "npmlog": "4.1.2", + "rc": "1.2.7", + "rimraf": "2.6.2", + "semver": "5.5.0", + "tar": "4.4.6" + }, + "dependencies": { + "nopt": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "dev": true, + "optional": true, + "requires": { + "abbrev": "1.1.1", + "osenv": "0.1.5" + } + }, + "tar": { + "version": "4.4.6", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.6.tgz", + "integrity": "sha512-tMkTnh9EdzxyfW+6GK6fCahagXsnYk6kE6S9Gr9pjVdys769+laCTbodXDhPAjzVtEBazRgP0gYqOjnk9dQzLg==", + "dev": true, + "optional": true, + "requires": { + "chownr": "1.0.1", + "fs-minipass": "1.2.5", + "minipass": "2.3.4", + "minizlib": "1.1.0", + "mkdirp": "0.5.1", + "safe-buffer": "5.1.2", + "yallist": "3.0.2" + } + }, + "yallist": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", + "dev": true, + "optional": true + } + } + }, "node-releases": { "version": "1.0.0-alpha.10", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.0.0-alpha.10.tgz", @@ -7669,6 +7356,29 @@ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", "dev": true }, + "notepack.io": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/notepack.io/-/notepack.io-2.1.3.tgz", + "integrity": "sha512-AgSt+cP5XMooho1Ppn8NB3FFaVWefV+qZoZncYTUSch2GAEwlYLcIIbT5YVkMlFeNHnfwOvc4HDlbvrB5BRxXA==" + }, + "npm-bundled": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.5.tgz", + "integrity": "sha512-m/e6jgWu8/v5niCUKQi9qQl8QdeEduFA96xHDDzFGqly0OOjI7c+60KM/2sppfnUU9JJagf+zs+yGhqSOFj71g==", + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.1.11.tgz", + "integrity": "sha512-CxKlZ24urLkJk+9kCm48RTQ7L4hsmgSVzEk0TLGPzzyuFxD7VNgy5Sl24tOLMzQv773a/NeJ1ce1DKeacqffEA==", + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "3.0.1", + "npm-bundled": "1.0.5" + } + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -9383,8 +9093,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "safe-json-parse": { "version": "1.0.1", diff --git a/package.json b/package.json index a78c0f54..4626446a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.0.1", + "version": "8.7.0", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", @@ -100,6 +100,7 @@ "jsbn": "^1.1.0", "jsesc": "^2.5.1", "jsonpath": "^1.0.0", + "jsonwebtoken": "^8.3.0", "jsrsasign": "8.0.12", "kbpgp": "^2.0.77", "lodash": "^4.17.10", @@ -107,8 +108,10 @@ "loglevel-message-prefix": "^3.0.0", "moment": "^2.22.2", "moment-timezone": "^0.5.21", + "ngeohash": "^0.6.0", "node-forge": "^0.7.5", "node-md6": "^0.1.0", + "notepack.io": "^2.1.3", "nwmatcher": "^1.4.4", "otp": "^0.1.3", "popper.js": "^1.14.4", diff --git a/src/core/Dish.mjs b/src/core/Dish.mjs index 7a7efdc4..3a4398f2 100755 --- a/src/core/Dish.mjs +++ b/src/core/Dish.mjs @@ -182,7 +182,7 @@ class Dish { this.value = this.value instanceof BigNumber ? Utils.strToByteArray(this.value.toFixed()) : []; break; case Dish.JSON: - this.value = this.value ? Utils.strToByteArray(JSON.stringify(this.value)) : []; + this.value = this.value ? Utils.strToByteArray(JSON.stringify(this.value, null, 4)) : []; break; case Dish.FILE: this.value = await Utils.readFile(this.value); diff --git a/src/core/Operation.mjs b/src/core/Operation.mjs index cdeb9a73..3f5df52f 100755 --- a/src/core/Operation.mjs +++ b/src/core/Operation.mjs @@ -29,6 +29,7 @@ class Operation { this.name = ""; this.module = ""; this.description = ""; + this.infoURL = null; } diff --git a/src/core/Utils.mjs b/src/core/Utils.mjs index 78d4d97d..ab3d4281 100755 --- a/src/core/Utils.mjs +++ b/src/core/Utils.mjs @@ -8,6 +8,7 @@ import utf8 from "utf8"; import moment from "moment-timezone"; import {fromBase64} from "./lib/Base64"; import {fromHex} from "./lib/Hex"; +import {fromDecimal} from "./lib/Decimal"; /** @@ -297,7 +298,7 @@ class Utils { * Accepts hex, Base64, UTF8 and Latin1 strings. * * @param {string} str - * @param {string} type - One of "Hex", "Base64", "UTF8" or "Latin1" + * @param {string} type - One of "Hex", "Decimal", "Base64", "UTF8" or "Latin1" * @returns {byteArray} * * @example @@ -314,6 +315,8 @@ class Utils { switch (type.toLowerCase()) { case "hex": return fromHex(str); + case "decimal": + return fromDecimal(str); case "base64": return fromBase64(str, null, "byteArray"); case "utf8": @@ -330,7 +333,7 @@ class Utils { * Accepts hex, Base64, UTF8 and Latin1 strings. * * @param {string} str - * @param {string} type - One of "Hex", "Base64", "UTF8" or "Latin1" + * @param {string} type - One of "Hex", "Decimal", "Base64", "UTF8" or "Latin1" * @returns {string} * * @example @@ -347,6 +350,8 @@ class Utils { switch (type.toLowerCase()) { case "hex": return Utils.byteArrayToChars(fromHex(str)); + case "decimal": + return Utils.byteArrayToChars(fromDecimal(str)); case "base64": return Utils.byteArrayToChars(fromBase64(str, null, "byteArray")); case "utf8": @@ -769,7 +774,7 @@ class Utils { args = m[2] .replace(/"/g, '\\"') // Escape double quotes .replace(/(^|,|{|:)'/g, '$1"') // Replace opening ' with " - .replace(/([^\\])'(,|:|}|$)/g, '$1"$2') // Replace closing ' with " + .replace(/([^\\]|[^\\]\\\\)'(,|:|}|$)/g, '$1"$2') // Replace closing ' with " .replace(/\\'/g, "'"); // Unescape single quotes args = "[" + args + "]"; diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index 7c234d0e..ca762f1d 100755 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -25,6 +25,8 @@ "From Base32", "To Base58", "From Base58", + "To Base85", + "From Base85", "To Base", "From Base", "To BCD", @@ -47,7 +49,11 @@ "Change IP format", "Encode text", "Decode text", - "Swap endianness" + "Swap endianness", + "To MessagePack", + "From MessagePack", + "To Braille", + "From Braille" ] }, { @@ -83,6 +89,9 @@ "Derive EVP key", "Bcrypt", "Scrypt", + "JWT Sign", + "JWT Verify", + "JWT Decode", "Pseudo-Random Number Generator" ] }, @@ -137,6 +146,7 @@ "ops": [ "HTTP request", "Strip HTTP headers", + "Dechunk HTTP response", "Parse User Agent", "Parse IP range", "Parse IPv6 address", @@ -282,7 +292,9 @@ "Adler-32 Checksum", "CRC-16 Checksum", "CRC-32 Checksum", - "TCP/IP Checksum" + "TCP/IP Checksum", + "To Geohash", + "From Geohash" ] }, { @@ -312,7 +324,9 @@ "To Camel case", "To Kebab case", "BSON serialise", - "BSON deserialise" + "BSON deserialise", + "To MessagePack", + "From MessagePack" ] }, { diff --git a/src/core/config/scripts/generateConfig.mjs b/src/core/config/scripts/generateConfig.mjs index 2ee121ce..7f0dfc59 100644 --- a/src/core/config/scripts/generateConfig.mjs +++ b/src/core/config/scripts/generateConfig.mjs @@ -35,12 +35,13 @@ for (const opObj in Ops) { const op = new Ops[opObj](); operationConfig[op.name] = { - module: op.module, + module: op.module, description: op.description, - inputType: op.inputType, - outputType: op.presentType, + infoURL: op.infoURL, + inputType: op.inputType, + outputType: op.presentType, flowControl: op.flowControl, - args: op.args + args: op.args }; if (op.hasOwnProperty("patterns")) { diff --git a/src/core/config/scripts/newOperation.mjs b/src/core/config/scripts/newOperation.mjs index f6620ffa..88b86296 100644 --- a/src/core/config/scripts/newOperation.mjs +++ b/src/core/config/scripts/newOperation.mjs @@ -53,6 +53,12 @@ If your operation does not rely on a library, just leave this blank and it will prompt: "Description", type: "string" }, + infoURL: { + description: "An optional URL for an external site can be added to give more information about the operation. Wikipedia links are often suitable. If linking to Wikipedia, use an international link (e.g. https://wikipedia.org/...) rather than a localised link (e.g. https://en.wikipedia.org/...).", + example: "https://wikipedia.org/wiki/Percent-encoding", + prompt: "Information URL", + type: "string", + }, inputType: { description: `The input type defines how the input data will be presented to your operation. Check the project wiki for a full description of each type. The options are: ${ioTypes.join(", ")}.`, example: "string", @@ -141,6 +147,7 @@ class ${moduleName} extends Operation { this.name = "${result.opName}"; this.module = "${result.module}"; this.description = "${(new EscapeString).run(result.description, ["Special chars", "Double"])}"; + this.infoURL = "${result.infoURL}"; this.inputType = "${result.inputType}"; this.outputType = "${result.outputType}"; this.args = [ diff --git a/src/core/lib/Base64.mjs b/src/core/lib/Base64.mjs index dd4ab878..9e721bf6 100755 --- a/src/core/lib/Base64.mjs +++ b/src/core/lib/Base64.mjs @@ -81,6 +81,7 @@ export function fromBase64(data, alphabet="A-Za-z0-9+/=", returnType="string", r return returnType === "string" ? "" : []; } + alphabet = alphabet || "A-Za-z0-9+/="; alphabet = Utils.expandAlphRange(alphabet).join(""); const output = []; diff --git a/src/core/lib/Base85.mjs b/src/core/lib/Base85.mjs new file mode 100644 index 00000000..18ba5ef8 --- /dev/null +++ b/src/core/lib/Base85.mjs @@ -0,0 +1,45 @@ +/** + * Base85 resources. + * + * @author PenguinGeorge [george@penguingeorge.com] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +/** + * Base85 alphabet options. + */ +export const ALPHABET_OPTIONS = [ + { + name: "Standard", + value: "!-u", + }, + { + name: "Z85 (ZeroMQ)", + value: "0-9a-zA-Z.\\-:+=^!/*?&<>()[]{}@%$#", + }, + { + name: "IPv6", + value: "0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|~}", + } +]; + + +/** + * Returns the name of the alphabet, when given the alphabet. + * + * @param {string} alphabet + * @returns {string} + */ +export function alphabetName(alphabet) { + alphabet = alphabet.replace("'", "'"); + alphabet = alphabet.replace("\"", """); + alphabet = alphabet.replace("\\", "\"); + let name; + + ALPHABET_OPTIONS.forEach(function(a) { + if (escape(alphabet) === escape(a.value)) name = a.name; + }); + + return name; +} diff --git a/src/core/lib/BitwiseOp.mjs b/src/core/lib/BitwiseOp.mjs index b7cf7c97..dbac3c5a 100644 --- a/src/core/lib/BitwiseOp.mjs +++ b/src/core/lib/BitwiseOp.mjs @@ -25,6 +25,7 @@ export function bitOp (input, key, func, nullPreserving, scheme) { for (let i = 0; i < input.length; i++) { k = key[i % key.length]; + if (scheme === "Cascade") k = input[i + 1] || 0; o = input[i]; x = nullPreserving && (o === 0 || o === k) ? o : func(o, k); result.push(x); diff --git a/src/core/lib/Braille.mjs b/src/core/lib/Braille.mjs new file mode 100644 index 00000000..098c0e73 --- /dev/null +++ b/src/core/lib/Braille.mjs @@ -0,0 +1,15 @@ +/** + * Braille resources. + * + * @author n1474335 [n1474335@gmail.com] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +/** + * Braille lookup table. + */ +export const BRAILLE_LOOKUP = { + ascii: " A1B'K2L@CIF/MSP\"E3H9O6R^DJG>NTQ,*5<-U8V.%[$+X!&;:4\\0Z7(_?W]#Y)=", + dot6: "⠀⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿" +}; diff --git a/src/core/lib/Decimal.mjs b/src/core/lib/Decimal.mjs new file mode 100644 index 00000000..846b2a94 --- /dev/null +++ b/src/core/lib/Decimal.mjs @@ -0,0 +1,37 @@ +/** + * Decimal functions. + * + * @author n1474335 [n1474335@gmail.com] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Utils from "../Utils"; + + +/** + * Convert a string of decimal values into a byte array. + * + * @param {string} data + * @param {string} [delim] + * @returns {byteArray} + * + * @example + * // returns [10,20,30] + * fromDecimal("10 20 30"); + * + * // returns [10,20,30] + * fromDecimal("10:20:30", "Colon"); + */ +export function fromDecimal(data, delim="Auto") { + delim = Utils.charRep(delim); + const output = []; + let byteStr = data.split(delim); + if (byteStr[byteStr.length-1] === "") + byteStr = byteStr.slice(0, byteStr.length-1); + + for (let i = 0; i < byteStr.length; i++) { + output[i] = parseInt(byteStr[i], 10); + } + return output; +} diff --git a/src/core/lib/Hex.mjs b/src/core/lib/Hex.mjs index 538ba44b..760d84b5 100644 --- a/src/core/lib/Hex.mjs +++ b/src/core/lib/Hex.mjs @@ -1,5 +1,5 @@ /** - * Byte representation functions. + * Hexadecimal functions. * * @author n1474335 [n1474335@gmail.com] * @copyright Crown Copyright 2016 @@ -83,8 +83,7 @@ export function toHexFast(data) { * // returns [10,20,30] * fromHex("0a:14:1e", "Colon"); */ -export function fromHex(data, delim, byteLen=2) { - delim = delim || "Auto"; +export function fromHex(data, delim="Auto", byteLen=2) { if (delim !== "None") { const delimRegex = delim === "Auto" ? /[^a-f\d]/gi : Utils.regexRep(delim); data = data.replace(delimRegex, ""); diff --git a/src/core/lib/IP.mjs b/src/core/lib/IP.mjs index 8a8301a6..cfefbd11 100644 --- a/src/core/lib/IP.mjs +++ b/src/core/lib/IP.mjs @@ -3,6 +3,7 @@ * * @author picapi * @author n1474335 [n1474335@gmail.com] + * @author Klaxon [klaxon@veyr.com] * @copyright Crown Copyright 2016 * @license Apache-2.0 */ @@ -109,8 +110,8 @@ export function ipv6CidrRange(cidr, includeNetworkInfo) { * @returns {string} */ export function ipv4HyphenatedRange(range, includeNetworkInfo, enumerateAddresses, allowLargeList) { - const ip1 = strToIpv4(range[1]), - ip2 = strToIpv4(range[2]); + const ip1 = strToIpv4(range[0].split("-")[0].trim()), + ip2 = strToIpv4(range[0].split("-")[1].trim()); let output = ""; @@ -162,8 +163,8 @@ Total addresses in range: ${(((ip2 - ip1) >>> 0) + 1)} * @returns {string} */ export function ipv6HyphenatedRange(range, includeNetworkInfo) { - const ip1 = strToIpv6(range[1]), - ip2 = strToIpv6(range[14]), + const ip1 = strToIpv6(range[0].split("-")[0].trim()), + ip2 = strToIpv6(range[0].split("-")[1].trim()), total = new Array(128).fill(); let output = "", @@ -188,6 +189,93 @@ export function ipv6HyphenatedRange(range, includeNetworkInfo) { return output; } +/** + * Parses a list of IPv4 addresses separated by a new line (\n) and displays information + * about it. + * + * @param {RegExp} list + * @param {boolean} includeNetworkInfo + * @param {boolean} enumerateAddresses + * @param {boolean} allowLargeList + * @returns {string} + */ +export function ipv4ListedRange(match, includeNetworkInfo, enumerateAddresses, allowLargeList) { + + let ipv4List = match[0].split("\n"); + ipv4List = ipv4List.filter(Boolean); + + const ipv4CidrList = ipv4List.filter(function(a) { + return a.includes("/"); + }); + for (let i = 0; i < ipv4CidrList.length; i++) { + const network = strToIpv4(ipv4CidrList[i].split("/")[0]); + const cidrRange = parseInt(ipv4CidrList[i].split("/")[1], 10); + if (cidrRange < 0 || cidrRange > 31) { + return "IPv4 CIDR must be less than 32"; + } + const mask = ~(0xFFFFFFFF >>> cidrRange), + cidrIp1 = network & mask, + cidrIp2 = cidrIp1 | ~mask; + ipv4List.splice(ipv4List.indexOf(ipv4CidrList[i]), 1); + ipv4List.push(ipv4ToStr(cidrIp1), ipv4ToStr(cidrIp2)); + } + + ipv4List = ipv4List.sort(ipv4Compare); + const ip1 = ipv4List[0]; + const ip2 = ipv4List[ipv4List.length - 1]; + const range = [ip1 + " - " + ip2]; + return ipv4HyphenatedRange(range, includeNetworkInfo, enumerateAddresses, allowLargeList); +} + +/** + * Parses a list of IPv6 addresses separated by a new line (\n) and displays information + * about it. + * + * @param {RegExp} list + * @param {boolean} includeNetworkInfo + * @returns {string} + */ +export function ipv6ListedRange(match, includeNetworkInfo) { + + let ipv6List = match[0].split("\n"); + ipv6List = ipv6List.filter(function(str) { + return str.trim(); + }); + for (let i =0; i < ipv6List.length; i++){ + ipv6List[i] = ipv6List[i].trim(); + } + const ipv6CidrList = ipv6List.filter(function(a) { + return a.includes("/"); + }); + + for (let i = 0; i < ipv6CidrList.length; i++) { + + const network = strToIpv6(ipv6CidrList[i].split("/")[0]); + const cidrRange = parseInt(ipv6CidrList[i].split("/")[1], 10); + + if (cidrRange < 0 || cidrRange > 127) { + return "IPv6 CIDR must be less than 128"; + } + + const cidrIp1 = new Array(8), + cidrIp2 = new Array(8); + + const mask = genIpv6Mask(cidrRange); + + for (let j = 0; j < 8; j++) { + cidrIp1[j] = network[j] & mask[j]; + cidrIp2[j] = cidrIp1[j] | (~mask[j] & 0x0000FFFF); + } + ipv6List.splice(ipv6List.indexOf(ipv6CidrList[i]), 1); + ipv6List.push(ipv6ToStr(cidrIp1), ipv6ToStr(cidrIp2)); + } + ipv6List = ipv6List.sort(ipv6Compare); + const ip1 = ipv6List[0]; + const ip2 = ipv6List[ipv6List.length - 1]; + const range = [ip1 + " - " + ip2]; + return ipv6HyphenatedRange(range, includeNetworkInfo); +} + /** * Converts an IPv4 address from string format to numerical format. * @@ -391,6 +479,37 @@ export function genIpv6Mask(cidr) { return mask; } +/** + * Comparison operation for sorting of IPv4 addresses. + * + * @param {string} a + * @param {string} b + * @returns {number} + */ +export function ipv4Compare(a, b) { + return strToIpv4(a) - strToIpv4(b); +} + +/** + * Comparison operation for sorting of IPv6 addresses. + * + * @param {string} a + * @param {string} b + * @returns {number} + */ +export function ipv6Compare(a, b) { + + const a_ = strToIpv6(a), + b_ = strToIpv6(b); + + for (let i = 0; i < a_.length; i++){ + if (a_[i] !== b_[i]){ + return a_[i] - b_[i]; + } + } + return 0; +} + const _LARGE_RANGE_ERROR = "The specified range contains more than 65,536 addresses. Running this query could crash your browser. If you want to run it, select the \"Allow large queries\" option. You are advised to turn off \"Auto Bake\" whilst editing large ranges."; /** diff --git a/src/core/operations/ADD.mjs b/src/core/operations/ADD.mjs index 7e6ad9d5..7550e8e6 100644 --- a/src/core/operations/ADD.mjs +++ b/src/core/operations/ADD.mjs @@ -22,6 +22,7 @@ class ADD extends Operation { this.name = "ADD"; this.module = "Default"; this.description = "ADD the input with the given key (e.g. fe023da5), MOD 255"; + this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#Bitwise_operators"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ @@ -29,7 +30,7 @@ class ADD extends Operation { "name": "Key", "type": "toggleString", "value": "", - "toggleValues": ["Hex", "Base64", "UTF8", "Latin1"] + "toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"] } ]; } diff --git a/src/core/operations/AESDecrypt.mjs b/src/core/operations/AESDecrypt.mjs index 7d9ac5ca..53489d3c 100644 --- a/src/core/operations/AESDecrypt.mjs +++ b/src/core/operations/AESDecrypt.mjs @@ -23,6 +23,7 @@ class AESDecrypt extends Operation { this.name = "AES Decrypt"; this.module = "Ciphers"; this.description = "Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.

Key: The following algorithms will be used based on the size of the key:
  • 16 bytes = AES-128
  • 24 bytes = AES-192
  • 32 bytes = AES-256


IV: The Initialization Vector should be 16 bytes long. If not entered, it will default to 16 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used.

GCM Tag: This field is ignored unless 'GCM' mode is used."; + this.infoURL = "https://wikipedia.org/wiki/Advanced_Encryption_Standard"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/AESEncrypt.mjs b/src/core/operations/AESEncrypt.mjs index 98a4c259..5103cb86 100644 --- a/src/core/operations/AESEncrypt.mjs +++ b/src/core/operations/AESEncrypt.mjs @@ -23,6 +23,7 @@ class AESEncrypt extends Operation { this.name = "AES Encrypt"; this.module = "Ciphers"; this.description = "Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.

Key: The following algorithms will be used based on the size of the key:
  • 16 bytes = AES-128
  • 24 bytes = AES-192
  • 32 bytes = AES-256
You can generate a password-based key using one of the KDF operations.

IV: The Initialization Vector should be 16 bytes long. If not entered, it will default to 16 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used."; + this.infoURL = "https://wikipedia.org/wiki/Advanced_Encryption_Standard"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/AND.mjs b/src/core/operations/AND.mjs index 4a062725..68cddcfa 100644 --- a/src/core/operations/AND.mjs +++ b/src/core/operations/AND.mjs @@ -22,6 +22,7 @@ class AND extends Operation { this.name = "AND"; this.module = "Default"; this.description = "AND the input with the given key.
e.g. fe023da5"; + this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#AND"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ @@ -29,7 +30,7 @@ class AND extends Operation { "name": "Key", "type": "toggleString", "value": "", - "toggleValues": ["Hex", "Base64", "UTF8", "Latin1"] + "toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"] } ]; } diff --git a/src/core/operations/Adler32Checksum.mjs b/src/core/operations/Adler32Checksum.mjs index 3e8013bd..41584de6 100644 --- a/src/core/operations/Adler32Checksum.mjs +++ b/src/core/operations/Adler32Checksum.mjs @@ -21,6 +21,7 @@ class Adler32Checksum extends Operation { this.name = "Adler-32 Checksum"; this.module = "Hashing"; this.description = "Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995, and is a modification of the Fletcher checksum. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter).

Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32."; + this.infoURL = "https://wikipedia.org/wiki/Adler-32"; this.inputType = "byteArray"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/AffineCipherDecode.mjs b/src/core/operations/AffineCipherDecode.mjs index 3f65c150..173ccb8f 100644 --- a/src/core/operations/AffineCipherDecode.mjs +++ b/src/core/operations/AffineCipherDecode.mjs @@ -22,6 +22,7 @@ class AffineCipherDecode extends Operation { this.name = "Affine Cipher Decode"; this.module = "Ciphers"; this.description = "The Affine cipher is a type of monoalphabetic substitution cipher. To decrypt, each letter in an alphabet is mapped to its numeric equivalent, decrypted by a mathematical function, and converted back to a letter."; + this.infoURL = "https://wikipedia.org/wiki/Affine_cipher"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/AffineCipherEncode.mjs b/src/core/operations/AffineCipherEncode.mjs index e9aeec32..4adc64e3 100644 --- a/src/core/operations/AffineCipherEncode.mjs +++ b/src/core/operations/AffineCipherEncode.mjs @@ -21,6 +21,7 @@ class AffineCipherEncode extends Operation { this.name = "Affine Cipher Encode"; this.module = "Ciphers"; this.description = "The Affine cipher is a type of monoalphabetic substitution cipher, wherein each letter in an alphabet is mapped to its numeric equivalent, encrypted using simple mathematical function, (ax + b) % 26, and converted back to a letter."; + this.infoURL = "https://wikipedia.org/wiki/Affine_cipher"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/AnalyseHash.mjs b/src/core/operations/AnalyseHash.mjs index e53b515e..cb719f77 100644 --- a/src/core/operations/AnalyseHash.mjs +++ b/src/core/operations/AnalyseHash.mjs @@ -21,6 +21,7 @@ class AnalyseHash extends Operation { this.name = "Analyse hash"; this.module = "Hashing"; this.description = "Tries to determine information about a given hash and suggests which algorithm may have been used to generate it based on its length."; + this.infoURL = "https://wikipedia.org/wiki/Comparison_of_cryptographic_hash_functions"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/AtbashCipher.mjs b/src/core/operations/AtbashCipher.mjs index 9c4657ef..fc6bf909 100644 --- a/src/core/operations/AtbashCipher.mjs +++ b/src/core/operations/AtbashCipher.mjs @@ -21,6 +21,7 @@ class AtbashCipher extends Operation { this.name = "Atbash Cipher"; this.module = "Ciphers"; this.description = "Atbash is a mono-alphabetic substitution cipher originally used to encode the Hebrew alphabet. It has been modified here for use with the Latin alphabet."; + this.infoURL = "https://wikipedia.org/wiki/Atbash"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/BSONDeserialise.mjs b/src/core/operations/BSONDeserialise.mjs index b0225569..4e66fc81 100644 --- a/src/core/operations/BSONDeserialise.mjs +++ b/src/core/operations/BSONDeserialise.mjs @@ -22,6 +22,7 @@ class BSONDeserialise extends Operation { this.name = "BSON deserialise"; this.module = "BSON"; this.description = "BSON is a computer data interchange format used mainly as a data storage and network transfer format in the MongoDB database. It is a binary form for representing simple data structures, associative arrays (called objects or documents in MongoDB), and various data types of specific interest to MongoDB. The name 'BSON' is based on the term JSON and stands for 'Binary JSON'.

Input data should be in a raw bytes format."; + this.infoURL = "https://wikipedia.org/wiki/BSON"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/BSONSerialise.mjs b/src/core/operations/BSONSerialise.mjs index a82296b3..ed4d067b 100644 --- a/src/core/operations/BSONSerialise.mjs +++ b/src/core/operations/BSONSerialise.mjs @@ -22,6 +22,7 @@ class BSONSerialise extends Operation { this.name = "BSON serialise"; this.module = "BSON"; this.description = "BSON is a computer data interchange format used mainly as a data storage and network transfer format in the MongoDB database. It is a binary form for representing simple data structures, associative arrays (called objects or documents in MongoDB), and various data types of specific interest to MongoDB. The name 'BSON' is based on the term JSON and stands for 'Binary JSON'.

Input data should be valid JSON."; + this.infoURL = "https://wikipedia.org/wiki/BSON"; this.inputType = "string"; this.outputType = "ArrayBuffer"; this.args = []; diff --git a/src/core/operations/Bcrypt.mjs b/src/core/operations/Bcrypt.mjs index cccf4131..fafd4e26 100644 --- a/src/core/operations/Bcrypt.mjs +++ b/src/core/operations/Bcrypt.mjs @@ -21,6 +21,7 @@ class Bcrypt extends Operation { this.name = "Bcrypt"; this.module = "Hashing"; this.description = "bcrypt is a password hashing function designed by Niels Provos and David Mazi\xe8res, based on the Blowfish cipher, and presented at USENIX in 1999. Besides incorporating a salt to protect against rainbow table attacks, bcrypt is an adaptive function: over time, the iteration count (rounds) can be increased to make it slower, so it remains resistant to brute-force search attacks even with increasing computation power.

Enter the password in the input to generate its hash."; + this.infoURL = "https://wikipedia.org/wiki/Bcrypt"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/BcryptCompare.mjs b/src/core/operations/BcryptCompare.mjs index 32f275b5..f3edb2d9 100644 --- a/src/core/operations/BcryptCompare.mjs +++ b/src/core/operations/BcryptCompare.mjs @@ -21,6 +21,7 @@ class BcryptCompare extends Operation { this.name = "Bcrypt compare"; this.module = "Hashing"; this.description = "Tests whether the input matches the given bcrypt hash. To test multiple possible passwords, use the 'Fork' operation."; + this.infoURL = "https://wikipedia.org/wiki/Bcrypt"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/BcryptParse.mjs b/src/core/operations/BcryptParse.mjs index 149bdaa0..fdd907b9 100644 --- a/src/core/operations/BcryptParse.mjs +++ b/src/core/operations/BcryptParse.mjs @@ -22,6 +22,7 @@ class BcryptParse extends Operation { this.name = "Bcrypt parse"; this.module = "Hashing"; this.description = "Parses a bcrypt hash to determine the number of rounds used, the salt, and the password hash."; + this.infoURL = "https://wikipedia.org/wiki/Bcrypt"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/BifidCipherDecode.mjs b/src/core/operations/BifidCipherDecode.mjs index f5e2ad47..b55d2e26 100644 --- a/src/core/operations/BifidCipherDecode.mjs +++ b/src/core/operations/BifidCipherDecode.mjs @@ -22,6 +22,7 @@ class BifidCipherDecode extends Operation { this.name = "Bifid Cipher Decode"; this.module = "Ciphers"; this.description = "The Bifid cipher is a cipher which uses a Polybius square in conjunction with transposition, which can be fairly difficult to decipher without knowing the alphabet keyword."; + this.infoURL = "https://wikipedia.org/wiki/Bifid_cipher"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/BifidCipherEncode.mjs b/src/core/operations/BifidCipherEncode.mjs index 41c29db0..2db6279c 100644 --- a/src/core/operations/BifidCipherEncode.mjs +++ b/src/core/operations/BifidCipherEncode.mjs @@ -22,6 +22,7 @@ class BifidCipherEncode extends Operation { this.name = "Bifid Cipher Encode"; this.module = "Ciphers"; this.description = "The Bifid cipher is a cipher which uses a Polybius square in conjunction with transposition, which can be fairly difficult to decipher without knowing the alphabet keyword."; + this.infoURL = "https://wikipedia.org/wiki/Bifid_cipher"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/BitShiftLeft.mjs b/src/core/operations/BitShiftLeft.mjs index 59c740f2..ceb19350 100644 --- a/src/core/operations/BitShiftLeft.mjs +++ b/src/core/operations/BitShiftLeft.mjs @@ -20,6 +20,7 @@ class BitShiftLeft extends Operation { this.name = "Bit shift left"; this.module = "Default"; this.description = "Shifts the bits in each byte towards the left by the specified amount."; + this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#Bit_shifts"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/BitShiftRight.mjs b/src/core/operations/BitShiftRight.mjs index 8207f353..c6e4698f 100644 --- a/src/core/operations/BitShiftRight.mjs +++ b/src/core/operations/BitShiftRight.mjs @@ -20,6 +20,7 @@ class BitShiftRight extends Operation { this.name = "Bit shift right"; this.module = "Default"; this.description = "Shifts the bits in each byte towards the right by the specified amount.

Logical shifts replace the leftmost bits with zeros.
Arithmetic shifts preserve the most significant bit (MSB) of the original byte keeping the sign the same (positive or negative)."; + this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#Bit_shifts"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/BlowfishDecrypt.mjs b/src/core/operations/BlowfishDecrypt.mjs index d349d3c4..4aa08af8 100644 --- a/src/core/operations/BlowfishDecrypt.mjs +++ b/src/core/operations/BlowfishDecrypt.mjs @@ -38,6 +38,7 @@ class BlowfishDecrypt extends Operation { this.name = "Blowfish Decrypt"; this.module = "Ciphers"; this.description = "Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes."; + this.infoURL = "https://wikipedia.org/wiki/Blowfish_(cipher)"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/BlowfishEncrypt.mjs b/src/core/operations/BlowfishEncrypt.mjs index 60c45560..813c359c 100644 --- a/src/core/operations/BlowfishEncrypt.mjs +++ b/src/core/operations/BlowfishEncrypt.mjs @@ -39,6 +39,7 @@ class BlowfishEncrypt extends Operation { this.name = "Blowfish Encrypt"; this.module = "Ciphers"; this.description = "Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes."; + this.infoURL = "https://wikipedia.org/wiki/Blowfish_(cipher)"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/Bzip2Decompress.mjs b/src/core/operations/Bzip2Decompress.mjs index e31b3d2c..090a02bc 100644 --- a/src/core/operations/Bzip2Decompress.mjs +++ b/src/core/operations/Bzip2Decompress.mjs @@ -22,6 +22,7 @@ class Bzip2Decompress extends Operation { this.name = "Bzip2 Decompress"; this.module = "Compression"; this.description = "Decompresses data using the Bzip2 algorithm."; + this.infoURL = "https://wikipedia.org/wiki/Bzip2"; this.inputType = "byteArray"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/CRC16Checksum.mjs b/src/core/operations/CRC16Checksum.mjs index c4c5d633..f0692f24 100644 --- a/src/core/operations/CRC16Checksum.mjs +++ b/src/core/operations/CRC16Checksum.mjs @@ -21,6 +21,7 @@ class CRC16Checksum extends Operation { this.name = "CRC-16 Checksum"; this.module = "Hashing"; this.description = "A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data.

The CRC was invented by W. Wesley Peterson in 1961."; + this.infoURL = "https://wikipedia.org/wiki/Cyclic_redundancy_check"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/CRC32Checksum.mjs b/src/core/operations/CRC32Checksum.mjs index 5982273e..b4e85799 100644 --- a/src/core/operations/CRC32Checksum.mjs +++ b/src/core/operations/CRC32Checksum.mjs @@ -21,6 +21,7 @@ class CRC32Checksum extends Operation { this.name = "CRC-32 Checksum"; this.module = "Hashing"; this.description = "A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data.

The CRC was invented by W. Wesley Peterson in 1961; the 32-bit CRC function of Ethernet and many other standards is the work of several researchers and was published in 1975."; + this.infoURL = "https://wikipedia.org/wiki/Cyclic_redundancy_check"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/CSSSelector.mjs b/src/core/operations/CSSSelector.mjs index b91178cb..c26d3142 100644 --- a/src/core/operations/CSSSelector.mjs +++ b/src/core/operations/CSSSelector.mjs @@ -23,6 +23,7 @@ class CSSSelector extends Operation { this.name = "CSS selector"; this.module = "Code"; this.description = "Extract information from an HTML document with a CSS selector"; + this.infoURL = "https://wikipedia.org/wiki/Cascading_Style_Sheets#Selector"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/CTPH.mjs b/src/core/operations/CTPH.mjs index 39f52af4..3597cd55 100644 --- a/src/core/operations/CTPH.mjs +++ b/src/core/operations/CTPH.mjs @@ -21,6 +21,7 @@ class CTPH extends Operation { this.name = "CTPH"; this.module = "Hashing"; this.description = "Context Triggered Piecewise Hashing, also called Fuzzy Hashing, can match inputs that have homologies. Such inputs have sequences of identical bytes in the same order, although bytes in between these sequences may be different in both content and length.

CTPH was originally based on the work of Dr. Andrew Tridgell and a spam email detector called SpamSum. This method was adapted by Jesse Kornblum and published at the DFRWS conference in 2006 in a paper 'Identifying Almost Identical Files Using Context Triggered Piecewise Hashing'."; + this.infoURL = "https://forensicswiki.org/wiki/Context_Triggered_Piecewise_Hashing"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/CartesianProduct.mjs b/src/core/operations/CartesianProduct.mjs index 0d5346fb..cd32c72f 100644 --- a/src/core/operations/CartesianProduct.mjs +++ b/src/core/operations/CartesianProduct.mjs @@ -21,6 +21,7 @@ class CartesianProduct extends Operation { this.name = "Cartesian Product"; this.module = "Default"; this.description = "Calculates the cartesian product of multiple sets of data, returning all possible combinations."; + this.infoURL = "https://wikipedia.org/wiki/Cartesian_product"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ChangeIPFormat.mjs b/src/core/operations/ChangeIPFormat.mjs index b985312a..56c5ffe1 100644 --- a/src/core/operations/ChangeIPFormat.mjs +++ b/src/core/operations/ChangeIPFormat.mjs @@ -21,7 +21,7 @@ class ChangeIPFormat extends Operation { super(); this.name = "Change IP format"; - this.module = "JSBN"; + this.module = "Default"; this.description = "Convert an IP address from one format to another, e.g. 172.20.23.54 to ac141736"; this.inputType = "string"; this.outputType = "string"; @@ -29,12 +29,12 @@ class ChangeIPFormat extends Operation { { "name": "Input format", "type": "option", - "value": ["Hex", "Raw"] + "value": ["Dotted Decimal", "Decimal", "Hex"] }, { "name": "Output format", "type": "option", - "value": ["Hex", "Raw"] + "value": ["Dotted Decimal", "Decimal", "Hex"] } ]; } diff --git a/src/core/operations/ChiSquare.mjs b/src/core/operations/ChiSquare.mjs index 89cb2214..5681abc8 100644 --- a/src/core/operations/ChiSquare.mjs +++ b/src/core/operations/ChiSquare.mjs @@ -20,6 +20,7 @@ class ChiSquare extends Operation { this.name = "Chi Square"; this.module = "Default"; this.description = "Calculates the Chi Square distribution of values."; + this.infoURL = "https://wikipedia.org/wiki/Chi-squared_distribution"; this.inputType = "ArrayBuffer"; this.outputType = "number"; this.args = []; diff --git a/src/core/operations/CompareCTPHHashes.mjs b/src/core/operations/CompareCTPHHashes.mjs index 7194d89f..acae6b42 100644 --- a/src/core/operations/CompareCTPHHashes.mjs +++ b/src/core/operations/CompareCTPHHashes.mjs @@ -24,6 +24,7 @@ class CompareCTPHHashes extends Operation { this.name = "Compare CTPH hashes"; this.module = "Hashing"; this.description = "Compares two Context Triggered Piecewise Hashing (CTPH) fuzzy hashes to determine the similarity between them on a scale of 0 to 100."; + this.infoURL = "https://forensicswiki.org/wiki/Context_Triggered_Piecewise_Hashing"; this.inputType = "string"; this.outputType = "Number"; this.args = [ diff --git a/src/core/operations/CompareSSDEEPHashes.mjs b/src/core/operations/CompareSSDEEPHashes.mjs index aa39d5cf..fdd38210 100644 --- a/src/core/operations/CompareSSDEEPHashes.mjs +++ b/src/core/operations/CompareSSDEEPHashes.mjs @@ -24,6 +24,7 @@ class CompareSSDEEPHashes extends Operation { this.name = "Compare SSDEEP hashes"; this.module = "Hashing"; this.description = "Compares two SSDEEP fuzzy hashes to determine the similarity between them on a scale of 0 to 100."; + this.infoURL = "https://forensicswiki.org/wiki/Ssdeep"; this.inputType = "string"; this.outputType = "Number"; this.args = [ diff --git a/src/core/operations/ConvertArea.mjs b/src/core/operations/ConvertArea.mjs index dd88f52e..1c4a80c3 100644 --- a/src/core/operations/ConvertArea.mjs +++ b/src/core/operations/ConvertArea.mjs @@ -20,6 +20,7 @@ class ConvertArea extends Operation { this.name = "Convert area"; this.module = "Default"; this.description = "Converts a unit of area to another format."; + this.infoURL = "https://wikipedia.org/wiki/Orders_of_magnitude_(area)"; this.inputType = "BigNumber"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/ConvertDataUnits.mjs b/src/core/operations/ConvertDataUnits.mjs index dc22e351..c35bd6fe 100644 --- a/src/core/operations/ConvertDataUnits.mjs +++ b/src/core/operations/ConvertDataUnits.mjs @@ -20,6 +20,7 @@ class ConvertDataUnits extends Operation { this.name = "Convert data units"; this.module = "Default"; this.description = "Converts a unit of data to another format."; + this.infoURL = "https://wikipedia.org/wiki/Orders_of_magnitude_(data)"; this.inputType = "BigNumber"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/ConvertDistance.mjs b/src/core/operations/ConvertDistance.mjs index 278a1c6d..1151abc6 100644 --- a/src/core/operations/ConvertDistance.mjs +++ b/src/core/operations/ConvertDistance.mjs @@ -20,6 +20,7 @@ class ConvertDistance extends Operation { this.name = "Convert distance"; this.module = "Default"; this.description = "Converts a unit of distance to another format."; + this.infoURL = "https://wikipedia.org/wiki/Orders_of_magnitude_(length)"; this.inputType = "BigNumber"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/ConvertMass.mjs b/src/core/operations/ConvertMass.mjs index 18c0c84a..3373aa57 100644 --- a/src/core/operations/ConvertMass.mjs +++ b/src/core/operations/ConvertMass.mjs @@ -20,6 +20,7 @@ class ConvertMass extends Operation { this.name = "Convert mass"; this.module = "Default"; this.description = "Converts a unit of mass to another format."; + this.infoURL = "https://wikipedia.org/wiki/Orders_of_magnitude_(mass)"; this.inputType = "BigNumber"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/ConvertSpeed.mjs b/src/core/operations/ConvertSpeed.mjs index 71c43a54..ec92ad95 100644 --- a/src/core/operations/ConvertSpeed.mjs +++ b/src/core/operations/ConvertSpeed.mjs @@ -20,6 +20,7 @@ class ConvertSpeed extends Operation { this.name = "Convert speed"; this.module = "Default"; this.description = "Converts a unit of speed to another format."; + this.infoURL = "https://wikipedia.org/wiki/Orders_of_magnitude_(speed)"; this.inputType = "BigNumber"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/DESDecrypt.mjs b/src/core/operations/DESDecrypt.mjs index b1d0d8c7..620256c7 100644 --- a/src/core/operations/DESDecrypt.mjs +++ b/src/core/operations/DESDecrypt.mjs @@ -23,6 +23,7 @@ class DESDecrypt extends Operation { this.name = "DES Decrypt"; this.module = "Ciphers"; this.description = "DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.

Key: DES uses a key length of 8 bytes (64 bits).
Triple DES uses a key length of 24 bytes (192 bits).

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used."; + this.infoURL = "https://wikipedia.org/wiki/Data_Encryption_Standard"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/DESEncrypt.mjs b/src/core/operations/DESEncrypt.mjs index 17a2abcf..774be674 100644 --- a/src/core/operations/DESEncrypt.mjs +++ b/src/core/operations/DESEncrypt.mjs @@ -23,6 +23,7 @@ class DESEncrypt extends Operation { this.name = "DES Encrypt"; this.module = "Ciphers"; this.description = "DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.

Key: DES uses a key length of 8 bytes (64 bits).
Triple DES uses a key length of 24 bytes (192 bits).

You can generate a password-based key using one of the KDF operations.

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used."; + this.infoURL = "https://wikipedia.org/wiki/Data_Encryption_Standard"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/DechunkHTTPResponse.mjs b/src/core/operations/DechunkHTTPResponse.mjs new file mode 100644 index 00000000..61af035e --- /dev/null +++ b/src/core/operations/DechunkHTTPResponse.mjs @@ -0,0 +1,51 @@ +/** + * @author sevzero [sevzero@protonmail.com] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; + +/** + * Dechunk HTTP response operation + */ +class DechunkHTTPResponse extends Operation { + + /** + * DechunkHTTPResponse constructor + */ + constructor() { + super(); + + this.name = "Dechunk HTTP response"; + this.module = "Default"; + this.description = "Parses an HTTP response transferred using Transfer-Encoding: Chunked"; + this.infoURL = "https://wikipedia.org/wiki/Chunked_transfer_encoding"; + this.inputType = "string"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + const chunks = []; + let chunkSizeEnd = input.indexOf("\n") + 1; + const lineEndings = input.charAt(chunkSizeEnd - 2) === "\r" ? "\r\n" : "\n"; + const lineEndingsLength = lineEndings.length; + let chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); + while (!isNaN(chunkSize)) { + chunks.push(input.slice(chunkSizeEnd, chunkSize + chunkSizeEnd)); + input = input.slice(chunkSizeEnd + chunkSize + lineEndingsLength); + chunkSizeEnd = input.indexOf(lineEndings) + lineEndingsLength; + chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); + } + return chunks.join("") + input; + } + +} + +export default DechunkHTTPResponse; diff --git a/src/core/operations/DecodeNetBIOSName.mjs b/src/core/operations/DecodeNetBIOSName.mjs index 19624889..bbfe2b6e 100644 --- a/src/core/operations/DecodeNetBIOSName.mjs +++ b/src/core/operations/DecodeNetBIOSName.mjs @@ -20,6 +20,7 @@ class DecodeNetBIOSName extends Operation { this.name = "Decode NetBIOS Name"; this.module = "Default"; this.description = "NetBIOS names as seen across the client interface to NetBIOS are exactly 16 bytes long. Within the NetBIOS-over-TCP protocols, a longer representation is used.

There are two levels of encoding. The first level maps a NetBIOS name into a domain system name. The second level maps the domain system name into the 'compressed' representation required for interaction with the domain name system.

This operation decodes the first level of encoding. See RFC 1001 for full details."; + this.infoURL = "https://wikipedia.org/wiki/NetBIOS"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/DecodeText.mjs b/src/core/operations/DecodeText.mjs index 9e51199f..e7a4f188 100644 --- a/src/core/operations/DecodeText.mjs +++ b/src/core/operations/DecodeText.mjs @@ -29,6 +29,7 @@ class DecodeText extends Operation { Object.keys(IO_FORMAT).map(e => `
  • ${e}
  • `).join("\n"), "", ].join("\n"); + this.infoURL = "https://wikipedia.org/wiki/Character_encoding"; this.inputType = "byteArray"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/DeriveEVPKey.mjs b/src/core/operations/DeriveEVPKey.mjs index ad17f0b1..a14d2249 100644 --- a/src/core/operations/DeriveEVPKey.mjs +++ b/src/core/operations/DeriveEVPKey.mjs @@ -21,7 +21,8 @@ class DeriveEVPKey extends Operation { this.name = "Derive EVP key"; this.module = "Ciphers"; - this.description = "EVP is a password-based key derivation function (PBKDF) used extensively in OpenSSL. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

    A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

    If you leave the salt argument empty, a random salt will be generated."; + this.description = "This operation performs a password-based key derivation function (PBKDF) used extensively in OpenSSL. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

    A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

    If you leave the salt argument empty, a random salt will be generated."; + this.infoURL = "https://wikipedia.org/wiki/Key_derivation_function"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/DerivePBKDF2Key.mjs b/src/core/operations/DerivePBKDF2Key.mjs index d3f7fe9a..53fedb4d 100644 --- a/src/core/operations/DerivePBKDF2Key.mjs +++ b/src/core/operations/DerivePBKDF2Key.mjs @@ -22,6 +22,7 @@ class DerivePBKDF2Key extends Operation { this.name = "Derive PBKDF2 key"; this.module = "Ciphers"; this.description = "PBKDF2 is a password-based key derivation function. It is part of RSA Laboratories' Public-Key Cryptography Standards (PKCS) series, specifically PKCS #5 v2.0, also published as Internet Engineering Task Force's RFC 2898.

    In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

    A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

    If you leave the salt argument empty, a random salt will be generated."; + this.infoURL = "https://wikipedia.org/wiki/PBKDF2"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/DetectFileType.mjs b/src/core/operations/DetectFileType.mjs index ddf9a2de..1d6897a0 100644 --- a/src/core/operations/DetectFileType.mjs +++ b/src/core/operations/DetectFileType.mjs @@ -21,6 +21,7 @@ class DetectFileType extends Operation { this.name = "Detect File Type"; this.module = "Default"; this.description = "Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.

    Currently supports the following file types: 7z, amr, avi, bmp, bz2, class, cr2, crx, dex, dmg, doc, elf, eot, epub, exe, flac, flv, gif, gz, ico, iso, jpg, jxr, m4a, m4v, mid, mkv, mov, mp3, mp4, mpg, ogg, otf, pdf, png, ppt, ps, psd, rar, rtf, sqlite, swf, tar, tar.z, tif, ttf, utf8, vmdk, wav, webm, webp, wmv, woff, woff2, xls, xz, zip."; + this.infoURL = "https://wikipedia.org/wiki/List_of_file_signatures"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/Diff.mjs b/src/core/operations/Diff.mjs index 1fd6e5d8..9e094e99 100644 --- a/src/core/operations/Diff.mjs +++ b/src/core/operations/Diff.mjs @@ -23,6 +23,7 @@ class Diff extends Operation { this.name = "Diff"; this.module = "Diff"; this.description = "Compares two inputs (separated by the specified delimiter) and highlights the differences between them."; + this.infoURL = "https://wikipedia.org/wiki/File_comparison"; this.inputType = "string"; this.outputType = "html"; this.args = [ diff --git a/src/core/operations/DisassembleX86.mjs b/src/core/operations/DisassembleX86.mjs index c64039bb..b25dcb48 100644 --- a/src/core/operations/DisassembleX86.mjs +++ b/src/core/operations/DisassembleX86.mjs @@ -22,6 +22,7 @@ class DisassembleX86 extends Operation { this.name = "Disassemble x86"; this.module = "Shellcode"; this.description = "Disassembly is the process of translating machine language into assembly language.

    This operation supports 64-bit, 32-bit and 16-bit code written for Intel or AMD x86 processors. It is particularly useful for reverse engineering shellcode.

    Input should be in hexadecimal."; + this.infoURL = "https://wikipedia.org/wiki/X86"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/DropBytes.mjs b/src/core/operations/DropBytes.mjs index e697f4e9..80492c34 100644 --- a/src/core/operations/DropBytes.mjs +++ b/src/core/operations/DropBytes.mjs @@ -5,7 +5,6 @@ */ import Operation from "../Operation"; -import OperationError from "../errors/OperationError"; /** * Drop bytes operation @@ -20,7 +19,7 @@ class DropBytes extends Operation { this.name = "Drop bytes"; this.module = "Default"; - this.description = "Cuts a slice of the specified number of bytes out of the data."; + this.description = "Cuts a slice of the specified number of bytes out of the data. Negative values are allowed."; this.inputType = "ArrayBuffer"; this.outputType = "ArrayBuffer"; this.args = [ @@ -50,14 +49,25 @@ class DropBytes extends Operation { * @throws {OperationError} if invalid input */ run(input, args) { - const start = args[0], - length = args[1], - applyToEachLine = args[2]; - - if (start < 0 || length < 0) - throw new OperationError("Error: Invalid value"); + let start = args[0], + length = args[1]; + const applyToEachLine = args[2]; if (!applyToEachLine) { + if (start < 0) { // Take from the end + start = input.byteLength + start; + } + + if (length < 0) { // Flip start point + start = start + length; + if (start < 0) { + start = input.byteLength + start; + length = start - length; + } else { + length = -length; + } + } + const left = input.slice(0, start), right = input.slice(start + length, input.byteLength); const result = new Uint8Array(left.byteLength + right.byteLength); @@ -82,10 +92,28 @@ class DropBytes extends Operation { } lines.push(line); - let output = []; + let output = [], + s = start, + l = length; for (i = 0; i < lines.length; i++) { - output = output.concat(lines[i].slice(0, start).concat(lines[i].slice(start+length, lines[i].length))); + if (s < 0) { // Take from the end + s = lines[i].length + s; + } + + if (l < 0) { // Flip start point + s = s + l; + if (s < 0) { + s = lines[i].length + s; + l = s - l; + } else { + l = -l; + } + } + + output = output.concat(lines[i].slice(0, s).concat(lines[i].slice(s+l, lines[i].length))); output.push(0x0a); + s = start; + l = length; } return new Uint8Array(output.slice(0, output.length-1)).buffer; } diff --git a/src/core/operations/EncodeNetBIOSName.mjs b/src/core/operations/EncodeNetBIOSName.mjs index 608f4bfd..9352ed4f 100644 --- a/src/core/operations/EncodeNetBIOSName.mjs +++ b/src/core/operations/EncodeNetBIOSName.mjs @@ -20,6 +20,7 @@ class EncodeNetBIOSName extends Operation { this.name = "Encode NetBIOS Name"; this.module = "Default"; this.description = "NetBIOS names as seen across the client interface to NetBIOS are exactly 16 bytes long. Within the NetBIOS-over-TCP protocols, a longer representation is used.

    There are two levels of encoding. The first level maps a NetBIOS name into a domain system name. The second level maps the domain system name into the 'compressed' representation required for interaction with the domain name system.

    This operation carries out the first level of encoding. See RFC 1001 for full details."; + this.infoURL = "https://wikipedia.org/wiki/NetBIOS"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/EncodeText.mjs b/src/core/operations/EncodeText.mjs index 6786be56..f634c3d9 100644 --- a/src/core/operations/EncodeText.mjs +++ b/src/core/operations/EncodeText.mjs @@ -29,6 +29,7 @@ class EncodeText extends Operation { Object.keys(IO_FORMAT).map(e => `
  • ${e}
  • `).join("\n"), "", ].join("\n"); + this.infoURL = "https://wikipedia.org/wiki/Character_encoding"; this.inputType = "string"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/Entropy.mjs b/src/core/operations/Entropy.mjs index 2f12d40f..868178fc 100644 --- a/src/core/operations/Entropy.mjs +++ b/src/core/operations/Entropy.mjs @@ -21,6 +21,7 @@ class Entropy extends Operation { this.name = "Entropy"; this.module = "Default"; this.description = "Shannon Entropy, in the context of information theory, is a measure of the rate at which information is produced by a source of data. It can be used, in a broad sense, to detect whether data is likely to be structured or unstructured. 8 is the maximum, representing highly unstructured, 'random' data. English language text usually falls somewhere between 3.5 and 5. Properly encrypted or compressed data should have an entropy of over 7.5."; + this.infoURL = "https://wikipedia.org/wiki/Entropy_(information_theory)"; this.inputType = "byteArray"; this.outputType = "number"; this.presentType = "html"; diff --git a/src/core/operations/EscapeString.mjs b/src/core/operations/EscapeString.mjs index 9e0d5172..2d945e24 100644 --- a/src/core/operations/EscapeString.mjs +++ b/src/core/operations/EscapeString.mjs @@ -22,6 +22,7 @@ class EscapeString extends Operation { this.name = "Escape string"; this.module = "Default"; this.description = "Escapes special characters in a string so that they do not cause conflicts. For example, Don't stop me now becomes Don\\'t stop me now.

    Supports the following escape sequences:
    • \\n (Line feed/newline)
    • \\r (Carriage return)
    • \\t (Horizontal tab)
    • \\b (Backspace)
    • \\f (Form feed)
    • \\xnn (Hex, where n is 0-f)
    • \\\\ (Backslash)
    • \\' (Single quote)
    • \\" (Double quote)
    • \\unnnn (Unicode character)
    • \\u{nnnnnn} (Unicode code point)
    "; + this.infoURL = "https://wikipedia.org/wiki/Escape_sequence"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ExtractEXIF.mjs b/src/core/operations/ExtractEXIF.mjs index 533fdd63..7a96d24a 100644 --- a/src/core/operations/ExtractEXIF.mjs +++ b/src/core/operations/ExtractEXIF.mjs @@ -28,6 +28,7 @@ class ExtractEXIF extends Operation { "

    ", "EXIF data from photos usually contains information about the image file itself as well as the device used to create it.", ].join("\n"); + this.infoURL = "https://wikipedia.org/wiki/Exif"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/Filter.mjs b/src/core/operations/Filter.mjs index aaf53f0f..64a97279 100644 --- a/src/core/operations/Filter.mjs +++ b/src/core/operations/Filter.mjs @@ -8,6 +8,7 @@ import Operation from "../Operation"; import Utils from "../Utils"; import {INPUT_DELIM_OPTIONS} from "../lib/Delim"; import OperationError from "../errors/OperationError"; +import XRegExp from "xregexp"; /** * Filter operation @@ -21,7 +22,7 @@ class Filter extends Operation { super(); this.name = "Filter"; - this.module = "Default"; + this.module = "Regex"; this.description = "Splits up the input using the specified delimiter and then filters each branch based on a regular expression."; this.inputType = "string"; this.outputType = "string"; @@ -55,7 +56,7 @@ class Filter extends Operation { let regex; try { - regex = new RegExp(args[1]); + regex = new XRegExp(args[1]); } catch (err) { throw new OperationError(`Invalid regex. Details: ${err.message}`); } diff --git a/src/core/operations/FindReplace.mjs b/src/core/operations/FindReplace.mjs index 5a971704..af75fcb0 100644 --- a/src/core/operations/FindReplace.mjs +++ b/src/core/operations/FindReplace.mjs @@ -6,6 +6,7 @@ import Operation from "../Operation"; import Utils from "../Utils"; +import XRegExp from "xregexp"; /** * Find / Replace operation @@ -21,6 +22,7 @@ class FindReplace extends Operation { this.name = "Find / Replace"; this.module = "Regex"; this.description = "Replaces all occurrences of the first string with the second.

    Includes support for regular expressions (regex), simple strings and extended strings (which support \\n, \\r, \\t, \\b, \\f and escaped hex bytes using \\x notation, e.g. \\x00 for a null byte)."; + this.infoURL = "https://wikipedia.org/wiki/Regular_expression"; this.inputType = "string"; this.outputType = "string"; this.args = [ @@ -49,6 +51,11 @@ class FindReplace extends Operation { "name": "Multiline matching", "type": "boolean", "value": true + }, + { + "name": "Dot matches all", + "type": "boolean", + "value": false } ]; } @@ -59,16 +66,17 @@ class FindReplace extends Operation { * @returns {string} */ run(input, args) { - const [{option: type}, replace, g, i, m] = args; + const [{option: type}, replace, g, i, m, s] = args; let find = args[0].string, modifiers = ""; if (g) modifiers += "g"; if (i) modifiers += "i"; if (m) modifiers += "m"; + if (s) modifiers += "s"; if (type === "Regex") { - find = new RegExp(find, modifiers); + find = new XRegExp(find, modifiers); return input.replace(find, replace); } @@ -76,7 +84,7 @@ class FindReplace extends Operation { find = Utils.parseEscapedChars(find); } - find = new RegExp(Utils.escapeRegex(find), modifiers); + find = new XRegExp(Utils.escapeRegex(find), modifiers); return input.replace(find, replace); } diff --git a/src/core/operations/Fletcher16Checksum.mjs b/src/core/operations/Fletcher16Checksum.mjs index ea3fe791..ff760282 100644 --- a/src/core/operations/Fletcher16Checksum.mjs +++ b/src/core/operations/Fletcher16Checksum.mjs @@ -21,6 +21,7 @@ class Fletcher16Checksum extends Operation { this.name = "Fletcher-16 Checksum"; this.module = "Hashing"; this.description = "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

    The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques."; + this.infoURL = "https://wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-16"; this.inputType = "byteArray"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/Fletcher32Checksum.mjs b/src/core/operations/Fletcher32Checksum.mjs index 21c9449e..5a3ad55b 100644 --- a/src/core/operations/Fletcher32Checksum.mjs +++ b/src/core/operations/Fletcher32Checksum.mjs @@ -21,6 +21,7 @@ class Fletcher32Checksum extends Operation { this.name = "Fletcher-32 Checksum"; this.module = "Hashing"; this.description = "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

    The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques."; + this.infoURL = "https://wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-32"; this.inputType = "byteArray"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/Fletcher64Checksum.mjs b/src/core/operations/Fletcher64Checksum.mjs index ac88a26f..2f60b4f3 100644 --- a/src/core/operations/Fletcher64Checksum.mjs +++ b/src/core/operations/Fletcher64Checksum.mjs @@ -21,6 +21,7 @@ class Fletcher64Checksum extends Operation { this.name = "Fletcher-64 Checksum"; this.module = "Hashing"; this.description = "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

    The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques."; + this.infoURL = "https://wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-64"; this.inputType = "byteArray"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/Fletcher8Checksum.mjs b/src/core/operations/Fletcher8Checksum.mjs index 99199449..6cc538e2 100644 --- a/src/core/operations/Fletcher8Checksum.mjs +++ b/src/core/operations/Fletcher8Checksum.mjs @@ -21,6 +21,7 @@ class Fletcher8Checksum extends Operation { this.name = "Fletcher-8 Checksum"; this.module = "Hashing"; this.description = "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

    The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques."; + this.infoURL = "https://wikipedia.org/wiki/Fletcher%27s_checksum"; this.inputType = "byteArray"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/FormatMACAddresses.mjs b/src/core/operations/FormatMACAddresses.mjs index b10fc15c..1002877d 100644 --- a/src/core/operations/FormatMACAddresses.mjs +++ b/src/core/operations/FormatMACAddresses.mjs @@ -20,6 +20,7 @@ class FormatMACAddresses extends Operation { this.name = "Format MAC addresses"; this.module = "Default"; this.description = "Displays given MAC addresses in multiple different formats.

    Expects addresses in a list separated by newlines, spaces or commas.

    WARNING: There are no validity checks."; + this.infoURL = "https://wikipedia.org/wiki/MAC_address#Notational_conventions"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/FrequencyDistribution.mjs b/src/core/operations/FrequencyDistribution.mjs index bf82f1d4..13eb53e1 100644 --- a/src/core/operations/FrequencyDistribution.mjs +++ b/src/core/operations/FrequencyDistribution.mjs @@ -22,6 +22,7 @@ class FrequencyDistribution extends Operation { this.name = "Frequency distribution"; this.module = "Default"; this.description = "Displays the distribution of bytes in the data as a graph."; + this.infoURL = "https://wikipedia.org/wiki/Frequency_distribution"; this.inputType = "ArrayBuffer"; this.outputType = "json"; this.presentType = "html"; diff --git a/src/core/operations/FromBCD.mjs b/src/core/operations/FromBCD.mjs index a33d739b..a87c1101 100644 --- a/src/core/operations/FromBCD.mjs +++ b/src/core/operations/FromBCD.mjs @@ -24,6 +24,7 @@ class FromBCD extends Operation { this.name = "From BCD"; this.module = "Default"; this.description = "Binary-Coded Decimal (BCD) is a class of binary encodings of decimal numbers where each decimal digit is represented by a fixed number of bits, usually four or eight. Special bit patterns are sometimes used for a sign."; + this.infoURL = "https://wikipedia.org/wiki/Binary-coded_decimal"; this.inputType = "string"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/FromBase.mjs b/src/core/operations/FromBase.mjs index 4d4ca9ff..a44eaf60 100644 --- a/src/core/operations/FromBase.mjs +++ b/src/core/operations/FromBase.mjs @@ -22,6 +22,7 @@ class FromBase extends Operation { this.name = "From Base"; this.module = "Default"; this.description = "Converts a number to decimal from a given numerical base."; + this.infoURL = "https://wikipedia.org/wiki/Radix"; this.inputType = "string"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/FromBase32.mjs b/src/core/operations/FromBase32.mjs index c49d9546..3518ec5f 100644 --- a/src/core/operations/FromBase32.mjs +++ b/src/core/operations/FromBase32.mjs @@ -21,6 +21,7 @@ class FromBase32 extends Operation { this.name = "From Base32"; this.module = "Default"; this.description = "Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7."; + this.infoURL = "https://wikipedia.org/wiki/Base32"; this.inputType = "string"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/FromBase58.mjs b/src/core/operations/FromBase58.mjs index 58fcab9b..1e70aa5b 100644 --- a/src/core/operations/FromBase58.mjs +++ b/src/core/operations/FromBase58.mjs @@ -23,6 +23,7 @@ class FromBase58 extends Operation { this.name = "From Base58"; this.module = "Default"; this.description = "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It differs from Base64 by removing easily misread characters (i.e. l, I, 0 and O) to improve human readability.

    This operation decodes data from an ASCII string (with an alphabet of your choosing, presets included) back into its raw form.

    e.g. StV1DL6CwTryKyV becomes hello world

    Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc)."; + this.infoURL = "https://wikipedia.org/wiki/Base58"; this.inputType = "string"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/FromBase64.mjs b/src/core/operations/FromBase64.mjs index 34d6c6f6..117faa2b 100644 --- a/src/core/operations/FromBase64.mjs +++ b/src/core/operations/FromBase64.mjs @@ -21,6 +21,7 @@ class FromBase64 extends Operation { this.name = "From Base64"; this.module = "Default"; this.description = "Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

    This operation decodes data from an ASCII Base64 string back into its raw format.

    e.g. aGVsbG8= becomes hello"; + this.infoURL = "https://wikipedia.org/wiki/Base64"; this.inputType = "string"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/FromBase85.mjs b/src/core/operations/FromBase85.mjs new file mode 100644 index 00000000..2fec8e2e --- /dev/null +++ b/src/core/operations/FromBase85.mjs @@ -0,0 +1,105 @@ +/** + * @author PenguinGeorge [george@penguingeorge.com] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import OperationError from "../errors/OperationError"; +import Utils from "../Utils"; +import {alphabetName, ALPHABET_OPTIONS} from "../lib/Base85"; + +/** + * From Base85 operation + */ +class FromBase85 extends Operation { + + /** + * From Base85 constructor + */ + constructor() { + super(); + + this.name = "From Base85"; + this.module = "Default"; + this.description = "Base85 (also called Ascii85) is a notation for encoding arbitrary byte data. It is usually more efficient that Base64.

    This operation decodes data from an ASCII string (with an alphabet of your choosing, presets included).

    e.g. BOu!rD]j7BEbo7 becomes hello world

    Base85 is commonly used in Adobe's PostScript and PDF file formats."; + this.infoURL = "https://wikipedia.org/wiki/Ascii85"; + this.inputType = "string"; + this.outputType = "byteArray"; + this.args = [ + { + name: "Alphabet", + type: "editableOption", + value: ALPHABET_OPTIONS + }, + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {byteArray} + */ + run(input, args) { + const alphabet = Utils.expandAlphRange(args[0]).join(""), + encoding = alphabetName(alphabet), + result = []; + + if (alphabet.length !== 85 || + [].unique.call(alphabet).length !== 85) { + throw new OperationError("Alphabet must be of length 85"); + } + + if (input.length === 0) return []; + + const matches = input.match(/<~(.+?)~>/); + if (matches !== null) input = matches[1]; + + let i = 0; + let block, blockBytes; + while (i < input.length) { + if (encoding === "Standard" && input[i] === "z") { + result.push(0, 0, 0, 0); + i++; + } else { + let digits = []; + digits = input + .substr(i, 5) + .split("") + .map((chr, idx) => { + const digit = alphabet.indexOf(chr); + if (digit < 0 || digit > 84) { + throw `Invalid character '${chr}' at index ${idx}`; + } + return digit; + }); + + block = + digits[0] * 52200625 + + digits[1] * 614125 + + (i + 2 < input.length ? digits[2] : 84) * 7225 + + (i + 3 < input.length ? digits[3] : 84) * 85 + + (i + 4 < input.length ? digits[4] : 84); + + blockBytes = [ + (block >> 24) & 0xff, + (block >> 16) & 0xff, + (block >> 8) & 0xff, + block & 0xff + ]; + + if (input.length < i + 5) { + blockBytes.splice(input.length - (i + 5), 5); + } + + result.push.apply(result, blockBytes); + i += 5; + } + } + + return result; + } + +} + +export default FromBase85; diff --git a/src/core/operations/FromBinary.mjs b/src/core/operations/FromBinary.mjs index 207b5352..7ae0cc19 100644 --- a/src/core/operations/FromBinary.mjs +++ b/src/core/operations/FromBinary.mjs @@ -22,6 +22,7 @@ class FromBinary extends Operation { this.name = "From Binary"; this.module = "Default"; this.description = "Converts a binary string back into its raw form.

    e.g. 01001000 01101001 becomes Hi"; + this.infoURL = "https://wikipedia.org/wiki/Binary_code"; this.inputType = "string"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/FromBraille.mjs b/src/core/operations/FromBraille.mjs new file mode 100644 index 00000000..61fa1452 --- /dev/null +++ b/src/core/operations/FromBraille.mjs @@ -0,0 +1,70 @@ +/** + * @author n1474335 [n1474335@gmail.com] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import {BRAILLE_LOOKUP} from "../lib/Braille"; + +/** + * From Braille operation + */ +class FromBraille extends Operation { + + /** + * FromBraille constructor + */ + constructor() { + super(); + + this.name = "From Braille"; + this.module = "Default"; + this.description = "Converts six-dot braille symbols to text."; + this.infoURL = "https://wikipedia.org/wiki/Braille"; + this.inputType = "string"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + return input.split("").map(b => { + const idx = BRAILLE_LOOKUP.dot6.indexOf(b); + return idx < 0 ? b : BRAILLE_LOOKUP.ascii[idx]; + }).join(""); + } + + /** + * Highlight From Braille + * + * @param {Object[]} pos + * @param {number} pos[].start + * @param {number} pos[].end + * @param {Object[]} args + * @returns {Object[]} pos + */ + highlight(pos, args) { + return pos; + } + + /** + * Highlight From Braille in reverse + * + * @param {Object[]} pos + * @param {number} pos[].start + * @param {number} pos[].end + * @param {Object[]} args + * @returns {Object[]} pos + */ + highlightReverse(pos, args) { + return pos; + } + +} + +export default FromBraille; diff --git a/src/core/operations/FromCharcode.mjs b/src/core/operations/FromCharcode.mjs index 2dee72f2..3ae54b6c 100644 --- a/src/core/operations/FromCharcode.mjs +++ b/src/core/operations/FromCharcode.mjs @@ -23,6 +23,7 @@ class FromCharcode extends Operation { this.name = "From Charcode"; this.module = "Default"; this.description = "Converts unicode character codes back into text.

    e.g. 0393 03b5 03b9 03ac 20 03c3 03bf 03c5 becomes Γειά σου"; + this.infoURL = "https://wikipedia.org/wiki/Plane_(Unicode)"; this.inputType = "string"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/FromDecimal.mjs b/src/core/operations/FromDecimal.mjs index 48667148..f3c117ff 100644 --- a/src/core/operations/FromDecimal.mjs +++ b/src/core/operations/FromDecimal.mjs @@ -5,8 +5,8 @@ */ import Operation from "../Operation"; -import Utils from "../Utils"; import {DELIM_OPTIONS} from "../lib/Delim"; +import {fromDecimal} from "../lib/Decimal"; /** * From Decimal operation @@ -71,16 +71,7 @@ class FromDecimal extends Operation { * @returns {byteArray} */ run(input, args) { - const delim = Utils.charRep(args[0]), - output = []; - let byteStr = input.split(delim); - if (byteStr[byteStr.length-1] === "") - byteStr = byteStr.slice(0, byteStr.length-1); - - for (let i = 0; i < byteStr.length; i++) { - output[i] = parseInt(byteStr[i], 10); - } - return output; + return fromDecimal(input, args[0]); } } diff --git a/src/core/operations/FromGeohash.mjs b/src/core/operations/FromGeohash.mjs new file mode 100644 index 00000000..b70273da --- /dev/null +++ b/src/core/operations/FromGeohash.mjs @@ -0,0 +1,44 @@ +/** + * @author gchq77703 [] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import geohash from "ngeohash"; + +/** + * From Geohash operation + */ +class FromGeohash extends Operation { + + /** + * FromGeohash constructor + */ + constructor() { + super(); + + this.name = "From Geohash"; + this.module = "Hashing"; + this.description = "Converts Geohash strings into Lat/Long coordinates. For example, ww8p1r4t8 becomes 37.8324,112.5584."; + this.infoURL = "https://wikipedia.org/wiki/Geohash"; + this.inputType = "string"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + return input.split("\n").map(line => { + const coords = geohash.decode(line); + return [coords.latitude, coords.longitude].join(","); + }).join("\n"); + } + +} + +export default FromGeohash; diff --git a/src/core/operations/FromHTMLEntity.mjs b/src/core/operations/FromHTMLEntity.mjs index e9865d95..0a07962b 100644 --- a/src/core/operations/FromHTMLEntity.mjs +++ b/src/core/operations/FromHTMLEntity.mjs @@ -21,6 +21,7 @@ class FromHTMLEntity extends Operation { this.name = "From HTML Entity"; this.module = "Default"; this.description = "Converts HTML entities back to characters

    e.g. &amp; becomes &"; + this.infoURL = "https://wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/FromHex.mjs b/src/core/operations/FromHex.mjs index 45ea9955..658cf341 100644 --- a/src/core/operations/FromHex.mjs +++ b/src/core/operations/FromHex.mjs @@ -22,6 +22,7 @@ class FromHex extends Operation { this.name = "From Hex"; this.module = "Default"; this.description = "Converts a hexadecimal byte string back into its raw value.

    e.g. ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a becomes the UTF-8 encoded string Γειά σου"; + this.infoURL = "https://wikipedia.org/wiki/Hexadecimal"; this.inputType = "string"; this.outputType = "byteArray"; this.args = [ @@ -86,7 +87,7 @@ class FromHex extends Operation { * @returns {byteArray} */ run(input, args) { - const delim = args[0] || "Space"; + const delim = args[0] || "Auto"; return fromHex(input, delim, 2); } diff --git a/src/core/operations/FromHexContent.mjs b/src/core/operations/FromHexContent.mjs index 9de085db..22e858e2 100644 --- a/src/core/operations/FromHexContent.mjs +++ b/src/core/operations/FromHexContent.mjs @@ -21,7 +21,8 @@ class FromHexContent extends Operation { this.name = "From Hex Content"; this.module = "Default"; - this.description = "Translates hexadecimal bytes in text back to raw bytes.

    e.g. foo|3d|bar becomes foo=bar."; + this.description = "Translates hexadecimal bytes in text back to raw bytes. This format is used by SNORT for representing hex within ASCII text.

    e.g. foo|3d|bar becomes foo=bar."; + this.infoURL = "http://manual-snort-org.s3-website-us-east-1.amazonaws.com/node32.html#SECTION00451000000000000000"; this.inputType = "string"; this.outputType = "byteArray"; this.args = []; diff --git a/src/core/operations/FromHexdump.mjs b/src/core/operations/FromHexdump.mjs index e44b9120..7f4d9119 100644 --- a/src/core/operations/FromHexdump.mjs +++ b/src/core/operations/FromHexdump.mjs @@ -21,6 +21,7 @@ class FromHexdump extends Operation { this.name = "From Hexdump"; this.module = "Default"; this.description = "Attempts to convert a hexdump back into raw data. This operation supports many different hexdump variations, but probably not all. Make sure you verify that the data it gives you is correct before continuing analysis."; + this.infoURL = "https://wikipedia.org/wiki/Hex_dump"; this.inputType = "string"; this.outputType = "byteArray"; this.args = []; diff --git a/src/core/operations/FromMessagePack.mjs b/src/core/operations/FromMessagePack.mjs new file mode 100644 index 00000000..cea7c498 --- /dev/null +++ b/src/core/operations/FromMessagePack.mjs @@ -0,0 +1,47 @@ +/** + * @author Matt C [matt@artemisbot.uk] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import OperationError from "../errors/OperationError"; +import notepack from "notepack.io"; + +/** + * From MessagePack operation + */ +class FromMessagePack extends Operation { + + /** + * FromMessagePack constructor + */ + constructor() { + super(); + + this.name = "From MessagePack"; + this.module = "Code"; + this.description = "Converts MessagePack encoded data to JSON. MessagePack is a computer data interchange format. It is a binary form for representing simple data structures like arrays and associative arrays."; + this.infoURL = "https://wikipedia.org/wiki/MessagePack"; + this.inputType = "ArrayBuffer"; + this.outputType = "JSON"; + this.args = []; + } + + /** + * @param {ArrayBuffer} input + * @param {Object[]} args + * @returns {JSON} + */ + run(input, args) { + try { + const buf = Buffer.from(new Uint8Array(input)); + return notepack.decode(buf); + } catch (err) { + throw new OperationError(`Could not decode MessagePack to JSON: ${err}`); + } + } + +} + +export default FromMessagePack; diff --git a/src/core/operations/FromMorseCode.mjs b/src/core/operations/FromMorseCode.mjs index ecf20a08..71613ad1 100644 --- a/src/core/operations/FromMorseCode.mjs +++ b/src/core/operations/FromMorseCode.mjs @@ -22,6 +22,7 @@ class FromMorseCode extends Operation { this.name = "From Morse Code"; this.module = "Default"; this.description = "Translates Morse Code into (upper case) alphanumeric characters."; + this.infoURL = "https://wikipedia.org/wiki/Morse_code"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/FromOctal.mjs b/src/core/operations/FromOctal.mjs index efe04050..41060807 100644 --- a/src/core/operations/FromOctal.mjs +++ b/src/core/operations/FromOctal.mjs @@ -22,6 +22,7 @@ class FromOctal extends Operation { this.name = "From Octal"; this.module = "Default"; this.description = "Converts an octal byte string back into its raw value.

    e.g. 316 223 316 265 316 271 316 254 40 317 203 316 277 317 205 becomes the UTF-8 encoded string Γειά σου"; + this.infoURL = "https://wikipedia.org/wiki/Octal"; this.inputType = "string"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/FromPunycode.mjs b/src/core/operations/FromPunycode.mjs index 1a1cebbf..96c0bcf9 100644 --- a/src/core/operations/FromPunycode.mjs +++ b/src/core/operations/FromPunycode.mjs @@ -21,6 +21,7 @@ class FromPunycode extends Operation { this.name = "From Punycode"; this.module = "Encodings"; this.description = "Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

    e.g. mnchen-3ya decodes to m\xfcnchen"; + this.infoURL = "https://wikipedia.org/wiki/Punycode"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/FromQuotedPrintable.mjs b/src/core/operations/FromQuotedPrintable.mjs index 06a6432c..ee079ec6 100644 --- a/src/core/operations/FromQuotedPrintable.mjs +++ b/src/core/operations/FromQuotedPrintable.mjs @@ -24,6 +24,7 @@ class FromQuotedPrintable extends Operation { this.name = "From Quoted Printable"; this.module = "Default"; this.description = "Converts QP-encoded text back to standard text."; + this.infoURL = "https://wikipedia.org/wiki/Quoted-printable"; this.inputType = "string"; this.outputType = "byteArray"; this.args = []; diff --git a/src/core/operations/FromUNIXTimestamp.mjs b/src/core/operations/FromUNIXTimestamp.mjs index c6d6af43..ee074ec0 100644 --- a/src/core/operations/FromUNIXTimestamp.mjs +++ b/src/core/operations/FromUNIXTimestamp.mjs @@ -23,6 +23,7 @@ class FromUNIXTimestamp extends Operation { this.name = "From UNIX Timestamp"; this.module = "Default"; this.description = "Converts a UNIX timestamp to a datetime string.

    e.g. 978346800 becomes Mon 1 January 2001 11:00:00 UTC

    A UNIX timestamp is a 32-bit value representing the number of seconds since January 1, 1970 UTC (the UNIX epoch)."; + this.infoURL = "https://wikipedia.org/wiki/Unix_time"; this.inputType = "number"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/GenerateAllHashes.mjs b/src/core/operations/GenerateAllHashes.mjs index 1280249a..65820673 100644 --- a/src/core/operations/GenerateAllHashes.mjs +++ b/src/core/operations/GenerateAllHashes.mjs @@ -43,6 +43,7 @@ class GenerateAllHashes extends Operation { this.name = "Generate all hashes"; this.module = "Hashing"; this.description = "Generates all available hashes and checksums for the input."; + this.infoURL = "https://wikipedia.org/wiki/Comparison_of_cryptographic_hash_functions"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/GenerateHOTP.mjs b/src/core/operations/GenerateHOTP.mjs index 36c115c5..a1a80012 100644 --- a/src/core/operations/GenerateHOTP.mjs +++ b/src/core/operations/GenerateHOTP.mjs @@ -22,6 +22,7 @@ class GenerateHOTP extends Operation { this.name = "Generate HOTP"; this.module = "Default"; this.description = "The HMAC-based One-Time Password algorithm (HOTP) is an algorithm that computes a one-time password from a shared secret key and an incrementing counter. It has been adopted as Internet Engineering Task Force standard RFC 4226, is the cornerstone of Initiative For Open Authentication (OATH), and is used in a number of two-factor authentication systems.

    Enter the secret as the input or leave it blank for a random secret to be generated."; + this.infoURL = "https://wikipedia.org/wiki/HMAC-based_One-time_Password_algorithm"; this.inputType = "byteArray"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/GeneratePGPKeyPair.mjs b/src/core/operations/GeneratePGPKeyPair.mjs index 9224011e..74f8a404 100644 --- a/src/core/operations/GeneratePGPKeyPair.mjs +++ b/src/core/operations/GeneratePGPKeyPair.mjs @@ -26,6 +26,7 @@ class GeneratePGPKeyPair extends Operation { this.name = "Generate PGP Key Pair"; this.module = "PGP"; this.description = "Generates a new public/private PGP key pair. Supports RSA and Eliptic Curve (EC) keys."; + this.infoURL = "https://wikipedia.org/wiki/Pretty_Good_Privacy"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/GenerateTOTP.mjs b/src/core/operations/GenerateTOTP.mjs index 8d53f1be..a71708a2 100644 --- a/src/core/operations/GenerateTOTP.mjs +++ b/src/core/operations/GenerateTOTP.mjs @@ -22,6 +22,7 @@ class GenerateTOTP extends Operation { this.name = "Generate TOTP"; this.module = "Default"; this.description = "The Time-based One-Time Password algorithm (TOTP) is an algorithm that computes a one-time password from a shared secret key and the current time. It has been adopted as Internet Engineering Task Force standard RFC 6238, is the cornerstone of Initiative For Open Authentication (OATH), and is used in a number of two-factor authentication systems. A TOTP is an HOTP where the counter is the current time.

    Enter the secret as the input or leave it blank for a random secret to be generated. T0 and T1 are in seconds."; + this.infoURL = "https://wikipedia.org/wiki/Time-based_One-time_Password_algorithm"; this.inputType = "byteArray"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/GenerateUUID.mjs b/src/core/operations/GenerateUUID.mjs index 59837b26..eef32c73 100644 --- a/src/core/operations/GenerateUUID.mjs +++ b/src/core/operations/GenerateUUID.mjs @@ -21,6 +21,7 @@ class GenerateUUID extends Operation { this.name = "Generate UUID"; this.module = "Crypto"; this.description = "Generates an RFC 4122 version 4 compliant Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).

    A version 4 UUID relies on random numbers, in this case generated using window.crypto if available and falling back to Math.random if not."; + this.infoURL = "https://wikipedia.org/wiki/Universally_unique_identifier"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/GroupIPAddresses.mjs b/src/core/operations/GroupIPAddresses.mjs index a5b7ea2d..1016852b 100644 --- a/src/core/operations/GroupIPAddresses.mjs +++ b/src/core/operations/GroupIPAddresses.mjs @@ -24,6 +24,7 @@ class GroupIPAddresses extends Operation { this.name = "Group IP addresses"; this.module = "JSBN"; this.description = "Groups a list of IP addresses into subnets. Supports both IPv4 and IPv6 addresses."; + this.infoURL = "https://wikipedia.org/wiki/Subnetwork"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/Gunzip.mjs b/src/core/operations/Gunzip.mjs index 19821de6..fe514186 100644 --- a/src/core/operations/Gunzip.mjs +++ b/src/core/operations/Gunzip.mjs @@ -23,6 +23,7 @@ class Gunzip extends Operation { this.name = "Gunzip"; this.module = "Compression"; this.description = "Decompresses data which has been compressed using the deflate algorithm with gzip headers."; + this.infoURL = "https://wikipedia.org/wiki/Gzip"; this.inputType = "ArrayBuffer"; this.outputType = "ArrayBuffer"; this.args = []; diff --git a/src/core/operations/Gzip.mjs b/src/core/operations/Gzip.mjs index 878959ab..e4a6c15f 100644 --- a/src/core/operations/Gzip.mjs +++ b/src/core/operations/Gzip.mjs @@ -24,6 +24,7 @@ class Gzip extends Operation { this.name = "Gzip"; this.module = "Compression"; this.description = "Compresses data using the deflate algorithm with gzip headers."; + this.infoURL = "https://wikipedia.org/wiki/Gzip"; this.inputType = "ArrayBuffer"; this.outputType = "ArrayBuffer"; this.args = [ diff --git a/src/core/operations/HAS160.mjs b/src/core/operations/HAS160.mjs index 1cf1ab6e..64259999 100644 --- a/src/core/operations/HAS160.mjs +++ b/src/core/operations/HAS160.mjs @@ -21,6 +21,7 @@ class HAS160 extends Operation { this.name = "HAS-160"; this.module = "Hashing"; this.description = "HAS-160 is a cryptographic hash function designed for use with the Korean KCDSA digital signature algorithm. It is derived from SHA-1, with assorted changes intended to increase its security. It produces a 160-bit output.

    HAS-160 is used in the same way as SHA-1. First it divides input in blocks of 512 bits each and pads the final block. A digest function updates the intermediate hash value by processing the input blocks in turn.

    The message digest algorithm consists of 80 rounds."; + this.infoURL = "https://wikipedia.org/wiki/HAS-160"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/HMAC.mjs b/src/core/operations/HMAC.mjs index e29656ce..c825f5ff 100644 --- a/src/core/operations/HMAC.mjs +++ b/src/core/operations/HMAC.mjs @@ -22,6 +22,7 @@ class HMAC extends Operation { this.name = "HMAC"; this.module = "Hashing"; this.description = "Keyed-Hash Message Authentication Codes (HMAC) are a mechanism for message authentication using cryptographic hash functions."; + this.infoURL = "https://wikipedia.org/wiki/HMAC"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/HTTPRequest.mjs b/src/core/operations/HTTPRequest.mjs index 6846f97a..52029930 100644 --- a/src/core/operations/HTTPRequest.mjs +++ b/src/core/operations/HTTPRequest.mjs @@ -30,6 +30,7 @@ class HTTPRequest extends Operation { "

    ", "The status code of the response, along with a limited selection of exposed headers, can be viewed by checking the 'Show response metadata' option. Only a limited set of response headers are exposed by the browser for security reasons.", ].join("\n"); + this.infoURL = "https://wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields"; this.inputType = "string"; this.outputType = "string"; this.manualBake = true; diff --git a/src/core/operations/HammingDistance.mjs b/src/core/operations/HammingDistance.mjs index 173ca3e7..87c5d222 100644 --- a/src/core/operations/HammingDistance.mjs +++ b/src/core/operations/HammingDistance.mjs @@ -23,6 +23,7 @@ class HammingDistance extends Operation { this.name = "Hamming Distance"; this.module = "Default"; this.description = "In information theory, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of substitutions required to change one string into the other, or the minimum number of errors that could have transformed one string into the other. In a more general context, the Hamming distance is one of several string metrics for measuring the edit distance between two sequences."; + this.infoURL = "https://wikipedia.org/wiki/Hamming_distance"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/HaversineDistance.mjs b/src/core/operations/HaversineDistance.mjs index 3e7bc506..d5c0bf60 100644 --- a/src/core/operations/HaversineDistance.mjs +++ b/src/core/operations/HaversineDistance.mjs @@ -21,6 +21,7 @@ class HaversineDistance extends Operation { this.name = "Haversine distance"; this.module = "Default"; this.description = "Returns the distance between two pairs of GPS latitude and longitude co-ordinates in metres.

    e.g. 51.487263,-0.124323, 38.9517,-77.1467"; + this.infoURL = "https://wikipedia.org/wiki/Haversine_formula"; this.inputType = "string"; this.outputType = "number"; this.args = []; diff --git a/src/core/operations/HexToObjectIdentifier.mjs b/src/core/operations/HexToObjectIdentifier.mjs index 00512e1a..aea5dd24 100644 --- a/src/core/operations/HexToObjectIdentifier.mjs +++ b/src/core/operations/HexToObjectIdentifier.mjs @@ -21,6 +21,7 @@ class HexToObjectIdentifier extends Operation { this.name = "Hex to Object Identifier"; this.module = "PublicKey"; this.description = "Converts a hexadecimal string into an object identifier (OID)."; + this.infoURL = "https://wikipedia.org/wiki/Object_identifier"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/HexToPEM.mjs b/src/core/operations/HexToPEM.mjs index c08888d4..b0845685 100644 --- a/src/core/operations/HexToPEM.mjs +++ b/src/core/operations/HexToPEM.mjs @@ -21,6 +21,7 @@ class HexToPEM extends Operation { this.name = "Hex to PEM"; this.module = "PublicKey"; this.description = "Converts a hexadecimal DER (Distinguished Encoding Rules) string into PEM (Privacy Enhanced Mail) format."; + this.infoURL = "https://wikipedia.org/wiki/Privacy-Enhanced_Mail"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/JPathExpression.mjs b/src/core/operations/JPathExpression.mjs index 21b4284f..df99fc56 100644 --- a/src/core/operations/JPathExpression.mjs +++ b/src/core/operations/JPathExpression.mjs @@ -22,6 +22,7 @@ class JPathExpression extends Operation { this.name = "JPath expression"; this.module = "Code"; this.description = "Extract information from a JSON object with a JPath query."; + this.infoURL = "http://goessner.net/articles/JsonPath/"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/JWTDecode.mjs b/src/core/operations/JWTDecode.mjs new file mode 100644 index 00000000..2166a447 --- /dev/null +++ b/src/core/operations/JWTDecode.mjs @@ -0,0 +1,51 @@ +/** + * @author gchq77703 [] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import jwt from "jsonwebtoken"; +import OperationError from "../errors/OperationError"; + +/** + * JWT Decode operation + */ +class JWTDecode extends Operation { + + /** + * JWTDecode constructor + */ + constructor() { + super(); + + this.name = "JWT Decode"; + this.module = "Crypto"; + this.description = "Decodes a JSON Web Token without checking whether the provided secret / private key is valid. Use 'JWT Verify' to check if the signature is valid as well."; + this.infoURL = "https://wikipedia.org/wiki/JSON_Web_Token"; + this.inputType = "string"; + this.outputType = "JSON"; + this.args = []; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {JSON} + */ + run(input, args) { + try { + const decoded = jwt.decode(input, { + json: true, + complete: true + }); + + return decoded.payload; + } catch (err) { + throw new OperationError(err); + } + } + +} + +export default JWTDecode; diff --git a/src/core/operations/JWTSign.mjs b/src/core/operations/JWTSign.mjs new file mode 100644 index 00000000..b3f79b57 --- /dev/null +++ b/src/core/operations/JWTSign.mjs @@ -0,0 +1,74 @@ +/** + * @author gchq77703 [] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import jwt from "jsonwebtoken"; +import OperationError from "../errors/OperationError"; + +/** + * JWT Sign operation + */ +class JWTSign extends Operation { + + /** + * JWTSign constructor + */ + constructor() { + super(); + + this.name = "JWT Sign"; + this.module = "Crypto"; + this.description = "Signs a JSON object as a JSON Web Token using a provided secret / private key.

    The key should be either the secret for HMAC algorithms or the PEM-encoded private key for RSA and ECDSA."; + this.infoURL = "https://wikipedia.org/wiki/JSON_Web_Token"; + this.inputType = "JSON"; + this.outputType = "string"; + this.args = [ + { + name: "Private/Secret Key", + type: "text", + value: "secret" + }, + { + name: "Signing algorithm", + type: "option", + value: [ + "HS256", + "HS384", + "HS512", + "RS256", + "RS384", + "RS512", + "ES256", + "ES384", + "ES512", + "None" + ] + } + ]; + } + + /** + * @param {JSON} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + const [key, algorithm] = args; + + try { + return jwt.sign(input, key, { + algorithm: algorithm === "None" ? "none" : algorithm + }); + } catch (err) { + throw new OperationError(`Error: Have you entered the key correctly? The key should be either the secret for HMAC algorithms or the PEM-encoded private key for RSA and ECDSA. + +${err}`); + } + } + +} + +export default JWTSign; diff --git a/src/core/operations/JWTVerify.mjs b/src/core/operations/JWTVerify.mjs new file mode 100644 index 00000000..651e7662 --- /dev/null +++ b/src/core/operations/JWTVerify.mjs @@ -0,0 +1,65 @@ +/** + * @author gchq77703 [] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import jwt from "jsonwebtoken"; +import OperationError from "../errors/OperationError"; + +/** + * JWT Verify operation + */ +class JWTVerify extends Operation { + + /** + * JWTVerify constructor + */ + constructor() { + super(); + + this.name = "JWT Verify"; + this.module = "Crypto"; + this.description = "Verifies that a JSON Web Token is valid and has been signed with the provided secret / private key.

    The key should be either the secret for HMAC algorithms or the PEM-encoded private key for RSA and ECDSA."; + this.infoURL = "https://wikipedia.org/wiki/JSON_Web_Token"; + this.inputType = "string"; + this.outputType = "JSON"; + this.args = [ + { + name: "Private/Secret Key", + type: "text", + value: "secret" + }, + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + const [key] = args; + + try { + const verified = jwt.verify(input, key, { algorithms: [ + "HS256", + "HS384", + "HS512", + "none" + ]}); + + if (verified.hasOwnProperty("name") && verified.name === "JsonWebTokenError") { + throw new OperationError(verified.message); + } + + return verified; + } catch (err) { + throw new OperationError(err); + } + } + +} + +export default JWTVerify; diff --git a/src/core/operations/JavaScriptParser.mjs b/src/core/operations/JavaScriptParser.mjs index 047bc730..40ee7a57 100644 --- a/src/core/operations/JavaScriptParser.mjs +++ b/src/core/operations/JavaScriptParser.mjs @@ -21,6 +21,7 @@ class JavaScriptParser extends Operation { this.name = "JavaScript Parser"; this.module = "Code"; this.description = "Returns an Abstract Syntax Tree for valid JavaScript code."; + this.infoURL = "https://en.wikipedia.org/wiki/Abstract_syntax_tree"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/Keccak.mjs b/src/core/operations/Keccak.mjs index cfe5dd8a..2044ee7f 100644 --- a/src/core/operations/Keccak.mjs +++ b/src/core/operations/Keccak.mjs @@ -22,6 +22,7 @@ class Keccak extends Operation { this.name = "Keccak"; this.module = "Hashing"; this.description = "The Keccak hash algorithm was designed by Guido Bertoni, Joan Daemen, Micha\xebl Peeters, and Gilles Van Assche, building upon RadioGat\xfan. It was selected as the winner of the SHA-3 design competition.

    This version of the algorithm is Keccak[c=2d] and differs from the SHA-3 specification."; + this.infoURL = "https://wikipedia.org/wiki/SHA-3"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/MD2.mjs b/src/core/operations/MD2.mjs index ab21a397..bc69ecfb 100644 --- a/src/core/operations/MD2.mjs +++ b/src/core/operations/MD2.mjs @@ -21,6 +21,7 @@ class MD2 extends Operation { this.name = "MD2"; this.module = "Hashing"; this.description = "The MD2 (Message-Digest 2) algorithm is a cryptographic hash function developed by Ronald Rivest in 1989. The algorithm is optimized for 8-bit computers.

    Although MD2 is no longer considered secure, even as of 2014, it remains in use in public key infrastructures as part of certificates generated with MD2 and RSA."; + this.infoURL = "https://wikipedia.org/wiki/MD2_(cryptography)"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/MD4.mjs b/src/core/operations/MD4.mjs index 52712580..129769af 100644 --- a/src/core/operations/MD4.mjs +++ b/src/core/operations/MD4.mjs @@ -21,6 +21,7 @@ class MD4 extends Operation { this.name = "MD4"; this.module = "Hashing"; this.description = "The MD4 (Message-Digest 4) algorithm is a cryptographic hash function developed by Ronald Rivest in 1990. The digest length is 128 bits. The algorithm has influenced later designs, such as the MD5, SHA-1 and RIPEMD algorithms.

    The security of MD4 has been severely compromised."; + this.infoURL = "https://wikipedia.org/wiki/MD4"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/MD5.mjs b/src/core/operations/MD5.mjs index 692f0f96..6329b641 100644 --- a/src/core/operations/MD5.mjs +++ b/src/core/operations/MD5.mjs @@ -21,6 +21,7 @@ class MD5 extends Operation { this.name = "MD5"; this.module = "Hashing"; this.description = "MD5 (Message-Digest 5) is a widely used hash function. It has been used in a variety of security applications and is also commonly used to check the integrity of files.

    However, MD5 is not collision resistant and it isn't suitable for applications like SSL/TLS certificates or digital signatures that rely on this property."; + this.infoURL = "https://wikipedia.org/wiki/MD5"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/MD6.mjs b/src/core/operations/MD6.mjs index 2d12cc27..e29db447 100644 --- a/src/core/operations/MD6.mjs +++ b/src/core/operations/MD6.mjs @@ -22,6 +22,7 @@ class MD6 extends Operation { this.name = "MD6"; this.module = "Hashing"; this.description = "The MD6 (Message-Digest 6) algorithm is a cryptographic hash function. It uses a Merkle tree-like structure to allow for immense parallel computation of hashes for very long inputs."; + this.infoURL = "https://wikipedia.org/wiki/MD6"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/Magic.mjs b/src/core/operations/Magic.mjs index 7467c5dd..b3e15e63 100644 --- a/src/core/operations/Magic.mjs +++ b/src/core/operations/Magic.mjs @@ -23,7 +23,8 @@ class Magic extends Operation { this.name = "Magic"; this.flowControl = true; this.module = "Default"; - this.description = "The Magic operation attempts to detect various properties of the input data and suggests which operations could help to make more sense of it.

    Options
    Depth: If an operation appears to match the data, it will be run and the result will be analysed further. This argument controls the maximum number of levels of recursion.

    Intensive mode: When this is turned on, various operations like XOR, bit rotates, and character encodings are brute-forced to attempt to detect valid data underneath. To improve performance, only the first 100 bytes of the data is brute-forced.

    Extensive language support: At each stage, the relative byte frequencies of the data will be compared to average frequencies for a number of languages. The default set consists of ~40 of the most commonly used languages on the Internet. The extensive list consists of 284 languages and can result in many languages matching the data if their byte frequencies are similar.

    A technical explanation of the Magic operation can be found here."; + this.description = "The Magic operation attempts to detect various properties of the input data and suggests which operations could help to make more sense of it.

    Options
    Depth: If an operation appears to match the data, it will be run and the result will be analysed further. This argument controls the maximum number of levels of recursion.

    Intensive mode: When this is turned on, various operations like XOR, bit rotates, and character encodings are brute-forced to attempt to detect valid data underneath. To improve performance, only the first 100 bytes of the data is brute-forced.

    Extensive language support: At each stage, the relative byte frequencies of the data will be compared to average frequencies for a number of languages. The default set consists of ~40 of the most commonly used languages on the Internet. The extensive list consists of 284 languages and can result in many languages matching the data if their byte frequencies are similar."; + this.infoURL = "https://github.com/gchq/CyberChef/wiki/Automatic-detection-of-encoded-data-using-CyberChef-Magic"; this.inputType = "ArrayBuffer"; this.outputType = "JSON"; this.presentType = "html"; diff --git a/src/core/operations/Mean.mjs b/src/core/operations/Mean.mjs index 16342e7a..a9bb8831 100644 --- a/src/core/operations/Mean.mjs +++ b/src/core/operations/Mean.mjs @@ -24,6 +24,7 @@ class Mean extends Operation { this.name = "Mean"; this.module = "Default"; this.description = "Computes the mean (average) of a number list. If an item in the string is not a number it is excluded from the list.

    e.g. 0x0a 8 .5 .5 becomes 4.75"; + this.infoURL = "https://wikipedia.org/wiki/Arithmetic_mean"; this.inputType = "string"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/Median.mjs b/src/core/operations/Median.mjs index b1936fa8..ac75d83e 100644 --- a/src/core/operations/Median.mjs +++ b/src/core/operations/Median.mjs @@ -24,6 +24,7 @@ class Median extends Operation { this.name = "Median"; this.module = "Default"; this.description = "Computes the median of a number list. If an item in the string is not a number it is excluded from the list.

    e.g. 0x0a 8 1 .5 becomes 4.5"; + this.infoURL = "https://wikipedia.org/wiki/Median"; this.inputType = "string"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/MicrosoftScriptDecoder.mjs b/src/core/operations/MicrosoftScriptDecoder.mjs index cc9d407f..bb475ffc 100644 --- a/src/core/operations/MicrosoftScriptDecoder.mjs +++ b/src/core/operations/MicrosoftScriptDecoder.mjs @@ -20,6 +20,7 @@ class MicrosoftScriptDecoder extends Operation { this.name = "Microsoft Script Decoder"; this.module = "Default"; this.description = "Decodes Microsoft Encoded Script files that have been encoded with Microsoft's custom encoding. These are often VBS (Visual Basic Script) files that are encoded and renamed with a '.vbe' extention or JS (JScript) files renamed with a '.jse' extention.

    Sample

    Encoded:
    #@~^RQAAAA==-mD~sX|:/TP{~J:+dYbxL~@!F@*@!+@*@!&@*eEI@#@&@#@&.jm.raY 214Wv:zms/obI0xEAAA==^#~@

    Decoded:
    var my_msg = "Testing <1><2><3>!";\n\nVScript.Echo(my_msg);"; + this.infoURL = "https://wikipedia.org/wiki/JScript.Encode"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/Multiply.mjs b/src/core/operations/Multiply.mjs index 3f78daa4..f7e792e2 100644 --- a/src/core/operations/Multiply.mjs +++ b/src/core/operations/Multiply.mjs @@ -25,6 +25,7 @@ class Multiply extends Operation { this.name = "Multiply"; this.module = "Default"; this.description = "Multiplies a list of numbers. If an item in the string is not a number it is excluded from the list.

    e.g. 0x0a 8 .5 becomes 40"; + this.infoURL = "https://wikipedia.org/wiki/Multiplication"; this.inputType = "string"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/NOT.mjs b/src/core/operations/NOT.mjs index e0352dd0..e7f00393 100644 --- a/src/core/operations/NOT.mjs +++ b/src/core/operations/NOT.mjs @@ -21,6 +21,7 @@ class NOT extends Operation { this.name = "NOT"; this.module = "Default"; this.description = "Returns the inverse of each byte."; + this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#NOT"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = []; diff --git a/src/core/operations/Numberwang.mjs b/src/core/operations/Numberwang.mjs index 202e4dc7..96100fbb 100644 --- a/src/core/operations/Numberwang.mjs +++ b/src/core/operations/Numberwang.mjs @@ -20,6 +20,7 @@ class Numberwang extends Operation { this.name = "Numberwang"; this.module = "Default"; this.description = "Based on the popular gameshow by Mitchell and Webb."; + this.infoURL = "https://wikipedia.org/wiki/That_Mitchell_and_Webb_Look#Recurring_sketches"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/OR.mjs b/src/core/operations/OR.mjs index 33bb2f63..be64cd8e 100644 --- a/src/core/operations/OR.mjs +++ b/src/core/operations/OR.mjs @@ -22,6 +22,7 @@ class OR extends Operation { this.name = "OR"; this.module = "Default"; this.description = "OR the input with the given key.
    e.g. fe023da5"; + this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#OR"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ @@ -29,7 +30,7 @@ class OR extends Operation { "name": "Key", "type": "toggleString", "value": "", - "toggleValues": ["Hex", "Base64", "UTF8", "Latin1"] + "toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"] } ]; } diff --git a/src/core/operations/ObjectIdentifierToHex.mjs b/src/core/operations/ObjectIdentifierToHex.mjs index 9be7108c..90e45ea5 100644 --- a/src/core/operations/ObjectIdentifierToHex.mjs +++ b/src/core/operations/ObjectIdentifierToHex.mjs @@ -21,6 +21,7 @@ class ObjectIdentifierToHex extends Operation { this.name = "Object Identifier to Hex"; this.module = "PublicKey"; this.description = "Converts an object identifier (OID) into a hexadecimal string."; + this.infoURL = "https://wikipedia.org/wiki/Object_identifier"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/PEMToHex.mjs b/src/core/operations/PEMToHex.mjs index 36ac4d71..a2c989fe 100644 --- a/src/core/operations/PEMToHex.mjs +++ b/src/core/operations/PEMToHex.mjs @@ -21,6 +21,7 @@ class PEMToHex extends Operation { this.name = "PEM to Hex"; this.module = "PublicKey"; this.description = "Converts PEM (Privacy Enhanced Mail) format to a hexadecimal DER (Distinguished Encoding Rules) string."; + this.infoURL = "https://en.wikipedia.org/wiki/X.690#DER_encoding"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/PGPDecrypt.mjs b/src/core/operations/PGPDecrypt.mjs index 6e0b3d3d..ccf13cd1 100644 --- a/src/core/operations/PGPDecrypt.mjs +++ b/src/core/operations/PGPDecrypt.mjs @@ -34,6 +34,7 @@ class PGPDecrypt extends Operation { "

    ", "This function uses the Keybase implementation of PGP.", ].join("\n"); + this.infoURL = "https://wikipedia.org/wiki/Pretty_Good_Privacy"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/PGPDecryptAndVerify.mjs b/src/core/operations/PGPDecryptAndVerify.mjs index 0f6463f2..58c61c25 100644 --- a/src/core/operations/PGPDecryptAndVerify.mjs +++ b/src/core/operations/PGPDecryptAndVerify.mjs @@ -36,6 +36,7 @@ class PGPDecryptAndVerify extends Operation { "

    ", "This function uses the Keybase implementation of PGP.", ].join("\n"); + this.infoURL = "https://wikipedia.org/wiki/Pretty_Good_Privacy"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/PGPEncrypt.mjs b/src/core/operations/PGPEncrypt.mjs index 345d313f..5d19de32 100644 --- a/src/core/operations/PGPEncrypt.mjs +++ b/src/core/operations/PGPEncrypt.mjs @@ -33,6 +33,7 @@ class PGPEncrypt extends Operation { "

    ", "This function uses the Keybase implementation of PGP.", ].join("\n"); + this.infoURL = "https://wikipedia.org/wiki/Pretty_Good_Privacy"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/PGPEncryptAndSign.mjs b/src/core/operations/PGPEncryptAndSign.mjs index 0daa27b5..d9d19ce3 100644 --- a/src/core/operations/PGPEncryptAndSign.mjs +++ b/src/core/operations/PGPEncryptAndSign.mjs @@ -36,6 +36,7 @@ class PGPEncryptAndSign extends Operation { "

    ", "This function uses the Keybase implementation of PGP.", ].join("\n"); + this.infoURL = "https://wikipedia.org/wiki/Pretty_Good_Privacy"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/PHPDeserialize.mjs b/src/core/operations/PHPDeserialize.mjs index a54c04d2..760e4e05 100644 --- a/src/core/operations/PHPDeserialize.mjs +++ b/src/core/operations/PHPDeserialize.mjs @@ -21,6 +21,7 @@ class PHPDeserialize extends Operation { this.name = "PHP Deserialize"; this.module = "Default"; this.description = "Deserializes PHP serialized data, outputting keyed arrays as JSON.

    This function does not support object tags.

    Example:
    a:2:{s:1:"a";i:10;i:0;a:1:{s:2:"ab";b:1;}}
    becomes
    {"a": 10,0: {"ab": true}}

    Output valid JSON: JSON doesn't support integers as keys, whereas PHP serialization does. Enabling this will cast these integers to strings. This will also escape backslashes."; + this.infoURL = "http://www.phpinternalsbook.com/classes_objects/serialization.html"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ParseASN1HexString.mjs b/src/core/operations/ParseASN1HexString.mjs index 9f192156..92c070a4 100644 --- a/src/core/operations/ParseASN1HexString.mjs +++ b/src/core/operations/ParseASN1HexString.mjs @@ -21,6 +21,7 @@ class ParseASN1HexString extends Operation { this.name = "Parse ASN.1 hex string"; this.module = "PublicKey"; this.description = "Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.

    This operation parses arbitrary ASN.1 data and presents the resulting tree."; + this.infoURL = "https://wikipedia.org/wiki/Abstract_Syntax_Notation_One"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ParseColourCode.mjs b/src/core/operations/ParseColourCode.mjs index ca6ee80d..c97f9b89 100644 --- a/src/core/operations/ParseColourCode.mjs +++ b/src/core/operations/ParseColourCode.mjs @@ -20,6 +20,7 @@ class ParseColourCode extends Operation { this.name = "Parse colour code"; this.module = "Default"; this.description = "Converts a colour code in a standard format to other standard formats and displays the colour itself.

    Example inputs
    • #d9edf7
    • rgba(217,237,247,1)
    • hsla(200,65%,91%,1)
    • cmyk(0.12, 0.04, 0.00, 0.03)
    "; + this.infoURL = "https://wikipedia.org/wiki/Web_colors"; this.inputType = "string"; this.outputType = "html"; this.args = []; diff --git a/src/core/operations/ParseDateTime.mjs b/src/core/operations/ParseDateTime.mjs index 8b39616d..82af1c32 100644 --- a/src/core/operations/ParseDateTime.mjs +++ b/src/core/operations/ParseDateTime.mjs @@ -22,6 +22,7 @@ class ParseDateTime extends Operation { this.name = "Parse DateTime"; this.module = "Default"; this.description = "Parses a DateTime string in your specified format and displays it in whichever timezone you choose with the following information:
    • Date
    • Time
    • Period (AM/PM)
    • Timezone
    • UTC offset
    • Daylight Saving Time
    • Leap year
    • Days in this month
    • Day of year
    • Week number
    • Quarter
    Run with no input to see format string examples if required."; + this.infoURL = "https://momentjs.com/docs/#/parsing/string-format/"; this.inputType = "string"; this.outputType = "html"; this.args = [ diff --git a/src/core/operations/ParseIPRange.mjs b/src/core/operations/ParseIPRange.mjs index 0063f320..5d50ec2d 100644 --- a/src/core/operations/ParseIPRange.mjs +++ b/src/core/operations/ParseIPRange.mjs @@ -1,12 +1,13 @@ /** * @author n1474335 [n1474335@gmail.com] + * @author Klaxon [klaxon@veyr.com] * @copyright Crown Copyright 2016 * @license Apache-2.0 */ import Operation from "../Operation"; import OperationError from "../errors/OperationError"; -import {ipv4CidrRange, ipv4HyphenatedRange, ipv6CidrRange, ipv6HyphenatedRange} from "../lib/IP"; +import {ipv4CidrRange, ipv4HyphenatedRange, ipv4ListedRange, ipv6CidrRange, ipv6HyphenatedRange, ipv6ListedRange} from "../lib/IP"; /** * Parse IP range operation @@ -21,7 +22,8 @@ class ParseIPRange extends Operation { this.name = "Parse IP range"; this.module = "JSBN"; - this.description = "Given a CIDR range (e.g. 10.0.0.0/24) or a hyphenated range (e.g. 10.0.0.0 - 10.0.1.0), this operation provides network information and enumerates all IP addresses in the range.

    IPv6 is supported but will not be enumerated."; + this.description = "Given a CIDR range (e.g. 10.0.0.0/24), hyphenated range (e.g. 10.0.0.0 - 10.0.1.0), or a list of IPs and/or CIDR ranges (separated by a new line), this operation provides network information and enumerates all IP addresses in the range.

    IPv6 is supported but will not be enumerated."; + this.infoURL = "https://wikipedia.org/wiki/Subnetwork"; this.inputType = "string"; this.outputType = "string"; this.args = [ @@ -58,18 +60,24 @@ class ParseIPRange extends Operation { // Check what type of input we are looking at const ipv4CidrRegex = /^\s*((?:\d{1,3}\.){3}\d{1,3})\/(\d\d?)\s*$/, ipv4RangeRegex = /^\s*((?:\d{1,3}\.){3}\d{1,3})\s*-\s*((?:\d{1,3}\.){3}\d{1,3})\s*$/, + ipv4ListRegex = /^\s*(((?:\d{1,3}\.){3}\d{1,3})(\/(\d\d?))?(\n|$)(\n*))+\s*$/, ipv6CidrRegex = /^\s*(((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\/(\d\d?\d?)\s*$/i, - ipv6RangeRegex = /^\s*(((?=.*::)(?!.*::[^-]+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*-\s*(((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\17)::|:\b|(?![\dA-F])))|(?!\16\17)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*$/i; + ipv6RangeRegex = /^\s*(((?=.*::)(?!.*::[^-]+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*-\s*(((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\17)::|:\b|(?![\dA-F])))|(?!\16\17)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*$/i, + ipv6ListRegex = /^\s*((((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))(\/(\d\d?\d?))?(\n|$)(\n*))+\s*$/i; let match; if ((match = ipv4CidrRegex.exec(input))) { return ipv4CidrRange(match, includeNetworkInfo, enumerateAddresses, allowLargeList); } else if ((match = ipv4RangeRegex.exec(input))) { return ipv4HyphenatedRange(match, includeNetworkInfo, enumerateAddresses, allowLargeList); + } else if ((match = ipv4ListRegex.exec(input))) { + return ipv4ListedRange(match, includeNetworkInfo, enumerateAddresses, allowLargeList); } else if ((match = ipv6CidrRegex.exec(input))) { return ipv6CidrRange(match, includeNetworkInfo); } else if ((match = ipv6RangeRegex.exec(input))) { return ipv6HyphenatedRange(match, includeNetworkInfo); + } else if ((match = ipv6ListRegex.exec(input))) { + return ipv6ListedRange(match, includeNetworkInfo); } else { throw new OperationError("Invalid input.\n\nEnter either a CIDR range (e.g. 10.0.0.0/24) or a hyphenated range (e.g. 10.0.0.0 - 10.0.1.0). IPv6 also supported."); } diff --git a/src/core/operations/ParseIPv4Header.mjs b/src/core/operations/ParseIPv4Header.mjs index cf5b31aa..d5efc24b 100644 --- a/src/core/operations/ParseIPv4Header.mjs +++ b/src/core/operations/ParseIPv4Header.mjs @@ -25,6 +25,7 @@ class ParseIPv4Header extends Operation { this.name = "Parse IPv4 header"; this.module = "JSBN"; this.description = "Given an IPv4 header, this operations parses and displays each field in an easily readable format."; + this.infoURL = "https://wikipedia.org/wiki/IPv4#Header"; this.inputType = "string"; this.outputType = "html"; this.args = [ diff --git a/src/core/operations/ParseIPv6Address.mjs b/src/core/operations/ParseIPv6Address.mjs index 26515fed..1603d47b 100644 --- a/src/core/operations/ParseIPv6Address.mjs +++ b/src/core/operations/ParseIPv6Address.mjs @@ -24,6 +24,7 @@ class ParseIPv6Address extends Operation { this.name = "Parse IPv6 address"; this.module = "JSBN"; this.description = "Displays the longhand and shorthand versions of a valid IPv6 address.

    Recognises all reserved ranges and parses encapsulated or tunnelled addresses including Teredo and 6to4."; + this.infoURL = "https://wikipedia.org/wiki/IPv6_address"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/ParseUNIXFilePermissions.mjs b/src/core/operations/ParseUNIXFilePermissions.mjs index a86ed9ce..8a0eac7a 100644 --- a/src/core/operations/ParseUNIXFilePermissions.mjs +++ b/src/core/operations/ParseUNIXFilePermissions.mjs @@ -21,6 +21,7 @@ class ParseUNIXFilePermissions extends Operation { this.name = "Parse UNIX file permissions"; this.module = "Default"; this.description = "Given a UNIX/Linux file permission string in octal or textual format, this operation explains which permissions are granted to which user groups.

    Input should be in either octal (e.g. 755) or textual (e.g. drwxr-xr-x) format."; + this.infoURL = "https://wikipedia.org/wiki/File_system_permissions#Traditional_Unix_permissions"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/ParseURI.mjs b/src/core/operations/ParseURI.mjs index a272ef53..d86cb061 100644 --- a/src/core/operations/ParseURI.mjs +++ b/src/core/operations/ParseURI.mjs @@ -21,6 +21,7 @@ class ParseURI extends Operation { this.name = "Parse URI"; this.module = "URL"; this.description = "Pretty prints complicated Uniform Resource Identifier (URI) strings for ease of reading. Particularly useful for Uniform Resource Locators (URLs) with a lot of arguments."; + this.infoURL = "https://wikipedia.org/wiki/Uniform_Resource_Identifier"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/ParseUserAgent.mjs b/src/core/operations/ParseUserAgent.mjs index c1dda3cf..03ccc86e 100644 --- a/src/core/operations/ParseUserAgent.mjs +++ b/src/core/operations/ParseUserAgent.mjs @@ -21,6 +21,7 @@ class ParseUserAgent extends Operation { this.name = "Parse User Agent"; this.module = "UserAgent"; this.description = "Attempts to identify and categorise information contained in a user-agent string."; + this.infoURL = "https://wikipedia.org/wiki/User_agent"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/ParseX509Certificate.mjs b/src/core/operations/ParseX509Certificate.mjs index 831738f3..8af7040e 100644 --- a/src/core/operations/ParseX509Certificate.mjs +++ b/src/core/operations/ParseX509Certificate.mjs @@ -25,6 +25,7 @@ class ParseX509Certificate extends Operation { this.name = "Parse X.509 certificate"; this.module = "PublicKey"; this.description = "X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.

    This operation displays the contents of a certificate in a human readable format, similar to the openssl command line tool.

    Tags: X509, server hello, handshake"; + this.infoURL = "https://wikipedia.org/wiki/X.509"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/PowerSet.mjs b/src/core/operations/PowerSet.mjs index f3d32392..6866c254 100644 --- a/src/core/operations/PowerSet.mjs +++ b/src/core/operations/PowerSet.mjs @@ -20,6 +20,7 @@ class PowerSet extends Operation { this.name = "Power Set"; this.module = "Default"; this.description = "Calculates all the subsets of a set."; + this.infoURL = "https://wikipedia.org/wiki/Power_set"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/PseudoRandomNumberGenerator.mjs b/src/core/operations/PseudoRandomNumberGenerator.mjs index 0b5e45be..6fdebefd 100644 --- a/src/core/operations/PseudoRandomNumberGenerator.mjs +++ b/src/core/operations/PseudoRandomNumberGenerator.mjs @@ -23,6 +23,7 @@ class PseudoRandomNumberGenerator extends Operation { this.name = "Pseudo-Random Number Generator"; this.module = "Ciphers"; this.description = "A cryptographically-secure pseudo-random number generator (PRNG).

    This operation uses the browser's built-in crypto.getRandomValues() method if available. If this cannot be found, it falls back to a Fortuna-based PRNG algorithm."; + this.infoURL = "https://wikipedia.org/wiki/Pseudorandom_number_generator"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/RC2Decrypt.mjs b/src/core/operations/RC2Decrypt.mjs index a8a8a75f..b0302cd7 100644 --- a/src/core/operations/RC2Decrypt.mjs +++ b/src/core/operations/RC2Decrypt.mjs @@ -22,6 +22,7 @@ class RC2Decrypt extends Operation { this.name = "RC2 Decrypt"; this.module = "Ciphers"; this.description = "RC2 (also known as ARC2) is a symmetric-key block cipher designed by Ron Rivest in 1987. 'RC' stands for 'Rivest Cipher'.

    Key: RC2 uses a variable size key.

    IV: To run the cipher in CBC mode, the Initialization Vector should be 8 bytes long. If the IV is left blank, the cipher will run in ECB mode.

    Padding: In both CBC and ECB mode, PKCS#7 padding will be used."; + this.infoURL = "https://wikipedia.org/wiki/RC2"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/RC2Encrypt.mjs b/src/core/operations/RC2Encrypt.mjs index bf6642e6..5c59c1ea 100644 --- a/src/core/operations/RC2Encrypt.mjs +++ b/src/core/operations/RC2Encrypt.mjs @@ -23,6 +23,7 @@ class RC2Encrypt extends Operation { this.name = "RC2 Encrypt"; this.module = "Ciphers"; this.description = "RC2 (also known as ARC2) is a symmetric-key block cipher designed by Ron Rivest in 1987. 'RC' stands for 'Rivest Cipher'.

    Key: RC2 uses a variable size key.

    You can generate a password-based key using one of the KDF operations.

    IV: To run the cipher in CBC mode, the Initialization Vector should be 8 bytes long. If the IV is left blank, the cipher will run in ECB mode.

    Padding: In both CBC and ECB mode, PKCS#7 padding will be used."; + this.infoURL = "https://wikipedia.org/wiki/RC2"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/RC4.mjs b/src/core/operations/RC4.mjs index 28968a0a..1446c972 100644 --- a/src/core/operations/RC4.mjs +++ b/src/core/operations/RC4.mjs @@ -22,6 +22,7 @@ class RC4 extends Operation { this.name = "RC4"; this.module = "Ciphers"; this.description = "RC4 (also known as ARC4) is a widely-used stream cipher designed by Ron Rivest. It is used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security."; + this.infoURL = "https://wikipedia.org/wiki/RC4"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/RC4Drop.mjs b/src/core/operations/RC4Drop.mjs index 05f8aca9..243d3a7a 100644 --- a/src/core/operations/RC4Drop.mjs +++ b/src/core/operations/RC4Drop.mjs @@ -22,6 +22,7 @@ class RC4Drop extends Operation { this.name = "RC4 Drop"; this.module = "Ciphers"; this.description = "It was discovered that the first few bytes of the RC4 keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-drop."; + this.infoURL = "https://wikipedia.org/wiki/RC4#Fluhrer,_Mantin_and_Shamir_attack"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/RIPEMD.mjs b/src/core/operations/RIPEMD.mjs index 07cfe4b4..fea7116e 100644 --- a/src/core/operations/RIPEMD.mjs +++ b/src/core/operations/RIPEMD.mjs @@ -21,6 +21,7 @@ class RIPEMD extends Operation { this.name = "RIPEMD"; this.module = "Hashing"; this.description = "RIPEMD (RACE Integrity Primitives Evaluation Message Digest) is a family of cryptographic hash functions developed in Leuven, Belgium, by Hans Dobbertin, Antoon Bosselaers and Bart Preneel at the COSIC research group at the Katholieke Universiteit Leuven, and first published in 1996.

    RIPEMD was based upon the design principles used in MD4, and is similar in performance to the more popular SHA-1.

    "; + this.infoURL = "https://wikipedia.org/wiki/RIPEMD"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ROT13.mjs b/src/core/operations/ROT13.mjs index d3e4e75a..f1dda5a8 100644 --- a/src/core/operations/ROT13.mjs +++ b/src/core/operations/ROT13.mjs @@ -21,6 +21,7 @@ class ROT13 extends Operation { this.name = "ROT13"; this.module = "Default"; this.description = "A simple caesar substitution cipher which rotates alphabet characters by the specified amount (default 13)."; + this.infoURL = "https://wikipedia.org/wiki/ROT13"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/ROT47.mjs b/src/core/operations/ROT47.mjs index e0722670..1219b349 100644 --- a/src/core/operations/ROT47.mjs +++ b/src/core/operations/ROT47.mjs @@ -21,6 +21,7 @@ class ROT47 extends Operation { this.name = "ROT47"; this.module = "Default"; this.description = "A slightly more complex variation of a caesar cipher, which includes ASCII characters from 33 '!' to 126 '~'. Default rotation: 47."; + this.infoURL = "https://wikipedia.org/wiki/ROT13#Variants"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/RawDeflate.mjs b/src/core/operations/RawDeflate.mjs index 55a922b0..c1d6dd53 100644 --- a/src/core/operations/RawDeflate.mjs +++ b/src/core/operations/RawDeflate.mjs @@ -30,6 +30,7 @@ class RawDeflate extends Operation { this.name = "Raw Deflate"; this.module = "Compression"; this.description = "Compresses data using the deflate algorithm with no headers."; + this.infoURL = "https://wikipedia.org/wiki/DEFLATE"; this.inputType = "ArrayBuffer"; this.outputType = "ArrayBuffer"; this.args = [ diff --git a/src/core/operations/RawInflate.mjs b/src/core/operations/RawInflate.mjs index f1a5341b..99066d79 100644 --- a/src/core/operations/RawInflate.mjs +++ b/src/core/operations/RawInflate.mjs @@ -30,6 +30,7 @@ class RawInflate extends Operation { this.name = "Raw Inflate"; this.module = "Compression"; this.description = "Decompresses data which has been compressed using the deflate algorithm with no headers."; + this.infoURL = "https://wikipedia.org/wiki/DEFLATE"; this.inputType = "ArrayBuffer"; this.outputType = "ArrayBuffer"; this.args = [ diff --git a/src/core/operations/Register.mjs b/src/core/operations/Register.mjs index b3a5397f..3b0d7479 100644 --- a/src/core/operations/Register.mjs +++ b/src/core/operations/Register.mjs @@ -6,6 +6,7 @@ import Operation from "../Operation"; import Dish from "../Dish"; +import XRegExp from "xregexp"; /** * Register operation @@ -20,8 +21,9 @@ class Register extends Operation { this.name = "Register"; this.flowControl = true; - this.module = "Default"; + this.module = "Regex"; this.description = "Extract data from the input and store it in registers which can then be passed into subsequent operations as arguments. Regular expression capture groups are used to select the data to extract.

    To use registers in arguments, refer to them using the notation $Rn where n is the register number, starting at 0.

    For example:
    Input: Test
    Extractor: (.*)
    Argument: $R0 becomes Test

    Registers can be escaped in arguments using a backslash. e.g. \\$R0 would become $R0 rather than Test."; + this.infoURL = "https://wikipedia.org/wiki/Regular_expression#Syntax"; this.inputType = "string"; this.outputType = "string"; this.args = [ @@ -39,6 +41,11 @@ class Register extends Operation { "name": "Multiline matching", "type": "boolean", "value": false + }, + { + "name": "Dot matches all", + "type": "boolean", + "value": false } ]; } @@ -52,13 +59,14 @@ class Register extends Operation { */ async run(state) { const ings = state.opList[state.progress].ingValues; - const [extractorStr, i, m] = ings; + const [extractorStr, i, m, s] = ings; let modifiers = ""; if (i) modifiers += "i"; if (m) modifiers += "m"; + if (s) modifiers += "s"; - const extractor = new RegExp(extractorStr, modifiers), + const extractor = new XRegExp(extractorStr, modifiers), input = await state.dish.get(Dish.STRING), registers = input.match(extractor); diff --git a/src/core/operations/RegularExpression.mjs b/src/core/operations/RegularExpression.mjs index 4f8b9813..152c276e 100644 --- a/src/core/operations/RegularExpression.mjs +++ b/src/core/operations/RegularExpression.mjs @@ -23,6 +23,7 @@ class RegularExpression extends Operation { this.name = "Regular expression"; this.module = "Regex"; this.description = "Define your own regular expression (regex) to search the input data with, optionally choosing from a list of pre-defined patterns.

    Supports extended regex syntax including the 'dot matches all' flag, named capture groups, full unicode coverage (including \\p{} categories and scripts as well as astral codes) and recursive matching."; + this.infoURL = "https://wikipedia.org/wiki/Regular_expression"; this.inputType = "string"; this.outputType = "html"; this.args = [ diff --git a/src/core/operations/RemoveEXIF.mjs b/src/core/operations/RemoveEXIF.mjs index f2c479b3..9c5cf49f 100644 --- a/src/core/operations/RemoveEXIF.mjs +++ b/src/core/operations/RemoveEXIF.mjs @@ -26,6 +26,7 @@ class RemoveEXIF extends Operation { "

    ", "EXIF data embedded in photos usually contains information about the image file itself as well as the device used to create it.", ].join("\n"); + this.infoURL = "https://wikipedia.org/wiki/Exif"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = []; diff --git a/src/core/operations/RotateLeft.mjs b/src/core/operations/RotateLeft.mjs index d21e0def..4f73345d 100644 --- a/src/core/operations/RotateLeft.mjs +++ b/src/core/operations/RotateLeft.mjs @@ -22,6 +22,7 @@ class RotateLeft extends Operation { this.name = "Rotate left"; this.module = "Default"; this.description = "Rotates each byte to the left by the number of bits specified, optionally carrying the excess bits over to the next byte. Currently only supports 8-bit values."; + this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#Bit_shifts"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/RotateRight.mjs b/src/core/operations/RotateRight.mjs index f4a35cb6..455369b0 100644 --- a/src/core/operations/RotateRight.mjs +++ b/src/core/operations/RotateRight.mjs @@ -22,6 +22,7 @@ class RotateRight extends Operation { this.name = "Rotate right"; this.module = "Default"; this.description = "Rotates each byte to the right by the number of bits specified, optionally carrying the excess bits over to the next byte. Currently only supports 8-bit values."; + this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#Bit_shifts"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ diff --git a/src/core/operations/SHA0.mjs b/src/core/operations/SHA0.mjs index 292c63ce..6982d67c 100644 --- a/src/core/operations/SHA0.mjs +++ b/src/core/operations/SHA0.mjs @@ -21,6 +21,7 @@ class SHA0 extends Operation { this.name = "SHA0"; this.module = "Hashing"; this.description = "SHA-0 is a retronym applied to the original version of the 160-bit hash function published in 1993 under the name 'SHA'. It was withdrawn shortly after publication due to an undisclosed 'significant flaw' and replaced by the slightly revised version SHA-1."; + this.infoURL = "https://wikipedia.org/wiki/SHA-1#SHA-0"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/SHA1.mjs b/src/core/operations/SHA1.mjs index 904c55f0..8f16111c 100644 --- a/src/core/operations/SHA1.mjs +++ b/src/core/operations/SHA1.mjs @@ -21,6 +21,7 @@ class SHA1 extends Operation { this.name = "SHA1"; this.module = "Hashing"; this.description = "The SHA (Secure Hash Algorithm) hash functions were designed by the NSA. SHA-1 is the most established of the existing SHA hash functions and it is used in a variety of security applications and protocols.

    However, SHA-1's collision resistance has been weakening as new attacks are discovered or improved."; + this.infoURL = "https://wikipedia.org/wiki/SHA-1"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/SHA2.mjs b/src/core/operations/SHA2.mjs index c5480727..4b6b379f 100644 --- a/src/core/operations/SHA2.mjs +++ b/src/core/operations/SHA2.mjs @@ -21,6 +21,7 @@ class SHA2 extends Operation { this.name = "SHA2"; this.module = "Hashing"; this.description = "The SHA-2 (Secure Hash Algorithm 2) hash functions were designed by the NSA. SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA224, SHA256, SHA384, SHA512.

    • SHA-512 operates on 64-bit words.
    • SHA-256 operates on 32-bit words.
    • SHA-384 is largely identical to SHA-512 but is truncated to 384 bytes.
    • SHA-224 is largely identical to SHA-256 but is truncated to 224 bytes.
    • SHA-512/224 and SHA-512/256 are truncated versions of SHA-512, but the initial values are generated using the method described in Federal Information Processing Standards (FIPS) PUB 180-4.
    "; + this.infoURL = "https://wikipedia.org/wiki/SHA-2"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/SHA3.mjs b/src/core/operations/SHA3.mjs index 9e6b2828..061810a0 100644 --- a/src/core/operations/SHA3.mjs +++ b/src/core/operations/SHA3.mjs @@ -22,6 +22,7 @@ class SHA3 extends Operation { this.name = "SHA3"; this.module = "Hashing"; this.description = "The SHA-3 (Secure Hash Algorithm 3) hash functions were released by NIST on August 5, 2015. Although part of the same series of standards, SHA-3 is internally quite different from the MD5-like structure of SHA-1 and SHA-2.

    SHA-3 is a subset of the broader cryptographic primitive family Keccak designed by Guido Bertoni, Joan Daemen, Micha\xebl Peeters, and Gilles Van Assche, building upon RadioGat\xfan."; + this.infoURL = "https://wikipedia.org/wiki/SHA-3"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/SSDEEP.mjs b/src/core/operations/SSDEEP.mjs index 02d23eba..faf3ec3e 100644 --- a/src/core/operations/SSDEEP.mjs +++ b/src/core/operations/SSDEEP.mjs @@ -21,6 +21,7 @@ class SSDEEP extends Operation { this.name = "SSDEEP"; this.module = "Hashing"; this.description = "SSDEEP is a program for computing context triggered piecewise hashes (CTPH). Also called fuzzy hashes, CTPH can match inputs that have homologies. Such inputs have sequences of identical bytes in the same order, although bytes in between these sequences may be different in both content and length.

    SSDEEP hashes are now widely used for simple identification purposes (e.g. the 'Basic Properties' section in VirusTotal). Although 'better' fuzzy hashes are available, SSDEEP is still one of the primary choices because of its speed and being a de facto standard.

    This operation is fundamentally the same as the CTPH operation, however their outputs differ in format."; + this.infoURL = "https://forensicswiki.org/wiki/Ssdeep"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/SUB.mjs b/src/core/operations/SUB.mjs index 79ce95d0..c3134aad 100644 --- a/src/core/operations/SUB.mjs +++ b/src/core/operations/SUB.mjs @@ -22,6 +22,7 @@ class SUB extends Operation { this.name = "SUB"; this.module = "Default"; this.description = "SUB the input with the given key (e.g. fe023da5), MOD 255"; + this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#Bitwise_operators"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ @@ -29,7 +30,7 @@ class SUB extends Operation { "name": "Key", "type": "toggleString", "value": "", - "toggleValues": ["Hex", "Base64", "UTF8", "Latin1"] + "toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"] } ]; } diff --git a/src/core/operations/ScanForEmbeddedFiles.mjs b/src/core/operations/ScanForEmbeddedFiles.mjs index abbe7c09..a38c477f 100644 --- a/src/core/operations/ScanForEmbeddedFiles.mjs +++ b/src/core/operations/ScanForEmbeddedFiles.mjs @@ -22,6 +22,7 @@ class ScanForEmbeddedFiles extends Operation { this.name = "Scan for Embedded Files"; this.module = "Default"; this.description = "Scans the data for potential embedded files by looking for magic bytes at all offsets. This operation is prone to false positives.

    WARNING: Files over about 100KB in size will take a VERY long time to process."; + this.infoURL = "https://wikipedia.org/wiki/List_of_file_signatures"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/Scrypt.mjs b/src/core/operations/Scrypt.mjs index c7624e3c..029a1beb 100644 --- a/src/core/operations/Scrypt.mjs +++ b/src/core/operations/Scrypt.mjs @@ -23,6 +23,7 @@ class Scrypt extends Operation { this.name = "Scrypt"; this.module = "Hashing"; this.description = "scrypt is a password-based key derivation function (PBKDF) created by Colin Percival. The algorithm was specifically designed to make it costly to perform large-scale custom hardware attacks by requiring large amounts of memory. In 2016, the scrypt algorithm was published by IETF as RFC 7914.

    Enter the password in the input to generate its hash."; + this.infoURL = "https://wikipedia.org/wiki/Scrypt"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/SetDifference.mjs b/src/core/operations/SetDifference.mjs index 0962fda2..ce272880 100644 --- a/src/core/operations/SetDifference.mjs +++ b/src/core/operations/SetDifference.mjs @@ -20,7 +20,8 @@ class SetDifference extends Operation { this.name = "Set Difference"; this.module = "Default"; - this.description = "Calculates the difference of two sets."; + this.description = "Calculates the difference, or relative complement, of two sets."; + this.infoURL = "https://wikipedia.org/wiki/Complement_(set_theory)#Relative_complement"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/SetIntersection.mjs b/src/core/operations/SetIntersection.mjs index 4ede1f98..87cb2b3c 100644 --- a/src/core/operations/SetIntersection.mjs +++ b/src/core/operations/SetIntersection.mjs @@ -21,6 +21,7 @@ class SetIntersection extends Operation { this.name = "Set Intersection"; this.module = "Default"; this.description = "Calculates the intersection of two sets."; + this.infoURL = "https://wikipedia.org/wiki/Intersection_(set_theory)"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/SetUnion.mjs b/src/core/operations/SetUnion.mjs index 6975ffb5..b835605e 100644 --- a/src/core/operations/SetUnion.mjs +++ b/src/core/operations/SetUnion.mjs @@ -21,6 +21,7 @@ class SetUnion extends Operation { this.name = "Set Union"; this.module = "Default"; this.description = "Calculates the union of two sets."; + this.infoURL = "https://wikipedia.org/wiki/Union_(set_theory)"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/Shake.mjs b/src/core/operations/Shake.mjs index 06914211..21d993b2 100644 --- a/src/core/operations/Shake.mjs +++ b/src/core/operations/Shake.mjs @@ -22,6 +22,7 @@ class Shake extends Operation { this.name = "Shake"; this.module = "Hashing"; this.description = "Shake is an Extendable Output Function (XOF) of the SHA-3 hash algorithm, part of the Keccak family, allowing for variable output length/size."; + this.infoURL = "https://wikipedia.org/wiki/SHA-3#Instances"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ShowBase64Offsets.mjs b/src/core/operations/ShowBase64Offsets.mjs index 43bcbbba..d028400d 100644 --- a/src/core/operations/ShowBase64Offsets.mjs +++ b/src/core/operations/ShowBase64Offsets.mjs @@ -23,6 +23,7 @@ class ShowBase64Offsets extends Operation { this.name = "Show Base64 offsets"; this.module = "Default"; this.description = "When a string is within a block of data and the whole block is Base64'd, the string itself could be represented in Base64 in three distinct ways depending on its offset within the block.

    This operation shows all possible offsets for a given string so that each possible encoding can be considered."; + this.infoURL = "https://wikipedia.org/wiki/Base64#Output_padding"; this.inputType = "byteArray"; this.outputType = "html"; this.args = [ @@ -35,6 +36,11 @@ class ShowBase64Offsets extends Operation { name: "Show variable chars and padding", type: "boolean", value: true + }, + { + name: "Input format", + type: "option", + value: ["Raw", "Base64"] } ]; } @@ -45,7 +51,11 @@ class ShowBase64Offsets extends Operation { * @returns {html} */ run(input, args) { - const [alphabet, showVariable] = args; + const [alphabet, showVariable, format] = args; + + if (format === "Base64") { + input = fromBase64(Utils.byteArrayToUtf8(input), null, "byteArray"); + } let offset0 = toBase64(input, alphabet), offset1 = toBase64([0].concat(input), alphabet), diff --git a/src/core/operations/Snefru.mjs b/src/core/operations/Snefru.mjs index 7f1bbda7..fe6f2cf4 100644 --- a/src/core/operations/Snefru.mjs +++ b/src/core/operations/Snefru.mjs @@ -21,6 +21,7 @@ class Snefru extends Operation { this.name = "Snefru"; this.module = "Hashing"; this.description = "Snefru is a cryptographic hash function invented by Ralph Merkle in 1990 while working at Xerox PARC. The function supports 128-bit and 256-bit output. It was named after the Egyptian Pharaoh Sneferu, continuing the tradition of the Khufu and Khafre block ciphers.

    The original design of Snefru was shown to be insecure by Eli Biham and Adi Shamir who were able to use differential cryptanalysis to find hash collisions. The design was then modified by increasing the number of iterations of the main pass of the algorithm from two to eight."; + this.infoURL = "https://wikipedia.org/wiki/Snefru"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/StandardDeviation.mjs b/src/core/operations/StandardDeviation.mjs index d2da24f8..8aeecd55 100644 --- a/src/core/operations/StandardDeviation.mjs +++ b/src/core/operations/StandardDeviation.mjs @@ -25,6 +25,7 @@ class StandardDeviation extends Operation { this.name = "Standard Deviation"; this.module = "Default"; this.description = "Computes the standard deviation of a number list. If an item in the string is not a number it is excluded from the list.

    e.g. 0x0a 8 .5 becomes 4.089281382128433"; + this.infoURL = "https://wikipedia.org/wiki/Standard_deviation"; this.inputType = "string"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/Strings.mjs b/src/core/operations/Strings.mjs index d3f110f9..11ffd3af 100644 --- a/src/core/operations/Strings.mjs +++ b/src/core/operations/Strings.mjs @@ -22,6 +22,7 @@ class Strings extends Operation { this.name = "Strings"; this.module = "Regex"; this.description = "Extracts all strings from the input."; + this.infoURL = "https://wikipedia.org/wiki/Strings_(Unix)"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/StripHTTPHeaders.mjs b/src/core/operations/StripHTTPHeaders.mjs index a46e675c..0473c2dd 100644 --- a/src/core/operations/StripHTTPHeaders.mjs +++ b/src/core/operations/StripHTTPHeaders.mjs @@ -20,6 +20,7 @@ class StripHTTPHeaders extends Operation { this.name = "Strip HTTP headers"; this.module = "Default"; this.description = "Removes HTTP headers from a request or response by looking for the first instance of a double newline."; + this.infoURL = "https://wikipedia.org/wiki/Hypertext_Transfer_Protocol#Message_format"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/Substitute.mjs b/src/core/operations/Substitute.mjs index c2d114a2..5dea901a 100644 --- a/src/core/operations/Substitute.mjs +++ b/src/core/operations/Substitute.mjs @@ -19,8 +19,9 @@ class Substitute extends Operation { super(); this.name = "Substitute"; - this.module = "Ciphers"; + this.module = "Default"; this.description = "A substitution cipher allowing you to specify bytes to replace with other byte values. This can be used to create Caesar ciphers but is more powerful as any byte value can be substituted, not just letters, and the substitution values need not be in order.

    Enter the bytes you want to replace in the Plaintext field and the bytes to replace them with in the Ciphertext field.

    Non-printable bytes can be specified using string escape notation. For example, a line feed character can be written as either \n or \x0a.

    Byte ranges can be specified using a hyphen. For example, the sequence 0123456789 can be written as 0-9."; + this.infoURL = "https://wikipedia.org/wiki/Substitution_cipher"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/Subtract.mjs b/src/core/operations/Subtract.mjs index ac00156c..df8b1d03 100644 --- a/src/core/operations/Subtract.mjs +++ b/src/core/operations/Subtract.mjs @@ -25,6 +25,7 @@ class Subtract extends Operation { this.name = "Subtract"; this.module = "Default"; this.description = "Subtracts a list of numbers. If an item in the string is not a number it is excluded from the list.

    e.g. 0x0a 8 .5 becomes 1.5"; + this.infoURL = "https://wikipedia.org/wiki/Subtraction"; this.inputType = "string"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/Sum.mjs b/src/core/operations/Sum.mjs index 97214cda..ac667cf9 100644 --- a/src/core/operations/Sum.mjs +++ b/src/core/operations/Sum.mjs @@ -25,6 +25,7 @@ class Sum extends Operation { this.name = "Sum"; this.module = "Default"; this.description = "Adds together a list of numbers. If an item in the string is not a number it is excluded from the list.

    e.g. 0x0a 8 .5 becomes 18.5"; + this.infoURL = "https://wikipedia.org/wiki/Summation"; this.inputType = "string"; this.outputType = "BigNumber"; this.args = [ diff --git a/src/core/operations/SwapEndianness.mjs b/src/core/operations/SwapEndianness.mjs index 21cd4e9c..02958414 100644 --- a/src/core/operations/SwapEndianness.mjs +++ b/src/core/operations/SwapEndianness.mjs @@ -23,6 +23,7 @@ class SwapEndianness extends Operation { this.name = "Swap endianness"; this.module = "Default"; this.description = "Switches the data from big-endian to little-endian or vice-versa. Data can be read in as hexadecimal or raw bytes. It will be returned in the same format as it is entered."; + this.infoURL = "https://wikipedia.org/wiki/Endianness"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/SymmetricDifference.mjs b/src/core/operations/SymmetricDifference.mjs index 071a49d4..249f8086 100644 --- a/src/core/operations/SymmetricDifference.mjs +++ b/src/core/operations/SymmetricDifference.mjs @@ -22,6 +22,7 @@ class SymmetricDifference extends Operation { this.name = "Symmetric Difference"; this.module = "Default"; this.description = "Calculates the symmetric difference of two sets."; + this.infoURL = "https://wikipedia.org/wiki/Symmetric_difference"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/SyntaxHighlighter.mjs b/src/core/operations/SyntaxHighlighter.mjs index bde6fbde..a3f2d273 100644 --- a/src/core/operations/SyntaxHighlighter.mjs +++ b/src/core/operations/SyntaxHighlighter.mjs @@ -21,6 +21,7 @@ class SyntaxHighlighter extends Operation { this.name = "Syntax highlighter"; this.module = "Code"; this.description = "Adds syntax highlighting to a range of source code languages. Note that this will not indent the code. Use one of the 'Beautify' operations for that."; + this.infoURL = "https://wikipedia.org/wiki/Syntax_highlighting"; this.inputType = "string"; this.outputType = "html"; this.args = [ diff --git a/src/core/operations/TCPIPChecksum.mjs b/src/core/operations/TCPIPChecksum.mjs index 6eac366d..705d7480 100644 --- a/src/core/operations/TCPIPChecksum.mjs +++ b/src/core/operations/TCPIPChecksum.mjs @@ -21,6 +21,7 @@ class TCPIPChecksum extends Operation { this.name = "TCP/IP Checksum"; this.module = "Hashing"; this.description = "Calculates the checksum for a TCP (Transport Control Protocol) or IP (Internet Protocol) header from an input of raw bytes."; + this.infoURL = "https://wikipedia.org/wiki/IPv4_header_checksum"; this.inputType = "byteArray"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/Tail.mjs b/src/core/operations/Tail.mjs index c9e0d726..adbbbecc 100644 --- a/src/core/operations/Tail.mjs +++ b/src/core/operations/Tail.mjs @@ -22,6 +22,7 @@ class Tail extends Operation { this.name = "Tail"; this.module = "Default"; this.description = "Like the UNIX tail utility.
    Gets the last n lines.
    Optionally you can select all lines after line n by entering a negative value for n.
    The delimiter can be changed so that instead of lines, fields (i.e. commas) are selected instead."; + this.infoURL = "https://wikipedia.org/wiki/Tail_(Unix)"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/TakeBytes.mjs b/src/core/operations/TakeBytes.mjs index 5806ee87..4bf6d951 100644 --- a/src/core/operations/TakeBytes.mjs +++ b/src/core/operations/TakeBytes.mjs @@ -5,7 +5,6 @@ */ import Operation from "../Operation"; -import OperationError from "../errors/OperationError"; /** * Take bytes operation @@ -20,7 +19,7 @@ class TakeBytes extends Operation { this.name = "Take bytes"; this.module = "Default"; - this.description = "Takes a slice of the specified number of bytes from the data."; + this.description = "Takes a slice of the specified number of bytes from the data. Negative values are allowed."; this.inputType = "ArrayBuffer"; this.outputType = "ArrayBuffer"; this.args = [ @@ -50,15 +49,27 @@ class TakeBytes extends Operation { * @throws {OperationError} if invalid value */ run(input, args) { - const start = args[0], - length = args[1], - applyToEachLine = args[2]; + let start = args[0], + length = args[1]; + const applyToEachLine = args[2]; - if (start < 0 || length < 0) - throw new OperationError("Error: Invalid value"); + if (!applyToEachLine) { + if (start < 0) { // Take from the end + start = input.byteLength + start; + } + + if (length < 0) { // Flip start point + start = start + length; + if (start < 0) { + start = input.byteLength + start; + length = start - length; + } else { + length = -length; + } + } - if (!applyToEachLine) return input.slice(start, start+length); + } // Split input into lines const data = new Uint8Array(input); @@ -77,9 +88,26 @@ class TakeBytes extends Operation { lines.push(line); let output = []; + let s = start, + l = length; for (i = 0; i < lines.length; i++) { - output = output.concat(lines[i].slice(start, start+length)); + if (s < 0) { // Take from the end + s = lines[i].length + s; + } + + if (l < 0) { // Flip start point + s = s + l; + if (s < 0) { + s = lines[i].length + s; + l = s - l; + } else { + l = -l; + } + } + output = output.concat(lines[i].slice(s, s+l)); output.push(0x0a); + s = start; + l = length; } return new Uint8Array(output.slice(0, output.length-1)).buffer; } diff --git a/src/core/operations/Tar.mjs b/src/core/operations/Tar.mjs index a2e8eb70..84674bff 100644 --- a/src/core/operations/Tar.mjs +++ b/src/core/operations/Tar.mjs @@ -21,6 +21,7 @@ class Tar extends Operation { this.name = "Tar"; this.module = "Compression"; this.description = "Packs the input into a tarball.

    No support for multiple files at this time."; + this.infoURL = "https://wikipedia.org/wiki/Tar_(computing)"; this.inputType = "byteArray"; this.outputType = "File"; this.args = [ diff --git a/src/core/operations/ToBCD.mjs b/src/core/operations/ToBCD.mjs index 43de14b6..c8fd0c89 100644 --- a/src/core/operations/ToBCD.mjs +++ b/src/core/operations/ToBCD.mjs @@ -24,6 +24,7 @@ class ToBCD extends Operation { this.name = "To BCD"; this.module = "Default"; this.description = "Binary-Coded Decimal (BCD) is a class of binary encodings of decimal numbers where each decimal digit is represented by a fixed number of bits, usually four or eight. Special bit patterns are sometimes used for a sign"; + this.infoURL = "https://wikipedia.org/wiki/Binary-coded_decimal"; this.inputType = "BigNumber"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToBase.mjs b/src/core/operations/ToBase.mjs index e37431e2..93107903 100644 --- a/src/core/operations/ToBase.mjs +++ b/src/core/operations/ToBase.mjs @@ -21,6 +21,7 @@ class ToBase extends Operation { this.name = "To Base"; this.module = "Default"; this.description = "Converts a decimal number to a given numerical base."; + this.infoURL = "https://wikipedia.org/wiki/Radix"; this.inputType = "BigNumber"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToBase32.mjs b/src/core/operations/ToBase32.mjs index 632d93e4..fd7170e9 100644 --- a/src/core/operations/ToBase32.mjs +++ b/src/core/operations/ToBase32.mjs @@ -21,6 +21,7 @@ class ToBase32 extends Operation { this.name = "To Base32"; this.module = "Default"; this.description = "Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7."; + this.infoURL = "https://wikipedia.org/wiki/Base32"; this.inputType = "byteArray"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToBase58.mjs b/src/core/operations/ToBase58.mjs index 47e0096f..ac3d7267 100644 --- a/src/core/operations/ToBase58.mjs +++ b/src/core/operations/ToBase58.mjs @@ -23,6 +23,7 @@ class ToBase58 extends Operation { this.name = "To Base58"; this.module = "Default"; this.description = "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It differs from Base64 by removing easily misread characters (i.e. l, I, 0 and O) to improve human readability.

    This operation encodes data in an ASCII string (with an alphabet of your choosing, presets included).

    e.g. hello world becomes StV1DL6CwTryKyV

    Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc)."; + this.infoURL = "https://wikipedia.org/wiki/Base58"; this.inputType = "byteArray"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToBase64.mjs b/src/core/operations/ToBase64.mjs index 967ce8ed..f9aa569b 100644 --- a/src/core/operations/ToBase64.mjs +++ b/src/core/operations/ToBase64.mjs @@ -21,6 +21,7 @@ class ToBase64 extends Operation { this.name = "To Base64"; this.module = "Default"; this.description = "Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

    This operation decodes data from an ASCII Base64 string back into its raw format.

    e.g. aGVsbG8= becomes hello"; + this.infoURL = "https://wikipedia.org/wiki/Base64"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToBase85.mjs b/src/core/operations/ToBase85.mjs new file mode 100644 index 00000000..97cc2e72 --- /dev/null +++ b/src/core/operations/ToBase85.mjs @@ -0,0 +1,93 @@ +/** + * @author PenguinGeorge [george@penguingeorge.com] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import OperationError from "../errors/OperationError"; +import Utils from "../Utils"; +import {alphabetName, ALPHABET_OPTIONS} from "../lib/Base85"; + +/** + * To Base85 operation + */ +class ToBase85 extends Operation { + + /** + * To Base85 constructor + */ + constructor() { + super(); + + this.name = "To Base85"; + this.module = "Default"; + this.description = "Base85 (also called Ascii85) is a notation for encoding arbitrary byte data. It is usually more efficient that Base64.

    This operation encodes data in an ASCII string (with an alphabet of your choosing, presets included).

    e.g. hello world becomes BOu!rD]j7BEbo7

    Base85 is commonly used in Adobe's PostScript and PDF file formats.

    Options
    Alphabet
    • Standard - The standard alphabet, referred to as Ascii85
    • Z85 (ZeroMQ) - A string-safe variant of Base85, which avoids quote marks and backslash characters
    • IPv6 - A variant of Base85 suitable for encoding IPv6 addresses (RFC 1924)
    Include delimiter
    Adds a '<~' and '~>' delimiter to the start and end of the data. This is standard for Adobe's implementation of Base85."; + this.infoURL = "https://wikipedia.org/wiki/Ascii85"; + this.inputType = "byteArray"; + this.outputType = "string"; + this.args = [ + { + name: "Alphabet", + type: "editableOption", + value: ALPHABET_OPTIONS + }, + { + name: "Include delimeter", + type: "boolean", + value: false + } + ]; + } + + /** + * @param {byteArray} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + const alphabet = Utils.expandAlphRange(args[0]).join(""), + encoding = alphabetName(alphabet), + includeDelim = args[1]; + let result = ""; + + if (alphabet.length !== 85 || + [].unique.call(alphabet).length !== 85) { + throw new OperationError("Error: Alphabet must be of length 85"); + } + + if (input.length === 0) return ""; + + let block; + for (let i = 0; i < input.length; i += 4) { + block = ( + ((input[i]) << 24) + + ((input[i + 1] || 0) << 16) + + ((input[i + 2] || 0) << 8) + + ((input[i + 3] || 0)) + ) >>> 0; + + if (encoding !== "Standard" || block > 0) { + let digits = []; + for (let j = 0; j < 5; j++) { + digits.push(block % 85); + block = Math.floor(block / 85); + } + + digits = digits.reverse(); + + if (input.length < i + 4) { + digits.splice(input.length - (i + 4), 4); + } + + result += digits.map(digit => alphabet[digit]).join(""); + } else { + result += (encoding === "Standard") ? "z" : null; + } + } + + return includeDelim ? `<~${result}~>` : result; + } +} + +export default ToBase85; diff --git a/src/core/operations/ToBinary.mjs b/src/core/operations/ToBinary.mjs index f10f66a7..1ef86ebb 100644 --- a/src/core/operations/ToBinary.mjs +++ b/src/core/operations/ToBinary.mjs @@ -22,6 +22,7 @@ class ToBinary extends Operation { this.name = "To Binary"; this.module = "Default"; this.description = "Displays the input data as a binary string.

    e.g. Hi becomes 01001000 01101001"; + this.infoURL = "https://wikipedia.org/wiki/Binary_code"; this.inputType = "byteArray"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToBraille.mjs b/src/core/operations/ToBraille.mjs new file mode 100644 index 00000000..9530f9d3 --- /dev/null +++ b/src/core/operations/ToBraille.mjs @@ -0,0 +1,70 @@ +/** + * @author n1474335 [n1474335@gmail.com] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import {BRAILLE_LOOKUP} from "../lib/Braille"; + +/** + * To Braille operation + */ +class ToBraille extends Operation { + + /** + * ToBraille constructor + */ + constructor() { + super(); + + this.name = "To Braille"; + this.module = "Default"; + this.description = "Converts text to six-dot braille symbols."; + this.infoURL = "https://wikipedia.org/wiki/Braille"; + this.inputType = "string"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + return input.split("").map(c => { + const idx = BRAILLE_LOOKUP.ascii.indexOf(c.toUpperCase()); + return idx < 0 ? c : BRAILLE_LOOKUP.dot6[idx]; + }).join(""); + } + + /** + * Highlight To Braille + * + * @param {Object[]} pos + * @param {number} pos[].start + * @param {number} pos[].end + * @param {Object[]} args + * @returns {Object[]} pos + */ + highlight(pos, args) { + return pos; + } + + /** + * Highlight To Braille in reverse + * + * @param {Object[]} pos + * @param {number} pos[].start + * @param {number} pos[].end + * @param {Object[]} args + * @returns {Object[]} pos + */ + highlightReverse(pos, args) { + return pos; + } + +} + +export default ToBraille; diff --git a/src/core/operations/ToCamelCase.mjs b/src/core/operations/ToCamelCase.mjs index cc42949c..3553810e 100644 --- a/src/core/operations/ToCamelCase.mjs +++ b/src/core/operations/ToCamelCase.mjs @@ -22,6 +22,7 @@ class ToCamelCase extends Operation { this.name = "To Camel case"; this.module = "Code"; this.description = "Converts the input string to camel case.\n

    \nCamel case is all lower case except letters after word boundaries which are uppercase.\n

    \ne.g. thisIsCamelCase\n

    \n'Attempt to be context aware' will make the operation attempt to nicely transform variable and function names."; + this.infoURL = "https://wikipedia.org/wiki/Camel_case"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToCharcode.mjs b/src/core/operations/ToCharcode.mjs index db043d79..11006685 100644 --- a/src/core/operations/ToCharcode.mjs +++ b/src/core/operations/ToCharcode.mjs @@ -23,6 +23,7 @@ class ToCharcode extends Operation { this.name = "To Charcode"; this.module = "Default"; this.description = "Converts text to its unicode character code equivalent.

    e.g. Γειά σου becomes 0393 03b5 03b9 03ac 20 03c3 03bf 03c5"; + this.infoURL = "https://wikipedia.org/wiki/Plane_(Unicode)"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToGeohash.mjs b/src/core/operations/ToGeohash.mjs new file mode 100644 index 00000000..0e7f53ac --- /dev/null +++ b/src/core/operations/ToGeohash.mjs @@ -0,0 +1,53 @@ +/** + * @author gchq77703 [] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import geohash from "ngeohash"; + +/** + * To Geohash operation + */ +class ToGeohash extends Operation { + + /** + * ToGeohash constructor + */ + constructor() { + super(); + + this.name = "To Geohash"; + this.module = "Hashing"; + this.description = "Converts Lat/Long coordinates into a Geohash string. For example, 37.8324,112.5584 becomes ww8p1r4t8."; + this.infoURL = "https://wikipedia.org/wiki/Geohash"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + name: "Precision", + type: "number", + value: 9 + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + const [precision] = args; + + return input.split("\n").map(line => { + line = line.replace(/ /g, ""); + if (line === "") return ""; + return geohash.encode(...line.split(",").map(num => parseFloat(num)), precision); + }).join("\n"); + } + +} + +export default ToGeohash; diff --git a/src/core/operations/ToHTMLEntity.mjs b/src/core/operations/ToHTMLEntity.mjs index 06b5ff25..53ec4e34 100644 --- a/src/core/operations/ToHTMLEntity.mjs +++ b/src/core/operations/ToHTMLEntity.mjs @@ -21,6 +21,7 @@ class ToHTMLEntity extends Operation { this.name = "To HTML Entity"; this.module = "Default"; this.description = "Converts characters to HTML entities

    e.g. & becomes &amp;"; + this.infoURL = "https://wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToHex.mjs b/src/core/operations/ToHex.mjs index 9b1ccade..a7035d4f 100644 --- a/src/core/operations/ToHex.mjs +++ b/src/core/operations/ToHex.mjs @@ -22,6 +22,7 @@ class ToHex extends Operation { this.name = "To Hex"; this.module = "Default"; this.description = "Converts the input string to hexadecimal bytes separated by the specified delimiter.

    e.g. The UTF-8 encoded string Γειά σου becomes ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a"; + this.infoURL = "https://wikipedia.org/wiki/Hexadecimal"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToHexContent.mjs b/src/core/operations/ToHexContent.mjs index af9ae22c..653c2224 100644 --- a/src/core/operations/ToHexContent.mjs +++ b/src/core/operations/ToHexContent.mjs @@ -21,7 +21,8 @@ class ToHexContent extends Operation { this.name = "To Hex Content"; this.module = "Default"; - this.description = "Converts special characters in a string to hexadecimal.

    e.g. foo=bar becomes foo|3d|bar."; + this.description = "Converts special characters in a string to hexadecimal. This format is used by SNORT for representing hex within ASCII text.

    e.g. foo=bar becomes foo|3d|bar."; + this.infoURL = "http://manual-snort-org.s3-website-us-east-1.amazonaws.com/node32.html#SECTION00451000000000000000"; this.inputType = "byteArray"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToHexdump.mjs b/src/core/operations/ToHexdump.mjs index 89ebdc33..0fbec5ce 100644 --- a/src/core/operations/ToHexdump.mjs +++ b/src/core/operations/ToHexdump.mjs @@ -21,6 +21,7 @@ class ToHexdump extends Operation { this.name = "To Hexdump"; this.module = "Default"; this.description = "Creates a hexdump of the input data, displaying both the hexadecimal values of each byte and an ASCII representation alongside."; + this.infoURL = "https://wikipedia.org/wiki/Hex_dump"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToKebabCase.mjs b/src/core/operations/ToKebabCase.mjs index c293ede8..b7a15497 100644 --- a/src/core/operations/ToKebabCase.mjs +++ b/src/core/operations/ToKebabCase.mjs @@ -22,6 +22,7 @@ class ToKebabCase extends Operation { this.name = "To Kebab case"; this.module = "Code"; this.description = "Converts the input string to kebab case.\n

    \nKebab case is all lower case with dashes as word boundaries.\n

    \ne.g. this-is-kebab-case\n

    \n'Attempt to be context aware' will make the operation attempt to nicely transform variable and function names."; + this.infoURL = "https://wikipedia.org/wiki/Kebab_case"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToMessagePack.mjs b/src/core/operations/ToMessagePack.mjs new file mode 100644 index 00000000..40e31a41 --- /dev/null +++ b/src/core/operations/ToMessagePack.mjs @@ -0,0 +1,50 @@ +/** + * @author Matt C [matt@artemisbot.uk] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import OperationError from "../errors/OperationError.mjs"; +import notepack from "notepack.io"; + +/** + * To MessagePack operation + */ +class ToMessagePack extends Operation { + + /** + * ToMessagePack constructor + */ + constructor() { + super(); + + this.name = "To MessagePack"; + this.module = "Code"; + this.description = "Converts JSON to MessagePack encoded byte buffer. MessagePack is a computer data interchange format. It is a binary form for representing simple data structures like arrays and associative arrays."; + this.infoURL = "https://wikipedia.org/wiki/MessagePack"; + this.inputType = "JSON"; + this.outputType = "ArrayBuffer"; + this.args = []; + } + + /** + * @param {JSON} input + * @param {Object[]} args + * @returns {ArrayBuffer} + */ + run(input, args) { + try { + if (ENVIRONMENT_IS_WORKER()) { + return notepack.encode(input); + } else { + return notepack.encode(input).buffer; + } + } catch (err) { + throw new OperationError(`Could not encode JSON to MessagePack: ${err}`); + } + } + +} + +export default ToMessagePack; diff --git a/src/core/operations/ToMorseCode.mjs b/src/core/operations/ToMorseCode.mjs index 3146a114..4770500b 100644 --- a/src/core/operations/ToMorseCode.mjs +++ b/src/core/operations/ToMorseCode.mjs @@ -22,6 +22,7 @@ class ToMorseCode extends Operation { this.name = "To Morse Code"; this.module = "Default"; this.description = "Translates alphanumeric characters into International Morse Code.

    Ignores non-Morse characters.

    e.g. SOS becomes ... --- ..."; + this.infoURL = "https://wikipedia.org/wiki/Morse_code"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToOctal.mjs b/src/core/operations/ToOctal.mjs index 7cfb4736..842b2b82 100644 --- a/src/core/operations/ToOctal.mjs +++ b/src/core/operations/ToOctal.mjs @@ -23,6 +23,7 @@ class ToOctal extends Operation { this.name = "To Octal"; this.module = "Default"; this.description = "Converts the input string to octal bytes separated by the specified delimiter.

    e.g. The UTF-8 encoded string Γειά σου becomes 316 223 316 265 316 271 316 254 40 317 203 316 277 317 205"; + this.infoURL = "https://wikipedia.org/wiki/Octal"; this.inputType = "byteArray"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToPunycode.mjs b/src/core/operations/ToPunycode.mjs index 8951cb5f..6cf5096c 100644 --- a/src/core/operations/ToPunycode.mjs +++ b/src/core/operations/ToPunycode.mjs @@ -21,6 +21,7 @@ class ToPunycode extends Operation { this.name = "To Punycode"; this.module = "Encodings"; this.description = "Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

    e.g. m\xfcnchen encodes to mnchen-3ya"; + this.infoURL = "https://wikipedia.org/wiki/Punycode"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToQuotedPrintable.mjs b/src/core/operations/ToQuotedPrintable.mjs index aa1025d7..51044021 100644 --- a/src/core/operations/ToQuotedPrintable.mjs +++ b/src/core/operations/ToQuotedPrintable.mjs @@ -24,6 +24,7 @@ class ToQuotedPrintable extends Operation { this.name = "To Quoted Printable"; this.module = "Default"; this.description = "Quoted-Printable, or QP encoding, is an encoding using printable ASCII characters (alphanumeric and the equals sign '=') to transmit 8-bit data over a 7-bit data path or, generally, over a medium which is not 8-bit clean. It is defined as a MIME content transfer encoding for use in e-mail.

    QP works by using the equals sign '=' as an escape character. It also limits line length to 76, as some software has limits on line length."; + this.infoURL = "https://wikipedia.org/wiki/Quoted-printable"; this.inputType = "byteArray"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/ToSnakeCase.mjs b/src/core/operations/ToSnakeCase.mjs index 10af102b..0cef88fe 100644 --- a/src/core/operations/ToSnakeCase.mjs +++ b/src/core/operations/ToSnakeCase.mjs @@ -22,6 +22,7 @@ class ToSnakeCase extends Operation { this.name = "To Snake case"; this.module = "Code"; this.description = "Converts the input string to snake case.\n

    \nSnake case is all lower case with underscores as word boundaries.\n

    \ne.g. this_is_snake_case\n

    \n'Attempt to be context aware' will make the operation attempt to nicely transform variable and function names."; + this.infoURL = "https://wikipedia.org/wiki/Snake_case"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/ToTable.mjs b/src/core/operations/ToTable.mjs index 5f6b9670..dfade8c1 100644 --- a/src/core/operations/ToTable.mjs +++ b/src/core/operations/ToTable.mjs @@ -21,6 +21,7 @@ class ToTable extends Operation { this.name = "To Table"; this.module = "Default"; this.description = "Data can be split on different characters and rendered as an HTML or ASCII table with an optional header row.

    Supports the CSV (Comma Separated Values) file format by default. Change the cell delimiter argument to \\t to support TSV (Tab Separated Values) or | for PSV (Pipe Separated Values).

    You can enter as many delimiters as you like. Each character will be treat as a separate possible delimiter."; + this.infoURL = "https://wikipedia.org/wiki/Comma-separated_values"; this.inputType = "string"; this.outputType = "html"; this.args = [ diff --git a/src/core/operations/ToUNIXTimestamp.mjs b/src/core/operations/ToUNIXTimestamp.mjs index 6983d617..d8cde848 100644 --- a/src/core/operations/ToUNIXTimestamp.mjs +++ b/src/core/operations/ToUNIXTimestamp.mjs @@ -23,6 +23,7 @@ class ToUNIXTimestamp extends Operation { this.name = "To UNIX Timestamp"; this.module = "Default"; this.description = "Parses a datetime string in UTC and returns the corresponding UNIX timestamp.

    e.g. Mon 1 January 2001 11:00:00 becomes 978346800

    A UNIX timestamp is a 32-bit value representing the number of seconds since January 1, 1970 UTC (the UNIX epoch)."; + this.infoURL = "https://wikipedia.org/wiki/Unix_time"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/TranslateDateTimeFormat.mjs b/src/core/operations/TranslateDateTimeFormat.mjs index 7f956875..2e9628f5 100644 --- a/src/core/operations/TranslateDateTimeFormat.mjs +++ b/src/core/operations/TranslateDateTimeFormat.mjs @@ -22,6 +22,7 @@ class TranslateDateTimeFormat extends Operation { this.name = "Translate DateTime Format"; this.module = "Default"; this.description = "Parses a datetime string in one format and re-writes it in another.

    Run with no input to see the relevant format string examples."; + this.infoURL = "https://momentjs.com/docs/#/parsing/string-format/"; this.inputType = "string"; this.outputType = "html"; this.args = [ diff --git a/src/core/operations/TripleDESDecrypt.mjs b/src/core/operations/TripleDESDecrypt.mjs index 8f5a295d..47d1df05 100644 --- a/src/core/operations/TripleDESDecrypt.mjs +++ b/src/core/operations/TripleDESDecrypt.mjs @@ -23,6 +23,7 @@ class TripleDESDecrypt extends Operation { this.name = "Triple DES Decrypt"; this.module = "Ciphers"; this.description = "Triple DES applies DES three times to each block to increase key size.

    Key: Triple DES uses a key length of 24 bytes (192 bits).
    DES uses a key length of 8 bytes (64 bits).

    IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

    Padding: In CBC and ECB mode, PKCS#7 padding will be used."; + this.infoURL = "https://wikipedia.org/wiki/Triple_DES"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/TripleDESEncrypt.mjs b/src/core/operations/TripleDESEncrypt.mjs index 2384ea3c..e7eb6bca 100644 --- a/src/core/operations/TripleDESEncrypt.mjs +++ b/src/core/operations/TripleDESEncrypt.mjs @@ -23,6 +23,7 @@ class TripleDESEncrypt extends Operation { this.name = "Triple DES Encrypt"; this.module = "Ciphers"; this.description = "Triple DES applies DES three times to each block to increase key size.

    Key: Triple DES uses a key length of 24 bytes (192 bits).
    DES uses a key length of 8 bytes (64 bits).

    You can generate a password-based key using one of the KDF operations.

    IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

    Padding: In CBC and ECB mode, PKCS#7 padding will be used."; + this.infoURL = "https://wikipedia.org/wiki/Triple_DES"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/UNIXTimestampToWindowsFiletime.mjs b/src/core/operations/UNIXTimestampToWindowsFiletime.mjs index 551b4273..187b98ab 100644 --- a/src/core/operations/UNIXTimestampToWindowsFiletime.mjs +++ b/src/core/operations/UNIXTimestampToWindowsFiletime.mjs @@ -22,6 +22,7 @@ class UNIXTimestampToWindowsFiletime extends Operation { this.name = "UNIX Timestamp to Windows Filetime"; this.module = "Default"; this.description = "Converts a UNIX timestamp to a Windows Filetime value.

    A Windows Filetime is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 UTC.

    A UNIX timestamp is a 32-bit value representing the number of seconds since January 1, 1970 UTC (the UNIX epoch).

    This operation also supports UNIX timestamps in milliseconds, microseconds and nanoseconds."; + this.infoURL = "https://msdn.microsoft.com/en-us/library/windows/desktop/ms724284(v=vs.85).aspx"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/URLDecode.mjs b/src/core/operations/URLDecode.mjs index 552dfe84..dbbee20d 100644 --- a/src/core/operations/URLDecode.mjs +++ b/src/core/operations/URLDecode.mjs @@ -20,6 +20,7 @@ class URLDecode extends Operation { this.name = "URL Decode"; this.module = "URL"; this.description = "Converts URI/URL percent-encoded characters back to their raw values.

    e.g. %3d becomes ="; + this.infoURL = "https://wikipedia.org/wiki/Percent-encoding"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/URLEncode.mjs b/src/core/operations/URLEncode.mjs index 23fd8ec9..2eb5b621 100644 --- a/src/core/operations/URLEncode.mjs +++ b/src/core/operations/URLEncode.mjs @@ -20,6 +20,7 @@ class URLEncode extends Operation { this.name = "URL Encode"; this.module = "URL"; this.description = "Encodes problematic characters into percent-encoding, a format supported by URIs/URLs.

    e.g. = becomes %3d"; + this.infoURL = "https://wikipedia.org/wiki/Percent-encoding"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/UnescapeString.mjs b/src/core/operations/UnescapeString.mjs index 0500eecd..62eab48e 100644 --- a/src/core/operations/UnescapeString.mjs +++ b/src/core/operations/UnescapeString.mjs @@ -21,6 +21,7 @@ class UnescapeString extends Operation { this.name = "Unescape string"; this.module = "Default"; this.description = "Unescapes characters in a string that have been escaped. For example, Don\\'t stop me now becomes Don't stop me now.

    Supports the following escape sequences:
    • \\n (Line feed/newline)
    • \\r (Carriage return)
    • \\t (Horizontal tab)
    • \\b (Backspace)
    • \\f (Form feed)
    • \\xnn (Hex, where n is 0-f)
    • \\\\ (Backslash)
    • \\' (Single quote)
    • \\" (Double quote)
    • \\unnnn (Unicode character)
    • \\u{nnnnnn} (Unicode code point)
    "; + this.infoURL = "https://wikipedia.org/wiki/Escape_sequence"; this.inputType = "string"; this.outputType = "string"; this.args = []; diff --git a/src/core/operations/Untar.mjs b/src/core/operations/Untar.mjs index 6bca05d0..af029184 100644 --- a/src/core/operations/Untar.mjs +++ b/src/core/operations/Untar.mjs @@ -21,6 +21,7 @@ class Untar extends Operation { this.name = "Untar"; this.module = "Compression"; this.description = "Unpacks a tarball and displays it per file."; + this.infoURL = "https://wikipedia.org/wiki/Tar_(computing)"; this.inputType = "byteArray"; this.outputType = "List"; this.presentType = "html"; diff --git a/src/core/operations/Unzip.mjs b/src/core/operations/Unzip.mjs index 8e6bb633..2766c215 100644 --- a/src/core/operations/Unzip.mjs +++ b/src/core/operations/Unzip.mjs @@ -24,6 +24,7 @@ class Unzip extends Operation { this.name = "Unzip"; this.module = "Compression"; this.description = "Decompresses data using the PKZIP algorithm and displays it per file, with support for passwords."; + this.infoURL = "https://wikipedia.org/wiki/Zip_(file_format)"; this.inputType = "ArrayBuffer"; this.outputType = "List"; this.presentType = "html"; diff --git a/src/core/operations/VigenèreDecode.mjs b/src/core/operations/VigenèreDecode.mjs index b1512a3e..98aef876 100644 --- a/src/core/operations/VigenèreDecode.mjs +++ b/src/core/operations/VigenèreDecode.mjs @@ -20,6 +20,7 @@ class VigenèreDecode extends Operation { this.name = "Vigenère Decode"; this.module = "Ciphers"; this.description = "The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution."; + this.infoURL = "https://wikipedia.org/wiki/Vigenère_cipher"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/VigenèreEncode.mjs b/src/core/operations/VigenèreEncode.mjs index 9172ed06..2e02339c 100644 --- a/src/core/operations/VigenèreEncode.mjs +++ b/src/core/operations/VigenèreEncode.mjs @@ -21,6 +21,7 @@ class VigenèreEncode extends Operation { this.name = "Vigenère Encode"; this.module = "Ciphers"; this.description = "The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution."; + this.infoURL = "https://wikipedia.org/wiki/Vigenère_cipher"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/Whirlpool.mjs b/src/core/operations/Whirlpool.mjs index 1d32f244..fb3cdfc9 100644 --- a/src/core/operations/Whirlpool.mjs +++ b/src/core/operations/Whirlpool.mjs @@ -20,7 +20,8 @@ class Whirlpool extends Operation { this.name = "Whirlpool"; this.module = "Hashing"; - this.description = "Whirlpool is a cryptographic hash function designed by Vincent Rijmen (co-creator of AES) and Paulo S. L. M. Barreto, who first described it in 2000.

    Several variants exist:
    • Whirlpool-0 is the original version released in 2000.
    • Whirlpool-T is the first revision, released in 2001, improving the generation of the s-box.
    • Wirlpool is the latest revision, released in 2003, fixing a flaw in the difusion matrix.
    "; + this.description = "Whirlpool is a cryptographic hash function designed by Vincent Rijmen (co-creator of AES) and Paulo S. L. M. Barreto, who first described it in 2000.

    Several variants exist:
    • Whirlpool-0 is the original version released in 2000.
    • Whirlpool-T is the first revision, released in 2001, improving the generation of the s-box.
    • Whirlpool is the latest revision, released in 2003, fixing a flaw in the difusion matrix.
    "; + this.infoURL = "https://wikipedia.org/wiki/Whirlpool_(cryptography)"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/WindowsFiletimeToUNIXTimestamp.mjs b/src/core/operations/WindowsFiletimeToUNIXTimestamp.mjs index b3d66476..f5b59037 100644 --- a/src/core/operations/WindowsFiletimeToUNIXTimestamp.mjs +++ b/src/core/operations/WindowsFiletimeToUNIXTimestamp.mjs @@ -22,6 +22,7 @@ class WindowsFiletimeToUNIXTimestamp extends Operation { this.name = "Windows Filetime to UNIX Timestamp"; this.module = "Default"; this.description = "Converts a Windows Filetime value to a UNIX timestamp.

    A Windows Filetime is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 UTC.

    A UNIX timestamp is a 32-bit value representing the number of seconds since January 1, 1970 UTC (the UNIX epoch).

    This operation also supports UNIX timestamps in milliseconds, microseconds and nanoseconds."; + this.infoURL = "https://msdn.microsoft.com/en-us/library/windows/desktop/ms724284(v=vs.85).aspx"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/XKCDRandomNumber.mjs b/src/core/operations/XKCDRandomNumber.mjs index a9481fbf..e5811549 100644 --- a/src/core/operations/XKCDRandomNumber.mjs +++ b/src/core/operations/XKCDRandomNumber.mjs @@ -19,7 +19,8 @@ class XKCDRandomNumber extends Operation { this.name = "XKCD Random Number"; this.module = "Default"; - this.description = "RFC 1149.5 specifies 4 as the standard IEEE-vetted random number.

    XKCD #221"; + this.description = "RFC 1149.5 specifies 4 as the standard IEEE-vetted random number."; + this.infoURL = "https://xkcd.com/221/"; this.inputType = "string"; this.outputType = "number"; this.args = []; diff --git a/src/core/operations/XOR.mjs b/src/core/operations/XOR.mjs index ae35eab7..ae1c2154 100644 --- a/src/core/operations/XOR.mjs +++ b/src/core/operations/XOR.mjs @@ -21,7 +21,8 @@ class XOR extends Operation { this.name = "XOR"; this.module = "Default"; - this.description = "XOR the input with the given key.
    e.g. fe023da5

    Options
    Null preserving: If the current byte is 0x00 or the same as the key, skip it.

    Scheme:
    • Standard - key is unchanged after each round
    • Input differential - key is set to the value of the previous unprocessed byte
    • Output differential - key is set to the value of the previous processed byte
    "; + this.description = "XOR the input with the given key.
    e.g. fe023da5

    Options
    Null preserving: If the current byte is 0x00 or the same as the key, skip it.

    Scheme:
    • Standard - key is unchanged after each round
    • Input differential - key is set to the value of the previous unprocessed byte
    • Output differential - key is set to the value of the previous processed byte
    • Cascade - key is set to the input byte shifted by one
    "; + this.infoURL = "https://wikipedia.org/wiki/XOR"; this.inputType = "byteArray"; this.outputType = "byteArray"; this.args = [ @@ -29,12 +30,12 @@ class XOR extends Operation { "name": "Key", "type": "toggleString", "value": "", - "toggleValues": ["Hex", "Base64", "UTF8", "Latin1"] + "toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"] }, { "name": "Scheme", "type": "option", - "value": ["Standard", "Input differential", "Output differential"] + "value": ["Standard", "Input differential", "Output differential", "Cascade"] }, { "name": "Null preserving", diff --git a/src/core/operations/XORBruteForce.mjs b/src/core/operations/XORBruteForce.mjs index 131d5a63..6284793f 100644 --- a/src/core/operations/XORBruteForce.mjs +++ b/src/core/operations/XORBruteForce.mjs @@ -23,6 +23,7 @@ class XORBruteForce extends Operation { this.name = "XOR Brute Force"; this.module = "Default"; this.description = "Enumerate all possible XOR solutions. Current maximum key length is 2 due to browser performance.

    Optionally enter a string that you expect to find in the plaintext to filter results (crib)."; + this.infoURL = "https://wikipedia.org/wiki/Exclusive_or"; this.inputType = "byteArray"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/XPathExpression.mjs b/src/core/operations/XPathExpression.mjs index 7b342004..7e9d768a 100644 --- a/src/core/operations/XPathExpression.mjs +++ b/src/core/operations/XPathExpression.mjs @@ -23,6 +23,7 @@ class XPathExpression extends Operation { this.name = "XPath expression"; this.module = "Code"; this.description = "Extract information from an XML document with an XPath query"; + this.infoURL = "https://wikipedia.org/wiki/XPath"; this.inputType = "string"; this.outputType = "string"; this.args = [ diff --git a/src/core/operations/Zip.mjs b/src/core/operations/Zip.mjs index aaa75dbb..54a92726 100644 --- a/src/core/operations/Zip.mjs +++ b/src/core/operations/Zip.mjs @@ -36,6 +36,7 @@ class Zip extends Operation { this.name = "Zip"; this.module = "Compression"; this.description = "Compresses data using the PKZIP algorithm with the given filename.

    No support for multiple files at this time."; + this.infoURL = "https://wikipedia.org/wiki/Zip_(file_format)"; this.inputType = "ArrayBuffer"; this.outputType = "File"; this.args = [ diff --git a/src/core/operations/ZlibDeflate.mjs b/src/core/operations/ZlibDeflate.mjs index 40f09dc5..d4685704 100644 --- a/src/core/operations/ZlibDeflate.mjs +++ b/src/core/operations/ZlibDeflate.mjs @@ -24,6 +24,7 @@ class ZlibDeflate extends Operation { this.name = "Zlib Deflate"; this.module = "Compression"; this.description = "Compresses data using the deflate algorithm adding zlib headers."; + this.infoURL = "https://wikipedia.org/wiki/Zlib"; this.inputType = "ArrayBuffer"; this.outputType = "ArrayBuffer"; this.args = [ diff --git a/src/core/operations/ZlibInflate.mjs b/src/core/operations/ZlibInflate.mjs index 36f841d5..a796cb3e 100644 --- a/src/core/operations/ZlibInflate.mjs +++ b/src/core/operations/ZlibInflate.mjs @@ -29,6 +29,7 @@ class ZlibInflate extends Operation { this.name = "Zlib Inflate"; this.module = "Compression"; this.description = "Decompresses data which has been compressed using the deflate algorithm with zlib headers."; + this.infoURL = "https://wikipedia.org/wiki/Zlib"; this.inputType = "ArrayBuffer"; this.outputType = "ArrayBuffer"; this.args = [ diff --git a/src/node/index.mjs b/src/node/index.mjs deleted file mode 100644 index 7366d2fc..00000000 --- a/src/node/index.mjs +++ /dev/null @@ -1,1309 +0,0 @@ -/** -* THIS FILE IS AUTOMATICALLY GENERATED BY src/node/config/scripts/generateNodeIndex.mjs -* -* @author d98762625 [d98762625@gmail.com] -* @copyright Crown Copyright 2018 -* @license Apache-2.0 -*/ - -/* eslint camelcase: 0 */ - - -import "babel-polyfill"; -import SyncDish from "./SyncDish"; -import { wrap, help, bake, explainExludedFunction } from "./api"; -import { - // import as core_ to avoid name clashes after wrap. - ADD as core_ADD, - AESDecrypt as core_AESDecrypt, - AESEncrypt as core_AESEncrypt, - AND as core_AND, - AddLineNumbers as core_AddLineNumbers, - Adler32Checksum as core_Adler32Checksum, - AffineCipherDecode as core_AffineCipherDecode, - AffineCipherEncode as core_AffineCipherEncode, - AnalyseHash as core_AnalyseHash, - AtbashCipher as core_AtbashCipher, - BSONDeserialise as core_BSONDeserialise, - BSONSerialise as core_BSONSerialise, - Bcrypt as core_Bcrypt, - BcryptCompare as core_BcryptCompare, - BcryptParse as core_BcryptParse, - BifidCipherDecode as core_BifidCipherDecode, - BifidCipherEncode as core_BifidCipherEncode, - BitShiftLeft as core_BitShiftLeft, - BitShiftRight as core_BitShiftRight, - BlowfishDecrypt as core_BlowfishDecrypt, - BlowfishEncrypt as core_BlowfishEncrypt, - Bzip2Decompress as core_Bzip2Decompress, - CRC16Checksum as core_CRC16Checksum, - CRC32Checksum as core_CRC32Checksum, - CSSBeautify as core_CSSBeautify, - CSSMinify as core_CSSMinify, - CSSSelector as core_CSSSelector, - CTPH as core_CTPH, - CartesianProduct as core_CartesianProduct, - ChangeIPFormat as core_ChangeIPFormat, - ChiSquare as core_ChiSquare, - CompareCTPHHashes as core_CompareCTPHHashes, - CompareSSDEEPHashes as core_CompareSSDEEPHashes, - ConvertArea as core_ConvertArea, - ConvertDataUnits as core_ConvertDataUnits, - ConvertDistance as core_ConvertDistance, - ConvertMass as core_ConvertMass, - ConvertSpeed as core_ConvertSpeed, - CountOccurrences as core_CountOccurrences, - DESDecrypt as core_DESDecrypt, - DESEncrypt as core_DESEncrypt, - DecodeNetBIOSName as core_DecodeNetBIOSName, - DecodeText as core_DecodeText, - DeriveEVPKey as core_DeriveEVPKey, - DerivePBKDF2Key as core_DerivePBKDF2Key, - DetectFileType as core_DetectFileType, - Diff as core_Diff, - DisassembleX86 as core_DisassembleX86, - Divide as core_Divide, - DropBytes as core_DropBytes, - EncodeNetBIOSName as core_EncodeNetBIOSName, - EncodeText as core_EncodeText, - Entropy as core_Entropy, - EscapeString as core_EscapeString, - EscapeUnicodeCharacters as core_EscapeUnicodeCharacters, - ExpandAlphabetRange as core_ExpandAlphabetRange, - ExtractDates as core_ExtractDates, - ExtractDomains as core_ExtractDomains, - ExtractEXIF as core_ExtractEXIF, - ExtractEmailAddresses as core_ExtractEmailAddresses, - ExtractFilePaths as core_ExtractFilePaths, - ExtractIPAddresses as core_ExtractIPAddresses, - ExtractMACAddresses as core_ExtractMACAddresses, - ExtractURLs as core_ExtractURLs, - Filter as core_Filter, - FindReplace as core_FindReplace, - Fletcher16Checksum as core_Fletcher16Checksum, - Fletcher32Checksum as core_Fletcher32Checksum, - Fletcher64Checksum as core_Fletcher64Checksum, - Fletcher8Checksum as core_Fletcher8Checksum, - FormatMACAddresses as core_FormatMACAddresses, - FrequencyDistribution as core_FrequencyDistribution, - FromBCD as core_FromBCD, - FromBase as core_FromBase, - FromBase32 as core_FromBase32, - FromBase58 as core_FromBase58, - FromBase64 as core_FromBase64, - FromBinary as core_FromBinary, - FromCharcode as core_FromCharcode, - FromDecimal as core_FromDecimal, - FromHTMLEntity as core_FromHTMLEntity, - FromHex as core_FromHex, - FromHexContent as core_FromHexContent, - FromHexdump as core_FromHexdump, - FromMorseCode as core_FromMorseCode, - FromOctal as core_FromOctal, - FromPunycode as core_FromPunycode, - FromQuotedPrintable as core_FromQuotedPrintable, - FromUNIXTimestamp as core_FromUNIXTimestamp, - GenerateAllHashes as core_GenerateAllHashes, - GenerateHOTP as core_GenerateHOTP, - GeneratePGPKeyPair as core_GeneratePGPKeyPair, - GenerateTOTP as core_GenerateTOTP, - GenerateUUID as core_GenerateUUID, - GenericCodeBeautify as core_GenericCodeBeautify, - GroupIPAddresses as core_GroupIPAddresses, - Gunzip as core_Gunzip, - Gzip as core_Gzip, - HAS160 as core_HAS160, - HMAC as core_HMAC, - HTTPRequest as core_HTTPRequest, - HammingDistance as core_HammingDistance, - HaversineDistance as core_HaversineDistance, - Head as core_Head, - HexToObjectIdentifier as core_HexToObjectIdentifier, - HexToPEM as core_HexToPEM, - JPathExpression as core_JPathExpression, - JSONBeautify as core_JSONBeautify, - JSONMinify as core_JSONMinify, - Keccak as core_Keccak, - MD2 as core_MD2, - MD4 as core_MD4, - MD5 as core_MD5, - MD6 as core_MD6, - Magic as core_Magic, - Mean as core_Mean, - Median as core_Median, - MicrosoftScriptDecoder as core_MicrosoftScriptDecoder, - Multiply as core_Multiply, - NOT as core_NOT, - Numberwang as core_Numberwang, - OR as core_OR, - ObjectIdentifierToHex as core_ObjectIdentifierToHex, - OffsetChecker as core_OffsetChecker, - PEMToHex as core_PEMToHex, - PGPDecrypt as core_PGPDecrypt, - PGPDecryptAndVerify as core_PGPDecryptAndVerify, - PGPEncrypt as core_PGPEncrypt, - PGPEncryptAndSign as core_PGPEncryptAndSign, - PHPDeserialize as core_PHPDeserialize, - PadLines as core_PadLines, - ParseASN1HexString as core_ParseASN1HexString, - ParseColourCode as core_ParseColourCode, - ParseDateTime as core_ParseDateTime, - ParseIPRange as core_ParseIPRange, - ParseIPv4Header as core_ParseIPv4Header, - ParseIPv6Address as core_ParseIPv6Address, - ParseUNIXFilePermissions as core_ParseUNIXFilePermissions, - ParseURI as core_ParseURI, - ParseUserAgent as core_ParseUserAgent, - ParseX509Certificate as core_ParseX509Certificate, - PowerSet as core_PowerSet, - PseudoRandomNumberGenerator as core_PseudoRandomNumberGenerator, - RC2Decrypt as core_RC2Decrypt, - RC2Encrypt as core_RC2Encrypt, - RC4 as core_RC4, - RC4Drop as core_RC4Drop, - RIPEMD as core_RIPEMD, - ROT13 as core_ROT13, - ROT47 as core_ROT47, - RawDeflate as core_RawDeflate, - RawInflate as core_RawInflate, - Register as core_Register, - RegularExpression as core_RegularExpression, - RemoveEXIF as core_RemoveEXIF, - RemoveLineNumbers as core_RemoveLineNumbers, - RemoveNullBytes as core_RemoveNullBytes, - RemoveWhitespace as core_RemoveWhitespace, - Return as core_Return, - Reverse as core_Reverse, - RotateLeft as core_RotateLeft, - RotateRight as core_RotateRight, - SHA0 as core_SHA0, - SHA1 as core_SHA1, - SHA2 as core_SHA2, - SHA3 as core_SHA3, - SQLBeautify as core_SQLBeautify, - SQLMinify as core_SQLMinify, - SSDEEP as core_SSDEEP, - SUB as core_SUB, - ScanForEmbeddedFiles as core_ScanForEmbeddedFiles, - Scrypt as core_Scrypt, - SetDifference as core_SetDifference, - SetIntersection as core_SetIntersection, - SetUnion as core_SetUnion, - Shake as core_Shake, - ShowBase64Offsets as core_ShowBase64Offsets, - Sleep as core_Sleep, - Snefru as core_Snefru, - Sort as core_Sort, - Split as core_Split, - StandardDeviation as core_StandardDeviation, - Strings as core_Strings, - StripHTMLTags as core_StripHTMLTags, - StripHTTPHeaders as core_StripHTTPHeaders, - Substitute as core_Substitute, - Subtract as core_Subtract, - Sum as core_Sum, - SwapEndianness as core_SwapEndianness, - SymmetricDifference as core_SymmetricDifference, - TCPIPChecksum as core_TCPIPChecksum, - Tail as core_Tail, - TakeBytes as core_TakeBytes, - ToBCD as core_ToBCD, - ToBase as core_ToBase, - ToBase32 as core_ToBase32, - ToBase58 as core_ToBase58, - ToBase64 as core_ToBase64, - ToBinary as core_ToBinary, - ToCamelCase as core_ToCamelCase, - ToCharcode as core_ToCharcode, - ToDecimal as core_ToDecimal, - ToHTMLEntity as core_ToHTMLEntity, - ToHex as core_ToHex, - ToHexContent as core_ToHexContent, - ToHexdump as core_ToHexdump, - ToKebabCase as core_ToKebabCase, - ToLowerCase as core_ToLowerCase, - ToMorseCode as core_ToMorseCode, - ToOctal as core_ToOctal, - ToPunycode as core_ToPunycode, - ToQuotedPrintable as core_ToQuotedPrintable, - ToSnakeCase as core_ToSnakeCase, - ToTable as core_ToTable, - ToUNIXTimestamp as core_ToUNIXTimestamp, - ToUpperCase as core_ToUpperCase, - TranslateDateTimeFormat as core_TranslateDateTimeFormat, - TripleDESDecrypt as core_TripleDESDecrypt, - TripleDESEncrypt as core_TripleDESEncrypt, - UNIXTimestampToWindowsFiletime as core_UNIXTimestampToWindowsFiletime, - URLDecode as core_URLDecode, - URLEncode as core_URLEncode, - UnescapeString as core_UnescapeString, - UnescapeUnicodeCharacters as core_UnescapeUnicodeCharacters, - Unique as core_Unique, - VigenèreDecode as core_VigenèreDecode, - VigenèreEncode as core_VigenèreEncode, - Whirlpool as core_Whirlpool, - WindowsFiletimeToUNIXTimestamp as core_WindowsFiletimeToUNIXTimestamp, - XKCDRandomNumber as core_XKCDRandomNumber, - XMLBeautify as core_XMLBeautify, - XMLMinify as core_XMLMinify, - XOR as core_XOR, - XORBruteForce as core_XORBruteForce, - XPathExpression as core_XPathExpression, - ZlibDeflate as core_ZlibDeflate, - ZlibInflate as core_ZlibInflate, - -} from "../core/operations/index"; - -// Define global environment functions -global.ENVIRONMENT_IS_WORKER = function() { - return typeof importScripts === "function"; -}; -global.ENVIRONMENT_IS_NODE = function() { - return typeof process === "object" && typeof require === "function"; -}; -global.ENVIRONMENT_IS_WEB = function() { - return typeof window === "object"; -}; - -/** - * generateChef - * - * Creates decapitalised, wrapped ops in chef object for default export. - */ -function generateChef() { - return { - "ADD": wrap(core_ADD), - "AESDecrypt": wrap(core_AESDecrypt), - "AESEncrypt": wrap(core_AESEncrypt), - "AND": wrap(core_AND), - "addLineNumbers": wrap(core_AddLineNumbers), - "adler32Checksum": wrap(core_Adler32Checksum), - "affineCipherDecode": wrap(core_AffineCipherDecode), - "affineCipherEncode": wrap(core_AffineCipherEncode), - "analyseHash": wrap(core_AnalyseHash), - "atbashCipher": wrap(core_AtbashCipher), - "BSONDeserialise": wrap(core_BSONDeserialise), - "BSONSerialise": wrap(core_BSONSerialise), - "bcrypt": wrap(core_Bcrypt), - "bcryptCompare": wrap(core_BcryptCompare), - "bcryptParse": wrap(core_BcryptParse), - "bifidCipherDecode": wrap(core_BifidCipherDecode), - "bifidCipherEncode": wrap(core_BifidCipherEncode), - "bitShiftLeft": wrap(core_BitShiftLeft), - "bitShiftRight": wrap(core_BitShiftRight), - "blowfishDecrypt": wrap(core_BlowfishDecrypt), - "blowfishEncrypt": wrap(core_BlowfishEncrypt), - "bzip2Decompress": wrap(core_Bzip2Decompress), - "CRC16Checksum": wrap(core_CRC16Checksum), - "CRC32Checksum": wrap(core_CRC32Checksum), - "CSSBeautify": wrap(core_CSSBeautify), - "CSSMinify": wrap(core_CSSMinify), - "CSSSelector": wrap(core_CSSSelector), - "CTPH": wrap(core_CTPH), - "cartesianProduct": wrap(core_CartesianProduct), - "changeIPFormat": wrap(core_ChangeIPFormat), - "chiSquare": wrap(core_ChiSquare), - "compareCTPHHashes": wrap(core_CompareCTPHHashes), - "compareSSDEEPHashes": wrap(core_CompareSSDEEPHashes), - "convertArea": wrap(core_ConvertArea), - "convertDataUnits": wrap(core_ConvertDataUnits), - "convertDistance": wrap(core_ConvertDistance), - "convertMass": wrap(core_ConvertMass), - "convertSpeed": wrap(core_ConvertSpeed), - "countOccurrences": wrap(core_CountOccurrences), - "DESDecrypt": wrap(core_DESDecrypt), - "DESEncrypt": wrap(core_DESEncrypt), - "decodeNetBIOSName": wrap(core_DecodeNetBIOSName), - "decodeText": wrap(core_DecodeText), - "deriveEVPKey": wrap(core_DeriveEVPKey), - "derivePBKDF2Key": wrap(core_DerivePBKDF2Key), - "detectFileType": wrap(core_DetectFileType), - "diff": wrap(core_Diff), - "disassembleX86": wrap(core_DisassembleX86), - "divide": wrap(core_Divide), - "dropBytes": wrap(core_DropBytes), - "encodeNetBIOSName": wrap(core_EncodeNetBIOSName), - "encodeText": wrap(core_EncodeText), - "entropy": wrap(core_Entropy), - "escapeString": wrap(core_EscapeString), - "escapeUnicodeCharacters": wrap(core_EscapeUnicodeCharacters), - "expandAlphabetRange": wrap(core_ExpandAlphabetRange), - "extractDates": wrap(core_ExtractDates), - "extractDomains": wrap(core_ExtractDomains), - "extractEXIF": wrap(core_ExtractEXIF), - "extractEmailAddresses": wrap(core_ExtractEmailAddresses), - "extractFilePaths": wrap(core_ExtractFilePaths), - "extractIPAddresses": wrap(core_ExtractIPAddresses), - "extractMACAddresses": wrap(core_ExtractMACAddresses), - "extractURLs": wrap(core_ExtractURLs), - "filter": wrap(core_Filter), - "findReplace": wrap(core_FindReplace), - "fletcher16Checksum": wrap(core_Fletcher16Checksum), - "fletcher32Checksum": wrap(core_Fletcher32Checksum), - "fletcher64Checksum": wrap(core_Fletcher64Checksum), - "fletcher8Checksum": wrap(core_Fletcher8Checksum), - "formatMACAddresses": wrap(core_FormatMACAddresses), - "frequencyDistribution": wrap(core_FrequencyDistribution), - "fromBCD": wrap(core_FromBCD), - "fromBase": wrap(core_FromBase), - "fromBase32": wrap(core_FromBase32), - "fromBase58": wrap(core_FromBase58), - "fromBase64": wrap(core_FromBase64), - "fromBinary": wrap(core_FromBinary), - "fromCharcode": wrap(core_FromCharcode), - "fromDecimal": wrap(core_FromDecimal), - "fromHTMLEntity": wrap(core_FromHTMLEntity), - "fromHex": wrap(core_FromHex), - "fromHexContent": wrap(core_FromHexContent), - "fromHexdump": wrap(core_FromHexdump), - "fromMorseCode": wrap(core_FromMorseCode), - "fromOctal": wrap(core_FromOctal), - "fromPunycode": wrap(core_FromPunycode), - "fromQuotedPrintable": wrap(core_FromQuotedPrintable), - "fromUNIXTimestamp": wrap(core_FromUNIXTimestamp), - "generateAllHashes": wrap(core_GenerateAllHashes), - "generateHOTP": wrap(core_GenerateHOTP), - "generatePGPKeyPair": wrap(core_GeneratePGPKeyPair), - "generateTOTP": wrap(core_GenerateTOTP), - "generateUUID": wrap(core_GenerateUUID), - "genericCodeBeautify": wrap(core_GenericCodeBeautify), - "groupIPAddresses": wrap(core_GroupIPAddresses), - "gunzip": wrap(core_Gunzip), - "gzip": wrap(core_Gzip), - "HAS160": wrap(core_HAS160), - "HMAC": wrap(core_HMAC), - "HTTPRequest": wrap(core_HTTPRequest), - "hammingDistance": wrap(core_HammingDistance), - "haversineDistance": wrap(core_HaversineDistance), - "head": wrap(core_Head), - "hexToObjectIdentifier": wrap(core_HexToObjectIdentifier), - "hexToPEM": wrap(core_HexToPEM), - "JPathExpression": wrap(core_JPathExpression), - "JSONBeautify": wrap(core_JSONBeautify), - "JSONMinify": wrap(core_JSONMinify), - "keccak": wrap(core_Keccak), - "MD2": wrap(core_MD2), - "MD4": wrap(core_MD4), - "MD5": wrap(core_MD5), - "MD6": wrap(core_MD6), - "magic": wrap(core_Magic), - "mean": wrap(core_Mean), - "median": wrap(core_Median), - "microsoftScriptDecoder": wrap(core_MicrosoftScriptDecoder), - "multiply": wrap(core_Multiply), - "NOT": wrap(core_NOT), - "numberwang": wrap(core_Numberwang), - "OR": wrap(core_OR), - "objectIdentifierToHex": wrap(core_ObjectIdentifierToHex), - "offsetChecker": wrap(core_OffsetChecker), - "PEMToHex": wrap(core_PEMToHex), - "PGPDecrypt": wrap(core_PGPDecrypt), - "PGPDecryptAndVerify": wrap(core_PGPDecryptAndVerify), - "PGPEncrypt": wrap(core_PGPEncrypt), - "PGPEncryptAndSign": wrap(core_PGPEncryptAndSign), - "PHPDeserialize": wrap(core_PHPDeserialize), - "padLines": wrap(core_PadLines), - "parseASN1HexString": wrap(core_ParseASN1HexString), - "parseColourCode": wrap(core_ParseColourCode), - "parseDateTime": wrap(core_ParseDateTime), - "parseIPRange": wrap(core_ParseIPRange), - "parseIPv4Header": wrap(core_ParseIPv4Header), - "parseIPv6Address": wrap(core_ParseIPv6Address), - "parseUNIXFilePermissions": wrap(core_ParseUNIXFilePermissions), - "parseURI": wrap(core_ParseURI), - "parseUserAgent": wrap(core_ParseUserAgent), - "parseX509Certificate": wrap(core_ParseX509Certificate), - "powerSet": wrap(core_PowerSet), - "pseudoRandomNumberGenerator": wrap(core_PseudoRandomNumberGenerator), - "RC2Decrypt": wrap(core_RC2Decrypt), - "RC2Encrypt": wrap(core_RC2Encrypt), - "RC4": wrap(core_RC4), - "RC4Drop": wrap(core_RC4Drop), - "RIPEMD": wrap(core_RIPEMD), - "ROT13": wrap(core_ROT13), - "ROT47": wrap(core_ROT47), - "rawDeflate": wrap(core_RawDeflate), - "rawInflate": wrap(core_RawInflate), - "register": wrap(core_Register), - "regularExpression": wrap(core_RegularExpression), - "removeEXIF": wrap(core_RemoveEXIF), - "removeLineNumbers": wrap(core_RemoveLineNumbers), - "removeNullBytes": wrap(core_RemoveNullBytes), - "removeWhitespace": wrap(core_RemoveWhitespace), - "Return": wrap(core_Return), - "reverse": wrap(core_Reverse), - "rotateLeft": wrap(core_RotateLeft), - "rotateRight": wrap(core_RotateRight), - "SHA0": wrap(core_SHA0), - "SHA1": wrap(core_SHA1), - "SHA2": wrap(core_SHA2), - "SHA3": wrap(core_SHA3), - "SQLBeautify": wrap(core_SQLBeautify), - "SQLMinify": wrap(core_SQLMinify), - "SSDEEP": wrap(core_SSDEEP), - "SUB": wrap(core_SUB), - "scanForEmbeddedFiles": wrap(core_ScanForEmbeddedFiles), - "scrypt": wrap(core_Scrypt), - "setDifference": wrap(core_SetDifference), - "setIntersection": wrap(core_SetIntersection), - "setUnion": wrap(core_SetUnion), - "shake": wrap(core_Shake), - "showBase64Offsets": wrap(core_ShowBase64Offsets), - "sleep": wrap(core_Sleep), - "snefru": wrap(core_Snefru), - "sort": wrap(core_Sort), - "split": wrap(core_Split), - "standardDeviation": wrap(core_StandardDeviation), - "strings": wrap(core_Strings), - "stripHTMLTags": wrap(core_StripHTMLTags), - "stripHTTPHeaders": wrap(core_StripHTTPHeaders), - "substitute": wrap(core_Substitute), - "subtract": wrap(core_Subtract), - "sum": wrap(core_Sum), - "swapEndianness": wrap(core_SwapEndianness), - "symmetricDifference": wrap(core_SymmetricDifference), - "TCPIPChecksum": wrap(core_TCPIPChecksum), - "tail": wrap(core_Tail), - "takeBytes": wrap(core_TakeBytes), - "toBCD": wrap(core_ToBCD), - "toBase": wrap(core_ToBase), - "toBase32": wrap(core_ToBase32), - "toBase58": wrap(core_ToBase58), - "toBase64": wrap(core_ToBase64), - "toBinary": wrap(core_ToBinary), - "toCamelCase": wrap(core_ToCamelCase), - "toCharcode": wrap(core_ToCharcode), - "toDecimal": wrap(core_ToDecimal), - "toHTMLEntity": wrap(core_ToHTMLEntity), - "toHex": wrap(core_ToHex), - "toHexContent": wrap(core_ToHexContent), - "toHexdump": wrap(core_ToHexdump), - "toKebabCase": wrap(core_ToKebabCase), - "toLowerCase": wrap(core_ToLowerCase), - "toMorseCode": wrap(core_ToMorseCode), - "toOctal": wrap(core_ToOctal), - "toPunycode": wrap(core_ToPunycode), - "toQuotedPrintable": wrap(core_ToQuotedPrintable), - "toSnakeCase": wrap(core_ToSnakeCase), - "toTable": wrap(core_ToTable), - "toUNIXTimestamp": wrap(core_ToUNIXTimestamp), - "toUpperCase": wrap(core_ToUpperCase), - "translateDateTimeFormat": wrap(core_TranslateDateTimeFormat), - "tripleDESDecrypt": wrap(core_TripleDESDecrypt), - "tripleDESEncrypt": wrap(core_TripleDESEncrypt), - "UNIXTimestampToWindowsFiletime": wrap(core_UNIXTimestampToWindowsFiletime), - "URLDecode": wrap(core_URLDecode), - "URLEncode": wrap(core_URLEncode), - "unescapeString": wrap(core_UnescapeString), - "unescapeUnicodeCharacters": wrap(core_UnescapeUnicodeCharacters), - "unique": wrap(core_Unique), - "vigenèreDecode": wrap(core_VigenèreDecode), - "vigenèreEncode": wrap(core_VigenèreEncode), - "whirlpool": wrap(core_Whirlpool), - "windowsFiletimeToUNIXTimestamp": wrap(core_WindowsFiletimeToUNIXTimestamp), - "XKCDRandomNumber": wrap(core_XKCDRandomNumber), - "XMLBeautify": wrap(core_XMLBeautify), - "XMLMinify": wrap(core_XMLMinify), - "XOR": wrap(core_XOR), - "XORBruteForce": wrap(core_XORBruteForce), - "XPathExpression": wrap(core_XPathExpression), - "zlibDeflate": wrap(core_ZlibDeflate), - "zlibInflate": wrap(core_ZlibInflate), - "fork": explainExludedFunction("Fork"), - "merge": explainExludedFunction("Merge"), - "jump": explainExludedFunction("Jump"), - "conditionalJump": explainExludedFunction("ConditionalJump"), - "label": explainExludedFunction("Label"), - "comment": explainExludedFunction("Comment"), - "tar": explainExludedFunction("Tar"), - "untar": explainExludedFunction("Untar"), - "unzip": explainExludedFunction("Unzip"), - "zip": explainExludedFunction("Zip"), - "javaScriptBeautify": explainExludedFunction("JavaScriptBeautify"), - "javaScriptMinify": explainExludedFunction("JavaScriptMinify"), - "javaScriptParser": explainExludedFunction("JavaScriptParser"), - "renderImage": explainExludedFunction("RenderImage"), - "syntaxHighlighter": explainExludedFunction("SyntaxHighlighter"), - }; -} - -const chef = generateChef(); -// Add some additional features to chef object. -chef.help = help; -chef.dish = SyncDish; - -// Define consts here so we can add to top-level export - wont allow -// export of chef property. -const ADD = chef.ADD; -const AESDecrypt = chef.AESDecrypt; -const AESEncrypt = chef.AESEncrypt; -const AND = chef.AND; -const addLineNumbers = chef.addLineNumbers; -const adler32Checksum = chef.adler32Checksum; -const affineCipherDecode = chef.affineCipherDecode; -const affineCipherEncode = chef.affineCipherEncode; -const analyseHash = chef.analyseHash; -const atbashCipher = chef.atbashCipher; -const BSONDeserialise = chef.BSONDeserialise; -const BSONSerialise = chef.BSONSerialise; -const bcrypt = chef.bcrypt; -const bcryptCompare = chef.bcryptCompare; -const bcryptParse = chef.bcryptParse; -const bifidCipherDecode = chef.bifidCipherDecode; -const bifidCipherEncode = chef.bifidCipherEncode; -const bitShiftLeft = chef.bitShiftLeft; -const bitShiftRight = chef.bitShiftRight; -const blowfishDecrypt = chef.blowfishDecrypt; -const blowfishEncrypt = chef.blowfishEncrypt; -const bzip2Decompress = chef.bzip2Decompress; -const CRC16Checksum = chef.CRC16Checksum; -const CRC32Checksum = chef.CRC32Checksum; -const CSSBeautify = chef.CSSBeautify; -const CSSMinify = chef.CSSMinify; -const CSSSelector = chef.CSSSelector; -const CTPH = chef.CTPH; -const cartesianProduct = chef.cartesianProduct; -const changeIPFormat = chef.changeIPFormat; -const chiSquare = chef.chiSquare; -const comment = chef.comment; -const compareCTPHHashes = chef.compareCTPHHashes; -const compareSSDEEPHashes = chef.compareSSDEEPHashes; -const conditionalJump = chef.conditionalJump; -const convertArea = chef.convertArea; -const convertDataUnits = chef.convertDataUnits; -const convertDistance = chef.convertDistance; -const convertMass = chef.convertMass; -const convertSpeed = chef.convertSpeed; -const countOccurrences = chef.countOccurrences; -const DESDecrypt = chef.DESDecrypt; -const DESEncrypt = chef.DESEncrypt; -const decodeNetBIOSName = chef.decodeNetBIOSName; -const decodeText = chef.decodeText; -const deriveEVPKey = chef.deriveEVPKey; -const derivePBKDF2Key = chef.derivePBKDF2Key; -const detectFileType = chef.detectFileType; -const diff = chef.diff; -const disassembleX86 = chef.disassembleX86; -const divide = chef.divide; -const dropBytes = chef.dropBytes; -const encodeNetBIOSName = chef.encodeNetBIOSName; -const encodeText = chef.encodeText; -const entropy = chef.entropy; -const escapeString = chef.escapeString; -const escapeUnicodeCharacters = chef.escapeUnicodeCharacters; -const expandAlphabetRange = chef.expandAlphabetRange; -const extractDates = chef.extractDates; -const extractDomains = chef.extractDomains; -const extractEXIF = chef.extractEXIF; -const extractEmailAddresses = chef.extractEmailAddresses; -const extractFilePaths = chef.extractFilePaths; -const extractIPAddresses = chef.extractIPAddresses; -const extractMACAddresses = chef.extractMACAddresses; -const extractURLs = chef.extractURLs; -const filter = chef.filter; -const findReplace = chef.findReplace; -const fletcher16Checksum = chef.fletcher16Checksum; -const fletcher32Checksum = chef.fletcher32Checksum; -const fletcher64Checksum = chef.fletcher64Checksum; -const fletcher8Checksum = chef.fletcher8Checksum; -const fork = chef.fork; -const formatMACAddresses = chef.formatMACAddresses; -const frequencyDistribution = chef.frequencyDistribution; -const fromBCD = chef.fromBCD; -const fromBase = chef.fromBase; -const fromBase32 = chef.fromBase32; -const fromBase58 = chef.fromBase58; -const fromBase64 = chef.fromBase64; -const fromBinary = chef.fromBinary; -const fromCharcode = chef.fromCharcode; -const fromDecimal = chef.fromDecimal; -const fromHTMLEntity = chef.fromHTMLEntity; -const fromHex = chef.fromHex; -const fromHexContent = chef.fromHexContent; -const fromHexdump = chef.fromHexdump; -const fromMorseCode = chef.fromMorseCode; -const fromOctal = chef.fromOctal; -const fromPunycode = chef.fromPunycode; -const fromQuotedPrintable = chef.fromQuotedPrintable; -const fromUNIXTimestamp = chef.fromUNIXTimestamp; -const generateAllHashes = chef.generateAllHashes; -const generateHOTP = chef.generateHOTP; -const generatePGPKeyPair = chef.generatePGPKeyPair; -const generateTOTP = chef.generateTOTP; -const generateUUID = chef.generateUUID; -const genericCodeBeautify = chef.genericCodeBeautify; -const groupIPAddresses = chef.groupIPAddresses; -const gunzip = chef.gunzip; -const gzip = chef.gzip; -const HAS160 = chef.HAS160; -const HMAC = chef.HMAC; -const HTTPRequest = chef.HTTPRequest; -const hammingDistance = chef.hammingDistance; -const haversineDistance = chef.haversineDistance; -const head = chef.head; -const hexToObjectIdentifier = chef.hexToObjectIdentifier; -const hexToPEM = chef.hexToPEM; -const JPathExpression = chef.JPathExpression; -const JSONBeautify = chef.JSONBeautify; -const JSONMinify = chef.JSONMinify; -const javaScriptBeautify = chef.javaScriptBeautify; -const javaScriptMinify = chef.javaScriptMinify; -const javaScriptParser = chef.javaScriptParser; -const jump = chef.jump; -const keccak = chef.keccak; -const label = chef.label; -const MD2 = chef.MD2; -const MD4 = chef.MD4; -const MD5 = chef.MD5; -const MD6 = chef.MD6; -const magic = chef.magic; -const mean = chef.mean; -const median = chef.median; -const merge = chef.merge; -const microsoftScriptDecoder = chef.microsoftScriptDecoder; -const multiply = chef.multiply; -const NOT = chef.NOT; -const numberwang = chef.numberwang; -const OR = chef.OR; -const objectIdentifierToHex = chef.objectIdentifierToHex; -const offsetChecker = chef.offsetChecker; -const PEMToHex = chef.PEMToHex; -const PGPDecrypt = chef.PGPDecrypt; -const PGPDecryptAndVerify = chef.PGPDecryptAndVerify; -const PGPEncrypt = chef.PGPEncrypt; -const PGPEncryptAndSign = chef.PGPEncryptAndSign; -const PHPDeserialize = chef.PHPDeserialize; -const padLines = chef.padLines; -const parseASN1HexString = chef.parseASN1HexString; -const parseColourCode = chef.parseColourCode; -const parseDateTime = chef.parseDateTime; -const parseIPRange = chef.parseIPRange; -const parseIPv4Header = chef.parseIPv4Header; -const parseIPv6Address = chef.parseIPv6Address; -const parseUNIXFilePermissions = chef.parseUNIXFilePermissions; -const parseURI = chef.parseURI; -const parseUserAgent = chef.parseUserAgent; -const parseX509Certificate = chef.parseX509Certificate; -const powerSet = chef.powerSet; -const pseudoRandomNumberGenerator = chef.pseudoRandomNumberGenerator; -const RC2Decrypt = chef.RC2Decrypt; -const RC2Encrypt = chef.RC2Encrypt; -const RC4 = chef.RC4; -const RC4Drop = chef.RC4Drop; -const RIPEMD = chef.RIPEMD; -const ROT13 = chef.ROT13; -const ROT47 = chef.ROT47; -const rawDeflate = chef.rawDeflate; -const rawInflate = chef.rawInflate; -const register = chef.register; -const regularExpression = chef.regularExpression; -const removeEXIF = chef.removeEXIF; -const removeLineNumbers = chef.removeLineNumbers; -const removeNullBytes = chef.removeNullBytes; -const removeWhitespace = chef.removeWhitespace; -const renderImage = chef.renderImage; -const Return = chef.Return; -const reverse = chef.reverse; -const rotateLeft = chef.rotateLeft; -const rotateRight = chef.rotateRight; -const SHA0 = chef.SHA0; -const SHA1 = chef.SHA1; -const SHA2 = chef.SHA2; -const SHA3 = chef.SHA3; -const SQLBeautify = chef.SQLBeautify; -const SQLMinify = chef.SQLMinify; -const SSDEEP = chef.SSDEEP; -const SUB = chef.SUB; -const scanForEmbeddedFiles = chef.scanForEmbeddedFiles; -const scrypt = chef.scrypt; -const setDifference = chef.setDifference; -const setIntersection = chef.setIntersection; -const setUnion = chef.setUnion; -const shake = chef.shake; -const showBase64Offsets = chef.showBase64Offsets; -const sleep = chef.sleep; -const snefru = chef.snefru; -const sort = chef.sort; -const split = chef.split; -const standardDeviation = chef.standardDeviation; -const strings = chef.strings; -const stripHTMLTags = chef.stripHTMLTags; -const stripHTTPHeaders = chef.stripHTTPHeaders; -const substitute = chef.substitute; -const subtract = chef.subtract; -const sum = chef.sum; -const swapEndianness = chef.swapEndianness; -const symmetricDifference = chef.symmetricDifference; -const syntaxHighlighter = chef.syntaxHighlighter; -const TCPIPChecksum = chef.TCPIPChecksum; -const tail = chef.tail; -const takeBytes = chef.takeBytes; -const tar = chef.tar; -const toBCD = chef.toBCD; -const toBase = chef.toBase; -const toBase32 = chef.toBase32; -const toBase58 = chef.toBase58; -const toBase64 = chef.toBase64; -const toBinary = chef.toBinary; -const toCamelCase = chef.toCamelCase; -const toCharcode = chef.toCharcode; -const toDecimal = chef.toDecimal; -const toHTMLEntity = chef.toHTMLEntity; -const toHex = chef.toHex; -const toHexContent = chef.toHexContent; -const toHexdump = chef.toHexdump; -const toKebabCase = chef.toKebabCase; -const toLowerCase = chef.toLowerCase; -const toMorseCode = chef.toMorseCode; -const toOctal = chef.toOctal; -const toPunycode = chef.toPunycode; -const toQuotedPrintable = chef.toQuotedPrintable; -const toSnakeCase = chef.toSnakeCase; -const toTable = chef.toTable; -const toUNIXTimestamp = chef.toUNIXTimestamp; -const toUpperCase = chef.toUpperCase; -const translateDateTimeFormat = chef.translateDateTimeFormat; -const tripleDESDecrypt = chef.tripleDESDecrypt; -const tripleDESEncrypt = chef.tripleDESEncrypt; -const UNIXTimestampToWindowsFiletime = chef.UNIXTimestampToWindowsFiletime; -const URLDecode = chef.URLDecode; -const URLEncode = chef.URLEncode; -const unescapeString = chef.unescapeString; -const unescapeUnicodeCharacters = chef.unescapeUnicodeCharacters; -const unique = chef.unique; -const untar = chef.untar; -const unzip = chef.unzip; -const vigenèreDecode = chef.vigenèreDecode; -const vigenèreEncode = chef.vigenèreEncode; -const whirlpool = chef.whirlpool; -const windowsFiletimeToUNIXTimestamp = chef.windowsFiletimeToUNIXTimestamp; -const XKCDRandomNumber = chef.XKCDRandomNumber; -const XMLBeautify = chef.XMLBeautify; -const XMLMinify = chef.XMLMinify; -const XOR = chef.XOR; -const XORBruteForce = chef.XORBruteForce; -const XPathExpression = chef.XPathExpression; -const zip = chef.zip; -const zlibDeflate = chef.zlibDeflate; -const zlibInflate = chef.zlibInflate; - - -// Define array of all operations to create register for bake. -const operations = [ - ADD, - AESDecrypt, - AESEncrypt, - AND, - addLineNumbers, - adler32Checksum, - affineCipherDecode, - affineCipherEncode, - analyseHash, - atbashCipher, - BSONDeserialise, - BSONSerialise, - bcrypt, - bcryptCompare, - bcryptParse, - bifidCipherDecode, - bifidCipherEncode, - bitShiftLeft, - bitShiftRight, - blowfishDecrypt, - blowfishEncrypt, - bzip2Decompress, - CRC16Checksum, - CRC32Checksum, - CSSBeautify, - CSSMinify, - CSSSelector, - CTPH, - cartesianProduct, - changeIPFormat, - chiSquare, - comment, - compareCTPHHashes, - compareSSDEEPHashes, - conditionalJump, - convertArea, - convertDataUnits, - convertDistance, - convertMass, - convertSpeed, - countOccurrences, - DESDecrypt, - DESEncrypt, - decodeNetBIOSName, - decodeText, - deriveEVPKey, - derivePBKDF2Key, - detectFileType, - diff, - disassembleX86, - divide, - dropBytes, - encodeNetBIOSName, - encodeText, - entropy, - escapeString, - escapeUnicodeCharacters, - expandAlphabetRange, - extractDates, - extractDomains, - extractEXIF, - extractEmailAddresses, - extractFilePaths, - extractIPAddresses, - extractMACAddresses, - extractURLs, - filter, - findReplace, - fletcher16Checksum, - fletcher32Checksum, - fletcher64Checksum, - fletcher8Checksum, - fork, - formatMACAddresses, - frequencyDistribution, - fromBCD, - fromBase, - fromBase32, - fromBase58, - fromBase64, - fromBinary, - fromCharcode, - fromDecimal, - fromHTMLEntity, - fromHex, - fromHexContent, - fromHexdump, - fromMorseCode, - fromOctal, - fromPunycode, - fromQuotedPrintable, - fromUNIXTimestamp, - generateAllHashes, - generateHOTP, - generatePGPKeyPair, - generateTOTP, - generateUUID, - genericCodeBeautify, - groupIPAddresses, - gunzip, - gzip, - HAS160, - HMAC, - HTTPRequest, - hammingDistance, - haversineDistance, - head, - hexToObjectIdentifier, - hexToPEM, - JPathExpression, - JSONBeautify, - JSONMinify, - javaScriptBeautify, - javaScriptMinify, - javaScriptParser, - jump, - keccak, - label, - MD2, - MD4, - MD5, - MD6, - magic, - mean, - median, - merge, - microsoftScriptDecoder, - multiply, - NOT, - numberwang, - OR, - objectIdentifierToHex, - offsetChecker, - PEMToHex, - PGPDecrypt, - PGPDecryptAndVerify, - PGPEncrypt, - PGPEncryptAndSign, - PHPDeserialize, - padLines, - parseASN1HexString, - parseColourCode, - parseDateTime, - parseIPRange, - parseIPv4Header, - parseIPv6Address, - parseUNIXFilePermissions, - parseURI, - parseUserAgent, - parseX509Certificate, - powerSet, - pseudoRandomNumberGenerator, - RC2Decrypt, - RC2Encrypt, - RC4, - RC4Drop, - RIPEMD, - ROT13, - ROT47, - rawDeflate, - rawInflate, - register, - regularExpression, - removeEXIF, - removeLineNumbers, - removeNullBytes, - removeWhitespace, - renderImage, - Return, - reverse, - rotateLeft, - rotateRight, - SHA0, - SHA1, - SHA2, - SHA3, - SQLBeautify, - SQLMinify, - SSDEEP, - SUB, - scanForEmbeddedFiles, - scrypt, - setDifference, - setIntersection, - setUnion, - shake, - showBase64Offsets, - sleep, - snefru, - sort, - split, - standardDeviation, - strings, - stripHTMLTags, - stripHTTPHeaders, - substitute, - subtract, - sum, - swapEndianness, - symmetricDifference, - syntaxHighlighter, - TCPIPChecksum, - tail, - takeBytes, - tar, - toBCD, - toBase, - toBase32, - toBase58, - toBase64, - toBinary, - toCamelCase, - toCharcode, - toDecimal, - toHTMLEntity, - toHex, - toHexContent, - toHexdump, - toKebabCase, - toLowerCase, - toMorseCode, - toOctal, - toPunycode, - toQuotedPrintable, - toSnakeCase, - toTable, - toUNIXTimestamp, - toUpperCase, - translateDateTimeFormat, - tripleDESDecrypt, - tripleDESEncrypt, - UNIXTimestampToWindowsFiletime, - URLDecode, - URLEncode, - unescapeString, - unescapeUnicodeCharacters, - unique, - untar, - unzip, - vigenèreDecode, - vigenèreEncode, - whirlpool, - windowsFiletimeToUNIXTimestamp, - XKCDRandomNumber, - XMLBeautify, - XMLMinify, - XOR, - XORBruteForce, - XPathExpression, - zip, - zlibDeflate, - zlibInflate, -]; - -const prebaked = bake(operations); -chef.bake = prebaked; -export default chef; - -// Operations as top level exports. -export { - operations, - ADD, - AESDecrypt, - AESEncrypt, - AND, - addLineNumbers, - adler32Checksum, - affineCipherDecode, - affineCipherEncode, - analyseHash, - atbashCipher, - BSONDeserialise, - BSONSerialise, - bcrypt, - bcryptCompare, - bcryptParse, - bifidCipherDecode, - bifidCipherEncode, - bitShiftLeft, - bitShiftRight, - blowfishDecrypt, - blowfishEncrypt, - bzip2Decompress, - CRC16Checksum, - CRC32Checksum, - CSSBeautify, - CSSMinify, - CSSSelector, - CTPH, - cartesianProduct, - changeIPFormat, - chiSquare, - comment, - compareCTPHHashes, - compareSSDEEPHashes, - conditionalJump, - convertArea, - convertDataUnits, - convertDistance, - convertMass, - convertSpeed, - countOccurrences, - DESDecrypt, - DESEncrypt, - decodeNetBIOSName, - decodeText, - deriveEVPKey, - derivePBKDF2Key, - detectFileType, - diff, - disassembleX86, - divide, - dropBytes, - encodeNetBIOSName, - encodeText, - entropy, - escapeString, - escapeUnicodeCharacters, - expandAlphabetRange, - extractDates, - extractDomains, - extractEXIF, - extractEmailAddresses, - extractFilePaths, - extractIPAddresses, - extractMACAddresses, - extractURLs, - filter, - findReplace, - fletcher16Checksum, - fletcher32Checksum, - fletcher64Checksum, - fletcher8Checksum, - fork, - formatMACAddresses, - frequencyDistribution, - fromBCD, - fromBase, - fromBase32, - fromBase58, - fromBase64, - fromBinary, - fromCharcode, - fromDecimal, - fromHTMLEntity, - fromHex, - fromHexContent, - fromHexdump, - fromMorseCode, - fromOctal, - fromPunycode, - fromQuotedPrintable, - fromUNIXTimestamp, - generateAllHashes, - generateHOTP, - generatePGPKeyPair, - generateTOTP, - generateUUID, - genericCodeBeautify, - groupIPAddresses, - gunzip, - gzip, - HAS160, - HMAC, - HTTPRequest, - hammingDistance, - haversineDistance, - head, - hexToObjectIdentifier, - hexToPEM, - JPathExpression, - JSONBeautify, - JSONMinify, - javaScriptBeautify, - javaScriptMinify, - javaScriptParser, - jump, - keccak, - label, - MD2, - MD4, - MD5, - MD6, - magic, - mean, - median, - merge, - microsoftScriptDecoder, - multiply, - NOT, - numberwang, - OR, - objectIdentifierToHex, - offsetChecker, - PEMToHex, - PGPDecrypt, - PGPDecryptAndVerify, - PGPEncrypt, - PGPEncryptAndSign, - PHPDeserialize, - padLines, - parseASN1HexString, - parseColourCode, - parseDateTime, - parseIPRange, - parseIPv4Header, - parseIPv6Address, - parseUNIXFilePermissions, - parseURI, - parseUserAgent, - parseX509Certificate, - powerSet, - pseudoRandomNumberGenerator, - RC2Decrypt, - RC2Encrypt, - RC4, - RC4Drop, - RIPEMD, - ROT13, - ROT47, - rawDeflate, - rawInflate, - register, - regularExpression, - removeEXIF, - removeLineNumbers, - removeNullBytes, - removeWhitespace, - renderImage, - Return, - reverse, - rotateLeft, - rotateRight, - SHA0, - SHA1, - SHA2, - SHA3, - SQLBeautify, - SQLMinify, - SSDEEP, - SUB, - scanForEmbeddedFiles, - scrypt, - setDifference, - setIntersection, - setUnion, - shake, - showBase64Offsets, - sleep, - snefru, - sort, - split, - standardDeviation, - strings, - stripHTMLTags, - stripHTTPHeaders, - substitute, - subtract, - sum, - swapEndianness, - symmetricDifference, - syntaxHighlighter, - TCPIPChecksum, - tail, - takeBytes, - tar, - toBCD, - toBase, - toBase32, - toBase58, - toBase64, - toBinary, - toCamelCase, - toCharcode, - toDecimal, - toHTMLEntity, - toHex, - toHexContent, - toHexdump, - toKebabCase, - toLowerCase, - toMorseCode, - toOctal, - toPunycode, - toQuotedPrintable, - toSnakeCase, - toTable, - toUNIXTimestamp, - toUpperCase, - translateDateTimeFormat, - tripleDESDecrypt, - tripleDESEncrypt, - UNIXTimestampToWindowsFiletime, - URLDecode, - URLEncode, - unescapeString, - unescapeUnicodeCharacters, - unique, - untar, - unzip, - vigenèreDecode, - vigenèreEncode, - whirlpool, - windowsFiletimeToUNIXTimestamp, - XKCDRandomNumber, - XMLBeautify, - XMLMinify, - XOR, - XORBruteForce, - XPathExpression, - zip, - zlibDeflate, - zlibInflate, - SyncDish as Dish, - prebaked as bake, - help, -}; diff --git a/src/test.mjs b/src/test.mjs deleted file mode 100644 index 7e391efb..00000000 --- a/src/test.mjs +++ /dev/null @@ -1,20 +0,0 @@ -import Dish from "./core/Dish"; - -const a = new Dish(); -const i = "original"; -a.set(i, Dish.STRING); - -console.log(a); - -const b = a.clone(); - -console.log(b); - -console.log("changing a"); - -a.value.toUpperCase(); -// const c = new Uint8Array([1,2,3,4,5,6,7,8,9,0]).buffer; -// a.set(c, Dish.ARRAY_BUFFER); - -console.log(a); -console.log(b); diff --git a/src/web/App.mjs b/src/web/App.mjs index a291aa8b..d001f9e4 100755 --- a/src/web/App.mjs +++ b/src/web/App.mjs @@ -115,7 +115,7 @@ class App { * @param {boolean} [step] - Set to true if we should only execute one operation instead of the * whole recipe. */ - bake(step) { + bake(step=false) { if (this.baking) return; // Reset attemptHighlight flag @@ -533,7 +533,9 @@ class App { compileInfo += " - " + window.compileMessage; } - document.getElementById("notice").innerHTML = compileInfo; + const notice = document.getElementById("notice"); + notice.innerHTML = compileInfo; + notice.setAttribute("title", Utils.stripHtmlTags(window.compileMessage)); } @@ -634,6 +636,7 @@ class App { * @param {event} e */ stateChange(e) { + this.progress = 0; this.autoBake(); // Set title diff --git a/src/web/HTMLOperation.mjs b/src/web/HTMLOperation.mjs index 1a6146e4..5d124708 100755 --- a/src/web/HTMLOperation.mjs +++ b/src/web/HTMLOperation.mjs @@ -26,6 +26,7 @@ class HTMLOperation { this.name = name; this.description = config.description; + this.infoURL = config.infoURL; this.manualBake = config.manualBake || false; this.config = config; this.ingList = []; @@ -46,8 +47,10 @@ class HTMLOperation { let html = "
  • ${titleFromWikiLink(this.infoURL)}` : ""; + html += ` data-container='body' data-toggle='popover' data-placement='right' - data-content="${this.description}" data-html='true' data-trigger='hover' + data-content="${this.description}${infoLink}" data-html='true' data-trigger='hover' data-boundary='viewport'`; } @@ -119,4 +122,23 @@ class HTMLOperation { } + +/** + * Given a URL for a Wikipedia (or other wiki) page, this function returns a link to that page. + * + * @param {string} url + * @returns {string} + */ +function titleFromWikiLink(url) { + const splitURL = url.split("/"); + if (splitURL.indexOf("wiki") < 0) { + // Not a wiki link, return full URL + return `More Informationopen_in_new`; + } + + const pageTitle = decodeURIComponent(splitURL[splitURL.length - 1]) + .replace(/_/g, " "); + return `${pageTitle}open_in_new on Wikipedia`; +} + export default HTMLOperation; diff --git a/src/web/OperationsWaiter.mjs b/src/web/OperationsWaiter.mjs index e0286d42..decc49d6 100755 --- a/src/web/OperationsWaiter.mjs +++ b/src/web/OperationsWaiter.mjs @@ -37,7 +37,7 @@ class OperationsWaiter { searchOperations(e) { let ops, selected; - if (e.type === "search") { // Search + if (e.type === "search" || e.keyCode === 13) { // Search or Return e.preventDefault(); ops = document.querySelectorAll("#search-results li"); if (ops.length) { @@ -48,9 +48,7 @@ class OperationsWaiter { } } - if (e.keyCode === 13) { // Return - e.preventDefault(); - } else if (e.keyCode === 40) { // Down + if (e.keyCode === 40) { // Down e.preventDefault(); ops = document.querySelectorAll("#search-results li"); if (ops.length) { diff --git a/src/web/html/index.html b/src/web/html/index.html index aa13da7c..f03590ab 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -155,7 +155,7 @@ Download CyberChef file_download <% } %> -
    +