mirror of
https://github.com/gchq/CyberChef
synced 2025-12-05 23:53:27 +00:00
Compare commits
82 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
339c741a2c | ||
|
|
d1bde23f00 | ||
|
|
be544faf0f | ||
|
|
eff77fd3bb | ||
|
|
3df57ba3dd | ||
|
|
4bae662357 | ||
|
|
357c90546e | ||
|
|
54769a90ac | ||
|
|
0550aedd54 | ||
|
|
5947ed21fc | ||
|
|
0a0949246f | ||
|
|
09c6e181fb | ||
|
|
02cf394bcd | ||
|
|
46afbf9888 | ||
|
|
7cf19d22a8 | ||
|
|
46d708360f | ||
|
|
7ec91e2366 | ||
|
|
a74ee47bf0 | ||
|
|
7b68b92498 | ||
|
|
274f3acd45 | ||
|
|
53dff8b30f | ||
|
|
9892ee273e | ||
|
|
7dccecb336 | ||
|
|
aa09da0403 | ||
|
|
98d7f1481c | ||
|
|
7d8bdbcf7e | ||
|
|
db009d3689 | ||
|
|
d7bc529a95 | ||
|
|
3f035294a6 | ||
|
|
36282e362f | ||
|
|
223353cf4d | ||
|
|
ded32da632 | ||
|
|
d6fc21cc34 | ||
|
|
b86e960456 | ||
|
|
7747bfe0f2 | ||
|
|
fabea8cc61 | ||
|
|
de4cd2eebc | ||
|
|
e16ce1d9c2 | ||
|
|
345ad741b3 | ||
|
|
e53108c493 | ||
|
|
6129378854 | ||
|
|
11a1416dcc | ||
|
|
9025538544 | ||
|
|
46929e1844 | ||
|
|
bf023cad48 | ||
|
|
f649236bad | ||
|
|
54b1454c0a | ||
|
|
a41b1c2f5e | ||
|
|
0327d7cb7a | ||
|
|
621d7c3683 | ||
|
|
ae7c3fca31 | ||
|
|
1b3295ff59 | ||
|
|
e40e7a0e4e | ||
|
|
cf5fd7cbf2 | ||
|
|
ec37a676a8 | ||
|
|
f33193e122 | ||
|
|
7c40204e4f | ||
|
|
2b2ffb3346 | ||
|
|
39b7e4ff9e | ||
|
|
a1109c43f6 | ||
|
|
e6eafc2843 | ||
|
|
3e8dea73d2 | ||
|
|
bbf19ee944 | ||
|
|
f6c8c9e76c | ||
|
|
9dba1232b7 | ||
|
|
bf14c8983f | ||
|
|
3ab95384df | ||
|
|
953a581a94 | ||
|
|
3bfddd708c | ||
|
|
13a54ec318 | ||
|
|
0b5ee7c79f | ||
|
|
23cbe1c426 | ||
|
|
c9d9730726 | ||
|
|
a380aed878 | ||
|
|
4dafa50799 | ||
|
|
53e69835ff | ||
|
|
939208903a | ||
|
|
123a0ccd70 | ||
|
|
4c737475d4 | ||
|
|
4e0d97f2c1 | ||
|
|
85906cafbb | ||
|
|
a8dc691033 |
54
.github/workflows/master.yml
vendored
Normal file
54
.github/workflows/master.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: Master
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set node version
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '10.x'
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
npm install
|
||||
export NODE_OPTIONS=--max_old_space_size=2048
|
||||
|
||||
- name: Lint
|
||||
run: npx grunt lint
|
||||
|
||||
- name: Unit Tests
|
||||
run: |
|
||||
npm test
|
||||
npx grunt testnodeconsumer
|
||||
|
||||
- name: Production Build
|
||||
if: success()
|
||||
run: npx grunt prod
|
||||
|
||||
- name: Generate sitemap
|
||||
run: npx grunt exec:sitemap
|
||||
|
||||
- name: UI Tests
|
||||
if: success()
|
||||
run: xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
|
||||
|
||||
- name: Prepare for GitHub Pages
|
||||
if: success()
|
||||
run: npx grunt copy:ghPages
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
if: success() && github.ref == 'refs/heads/master'
|
||||
uses: crazy-max/ghaction-github-pages@v2
|
||||
with:
|
||||
target_branch: gh-pages
|
||||
build_dir: ./build/prod
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
55
.github/workflows/releases.yml
vendored
Normal file
55
.github/workflows/releases.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set node version
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '10.x'
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
npm install
|
||||
export NODE_OPTIONS=--max_old_space_size=2048
|
||||
|
||||
- name: Lint
|
||||
run: npx grunt lint
|
||||
|
||||
- name: Unit Tests
|
||||
run: |
|
||||
npm test
|
||||
npx grunt testnodeconsumer
|
||||
|
||||
- name: Production Build
|
||||
if: success()
|
||||
run: npx grunt prod
|
||||
|
||||
- name: UI Tests
|
||||
if: success()
|
||||
run: xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
|
||||
|
||||
- name: Upload Release Assets
|
||||
if: success()
|
||||
id: upload-release-assets
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: build/prod/*.zip
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
file_glob: true
|
||||
|
||||
- name: Publish to NPM
|
||||
if: success()
|
||||
uses: JS-DevTools/npm-publish@v1
|
||||
with:
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
55
.travis.yml
55
.travis.yml
@@ -1,55 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- lts/dubnium
|
||||
cache: npm
|
||||
os: linux
|
||||
addons:
|
||||
chrome: stable
|
||||
install: npm install
|
||||
before_script:
|
||||
- npm install -g grunt
|
||||
- export NODE_OPTIONS=--max_old_space_size=2048
|
||||
script:
|
||||
- grunt lint
|
||||
- npm test
|
||||
- grunt testnodeconsumer
|
||||
- grunt prod --msg="$COMPILE_MSG"
|
||||
- xvfb-run --server-args="-screen 0 1200x800x24" grunt testui
|
||||
before_deploy:
|
||||
- grunt exec:sitemap
|
||||
- grunt copy:ghPages
|
||||
deploy:
|
||||
- provider: pages
|
||||
edge: true
|
||||
token: $GITHUB_TOKEN
|
||||
local_dir: build/prod/
|
||||
target_branch: gh-pages
|
||||
on:
|
||||
repo: gchq/CyberChef
|
||||
branch: master
|
||||
- provider: releases
|
||||
edge: true
|
||||
token:
|
||||
secure: "HV1WSKv4l/0Y2bKKs1iBJocBcmLj08PCRUeEM/jTwA4jqJ8EiLHWiXtER/D5sEg2iibRVKd2OQjfrmS6bo4AiwdeVgAKmv0FtS2Jw+391N8Nd5AkEANHa5Om/IpHLTL2YRAjpJTsDpY72bMUTJIwjQA3TFJkgrpOw6KYfohOcgbxLpZ4XuNJRU3VL4Hsxdv5V9aOVmfFOmMOVPQlakXy7NgtW5POp1f2WJwgcZxylkR1CjwaqMyXmSoVl46pyH3tr5+dptsQoKSGdi6sIHGA60oDotFPcm+0ifa47wZw+vapuuDi4tdNxhrHGaDMG8xiE0WFDHwQUDlk2/+W7j9SEX0H3Em7us371JXRp56EDwEcDa34VpVkC6i8HGcHK55hnxVbMZXGf3qhOFD8wY7qMbjMRvIpucrMHBi86OfkDfv0vDj2LyvIl5APj/AX50BrE0tfH1MZbH26Jkx4NdlkcxQ14GumarmUqfmVvbX/fsoA6oUuAAE9ZgRRi3KHO4wci6KUcRfdm+XOeUkaBFsL86G3EEYIvrtBTuaypdz+Cx7nd1iPZyWMx5Y1gXnVzha4nBdV4+7l9JIsFggD8QVpw2uHXQiS1KXFjOeqA3DBD8tjMB7q26Fl2fD3jkOo4BTbQ2NrRIZUu/iL+fOmMPsyMt2qulB0yaSBCfkbEq8xrUA="
|
||||
file_glob: true
|
||||
file:
|
||||
- build/prod/*.zip
|
||||
- src/node/cjs.js
|
||||
on:
|
||||
repo: gchq/CyberChef
|
||||
tags: true
|
||||
- provider: npm
|
||||
edge: true
|
||||
email: "n1474335@gmail.com"
|
||||
api_token:
|
||||
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
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/83c143a6822e218d5b34
|
||||
on_success: change
|
||||
on_failure: always
|
||||
on_start: never
|
||||
@@ -2,6 +2,9 @@
|
||||
All major and minor version changes will be documented in this file. Details of patch-level version changes can be found in [commit messages](https://github.com/gchq/CyberChef/commits/master).
|
||||
|
||||
|
||||
### [9.21.0] - 2020-06-12
|
||||
- Node API now exports `magic` operation [@d98762625] | [#1049]
|
||||
|
||||
### [9.20.0] - 2020-03-27
|
||||
- 'Parse ObjectID Timestamp' operation added [@dmfj] | [#987]
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ module.exports = function (grunt) {
|
||||
},
|
||||
files: [
|
||||
{
|
||||
src: "build/prod/index.html",
|
||||
src: ["build/prod/index.html"],
|
||||
dest: "build/prod/index.html"
|
||||
}
|
||||
]
|
||||
@@ -324,7 +324,7 @@ module.exports = function (grunt) {
|
||||
},
|
||||
files: [
|
||||
{
|
||||
src: "build/prod/index.html",
|
||||
src: ["build/prod/index.html"],
|
||||
dest: `build/prod/CyberChef_v${pkg.version}.html`
|
||||
}
|
||||
]
|
||||
|
||||
9203
package-lock.json
generated
9203
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
150
package.json
150
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cyberchef",
|
||||
"version": "9.20.7",
|
||||
"version": "9.22.2",
|
||||
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
|
||||
"author": "n1474335 <n1474335@gmail.com>",
|
||||
"homepage": "https://gchq.github.io/CyberChef",
|
||||
@@ -36,124 +36,131 @@
|
||||
"node >= 10"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.7",
|
||||
"@babel/plugin-transform-runtime": "^7.8.3",
|
||||
"@babel/preset-env": "^7.8.7",
|
||||
"autoprefixer": "^9.7.4",
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/plugin-transform-runtime": "^7.12.10",
|
||||
"@babel/preset-env": "^7.12.10",
|
||||
"autoprefixer": "^10.1.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.0",
|
||||
"chromedriver": "^83.0.0",
|
||||
"cli-progress": "^3.6.0",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"chromedriver": "^87.0.4",
|
||||
"cli-progress": "^3.8.2",
|
||||
"colors": "^1.4.0",
|
||||
"copy-webpack-plugin": "^5.1.1",
|
||||
"css-loader": "^3.4.2",
|
||||
"eslint": "^6.8.0",
|
||||
"exports-loader": "^0.7.0",
|
||||
"file-loader": "^6.0.0",
|
||||
"grunt": "^1.1.0",
|
||||
"copy-webpack-plugin": "^7.0.0",
|
||||
"css-loader": "^5.0.1",
|
||||
"eslint": "^7.15.0",
|
||||
"exports-loader": "^1.1.1",
|
||||
"file-loader": "^6.2.0",
|
||||
"grunt": "^1.3.0",
|
||||
"grunt-accessibility": "~6.0.0",
|
||||
"grunt-chmod": "~1.1.1",
|
||||
"grunt-concurrent": "^3.0.0",
|
||||
"grunt-contrib-clean": "~2.0.0",
|
||||
"grunt-contrib-connect": "^2.1.0",
|
||||
"grunt-contrib-connect": "^3.0.0",
|
||||
"grunt-contrib-copy": "~1.0.0",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"grunt-eslint": "^22.0.0",
|
||||
"grunt-eslint": "^23.0.0",
|
||||
"grunt-exec": "~3.0.0",
|
||||
"grunt-webpack": "^3.1.3",
|
||||
"grunt-webpack": "^4.0.2",
|
||||
"grunt-zip": "^0.18.2",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"imports-loader": "^0.8.0",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"nightwatch": "^1.3.5",
|
||||
"node-sass": "^4.13.1",
|
||||
"postcss-css-variables": "^0.14.0",
|
||||
"postcss-import": "^12.0.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"html-webpack-plugin": "^4.5.0",
|
||||
"imports-loader": "^1.2.0",
|
||||
"mini-css-extract-plugin": "^1.3.3",
|
||||
"nightwatch": "^1.5.1",
|
||||
"node-sass": "^5.0.0",
|
||||
"postcss": "^8.2.1",
|
||||
"postcss-css-variables": "^0.17.0",
|
||||
"postcss-import": "^13.0.0",
|
||||
"postcss-loader": "^4.1.0",
|
||||
"prompt": "^1.0.0",
|
||||
"sass-loader": "^8.0.2",
|
||||
"sitemap": "^6.1.0",
|
||||
"style-loader": "^1.1.3",
|
||||
"svg-url-loader": "^5.0.0",
|
||||
"url-loader": "^4.0.0",
|
||||
"webpack": "^4.42.0",
|
||||
"webpack-bundle-analyzer": "^3.6.1",
|
||||
"webpack-dev-server": "^3.10.3",
|
||||
"webpack-node-externals": "^1.7.2",
|
||||
"worker-loader": "^2.0.0"
|
||||
"sass-loader": "^10.1.0",
|
||||
"sitemap": "^6.3.3",
|
||||
"style-loader": "^2.0.0",
|
||||
"svg-url-loader": "^7.1.1",
|
||||
"url-loader": "^4.1.1",
|
||||
"webpack": "^5.10.1",
|
||||
"webpack-bundle-analyzer": "^4.2.0",
|
||||
"webpack-dev-server": "^3.11.0",
|
||||
"webpack-node-externals": "^2.5.2",
|
||||
"worker-loader": "^3.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.8.7",
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"@babel/polyfill": "^7.12.1",
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"arrive": "^2.4.1",
|
||||
"avsc": "^5.4.19",
|
||||
"avsc": "^5.5.3",
|
||||
"babel-plugin-transform-builtin-extend": "1.1.2",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"bignumber.js": "^9.0.0",
|
||||
"bignumber.js": "^9.0.1",
|
||||
"blakejs": "^1.1.0",
|
||||
"bootstrap": "4.5.0",
|
||||
"bootstrap": "4.5.3",
|
||||
"bootstrap-colorpicker": "^3.2.0",
|
||||
"bootstrap-material-design": "^4.1.2",
|
||||
"bson": "^4.0.3",
|
||||
"bootstrap-material-design": "^4.1.3",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"bson": "^4.2.2",
|
||||
"buffer": "^6.0.3",
|
||||
"chi-squared": "^1.1.0",
|
||||
"codepage": "^1.14.0",
|
||||
"core-js": "^3.6.4",
|
||||
"core-js": "^3.8.1",
|
||||
"crypto-api": "^0.8.5",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"crypto-js": "^4.0.0",
|
||||
"ctph.js": "0.0.5",
|
||||
"d3": "^5.15.0",
|
||||
"d3": "^6.3.1",
|
||||
"d3-hexbin": "^0.2.2",
|
||||
"diff": "^4.0.2",
|
||||
"es6-promisify": "^6.1.0",
|
||||
"escodegen": "^1.14.1",
|
||||
"diff": "^5.0.0",
|
||||
"es6-promisify": "^6.1.1",
|
||||
"escodegen": "^2.0.0",
|
||||
"esm": "^3.2.25",
|
||||
"esprima": "^4.0.1",
|
||||
"exif-parser": "^0.1.12",
|
||||
"file-saver": "^2.0.2",
|
||||
"file-saver": "^2.0.5",
|
||||
"geodesy": "^1.1.3",
|
||||
"highlight.js": "^9.18.1",
|
||||
"jimp": "^0.9.5",
|
||||
"jquery": "3.5.0",
|
||||
"highlight.js": "^10.4.1",
|
||||
"jimp": "^0.16.1",
|
||||
"jquery": "3.5.1",
|
||||
"js-crc": "^0.2.0",
|
||||
"js-sha3": "^0.8.0",
|
||||
"jsesc": "^2.5.2",
|
||||
"jsesc": "^3.0.2",
|
||||
"jsonpath": "^1.0.2",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"jsqr": "^1.2.0",
|
||||
"jsrsasign": "8.0.12",
|
||||
"kbpgp": "2.1.13",
|
||||
"jsqr": "^1.3.1",
|
||||
"jsrsasign": "10.1.4",
|
||||
"kbpgp": "2.1.15",
|
||||
"libbzip2-wasm": "0.0.4",
|
||||
"libyara-wasm": "^1.0.1",
|
||||
"lodash": "^4.17.15",
|
||||
"loglevel": "^1.6.7",
|
||||
"libyara-wasm": "^1.1.0",
|
||||
"lodash": "^4.17.20",
|
||||
"loglevel": "^1.7.1",
|
||||
"loglevel-message-prefix": "^3.0.0",
|
||||
"markdown-it": "^10.0.0",
|
||||
"moment": "^2.24.0",
|
||||
"moment-timezone": "^0.5.28",
|
||||
"markdown-it": "^12.0.3",
|
||||
"moment": "^2.29.1",
|
||||
"moment-timezone": "^0.5.32",
|
||||
"ngeohash": "^0.6.3",
|
||||
"node-forge": "^0.9.1",
|
||||
"node-forge": "^0.10.0",
|
||||
"node-md6": "^0.1.0",
|
||||
"nodom": "^2.4.0",
|
||||
"notepack.io": "^2.3.0",
|
||||
"nwmatcher": "^1.4.4",
|
||||
"otp": "^0.1.3",
|
||||
"path": "^0.12.7",
|
||||
"popper.js": "^1.16.1",
|
||||
"process": "^0.11.10",
|
||||
"qr-image": "^3.2.0",
|
||||
"scryptsy": "^2.1.0",
|
||||
"snackbarjs": "^1.1.0",
|
||||
"sortablejs": "^1.10.2",
|
||||
"split.js": "^1.5.11",
|
||||
"sortablejs": "^1.12.0",
|
||||
"split.js": "^1.6.2",
|
||||
"ssdeep.js": "0.0.2",
|
||||
"terser": "^4.3.9",
|
||||
"tesseract.js": "^2.0.2",
|
||||
"ua-parser-js": "^0.7.21",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"terser": "^5.5.1",
|
||||
"tesseract.js": "^2.1.1",
|
||||
"ua-parser-js": "^0.7.23",
|
||||
"unorm": "^1.6.0",
|
||||
"utf8": "^3.0.0",
|
||||
"vkbeautify": "^0.99.3",
|
||||
"xmldom": "^0.3.0",
|
||||
"xpath": "0.0.27",
|
||||
"xregexp": "^4.3.0",
|
||||
"xmldom": "^0.4.0",
|
||||
"xpath": "0.0.32",
|
||||
"xregexp": "^4.4.1",
|
||||
"zlibjs": "^0.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -165,6 +172,7 @@
|
||||
"testui": "grunt testui",
|
||||
"testuidev": "npx nightwatch --env=dev",
|
||||
"lint": "grunt lint",
|
||||
"postinstall": "bash postinstall.sh",
|
||||
"newop": "node --experimental-modules src/core/config/scripts/newOperation.mjs"
|
||||
}
|
||||
}
|
||||
|
||||
8
postinstall.sh
Executable file
8
postinstall.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Add file extensions to Crypto-Api imports
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
find ./node_modules/crypto-api/src/ \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i '' -e '/\.mjs/!s/\(from "\.[^"]*\)";/\1.mjs";/g'
|
||||
else
|
||||
find ./node_modules/crypto-api/src/ \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i -e '/\.mjs/!s/\(from "\.[^"]*\)";/\1.mjs";/g'
|
||||
fi
|
||||
@@ -200,6 +200,7 @@
|
||||
"ops": [
|
||||
"Encode text",
|
||||
"Decode text",
|
||||
"Unicode Text Format",
|
||||
"Remove Diacritics",
|
||||
"Unescape Unicode Characters",
|
||||
"Convert to NATO alphabet"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
const crypto = {};
|
||||
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
|
||||
|
||||
/* dojo-release-1.8.1/dojo/_base/lang.js.uncompressed.js */
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import jsQR from "jsqr";
|
||||
import qr from "qr-image";
|
||||
import jimp from "jimp";
|
||||
import Utils from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Parses a QR code image from an image
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Add Text To Image operation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { Blowfish } from "../lib/Blowfish.mjs";
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { Blowfish } from "../lib/Blowfish.mjs";
|
||||
|
||||
|
||||
@@ -9,8 +9,9 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimp from "jimp";
|
||||
import { gaussianBlur } from "../lib/ImageManipulation.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Blur Image operation
|
||||
|
||||
@@ -21,7 +21,7 @@ class CTPH extends Operation {
|
||||
this.name = "CTPH";
|
||||
this.module = "Crypto";
|
||||
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.<br><br>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.infoURL = "https://forensicswiki.xyz/wiki/index.php?title=Context_Triggered_Piecewise_Hashing";
|
||||
this.inputType = "string";
|
||||
this.outputType = "string";
|
||||
this.args = [];
|
||||
|
||||
@@ -24,7 +24,7 @@ class CompareCTPHHashes extends Operation {
|
||||
this.name = "Compare CTPH hashes";
|
||||
this.module = "Crypto";
|
||||
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.infoURL = "https://forensicswiki.xyz/wiki/index.php?title=Context_Triggered_Piecewise_Hashing";
|
||||
this.inputType = "string";
|
||||
this.outputType = "Number";
|
||||
this.args = [
|
||||
|
||||
@@ -24,7 +24,7 @@ class CompareSSDEEPHashes extends Operation {
|
||||
this.name = "Compare SSDEEP hashes";
|
||||
this.module = "Crypto";
|
||||
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.infoURL = "https://forensicswiki.xyz/wiki/index.php?title=Ssdeep";
|
||||
this.inputType = "string";
|
||||
this.outputType = "Number";
|
||||
this.args = [
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Contain Image operation
|
||||
|
||||
@@ -8,7 +8,8 @@ import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Convert Image Format operation
|
||||
@@ -88,7 +89,7 @@ class ConvertImageFormat extends Operation {
|
||||
"Sub": jimp.PNG_FILTER_SUB,
|
||||
"Up": jimp.PNG_FILTER_UP,
|
||||
"Average": jimp.PNG_FILTER_AVERAGE,
|
||||
"Paeth": jimp.PNG_FILTER_PATH // Incorrect spelling in Jimp library
|
||||
"Paeth": jimp.PNG_FILTER_PATH
|
||||
};
|
||||
|
||||
const mime = formatMap[format];
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Cover Image operation
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Crop Image operation
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
|
||||
/**
|
||||
* DES Decrypt operation
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
|
||||
/**
|
||||
* DES Encrypt operation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
|
||||
/**
|
||||
* Derive PBKDF2 key operation
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Image Dither operation
|
||||
|
||||
@@ -24,7 +24,7 @@ class ExtractFiles extends Operation {
|
||||
this.name = "Extract Files";
|
||||
this.module = "Default";
|
||||
this.description = "Performs file carving to attempt to extract files from the input.<br><br>This operation is currently capable of carving out the following formats:<ul><li>JPG</li><li>EXE</li><li>ZIP</li><li>PDF</li><li>PNG</li><li>BMP</li><li>FLV</li><li>RTF</li><li>DOCX, PPTX, XLSX</li><li>EPUB</li><li>GZIP</li><li>ZLIB</li><li>ELF, BIN, AXF, O, PRX, SO</li></ul>";
|
||||
this.infoURL = "https://forensicswiki.org/wiki/File_Carving";
|
||||
this.infoURL = "https://forensicswiki.xyz/wiki/index.php?title=File_Carving";
|
||||
this.inputType = "ArrayBuffer";
|
||||
this.outputType = "List<File>";
|
||||
this.presentType = "html";
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import { fromBinary } from "../lib/Binary.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Extract LSB operation
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
import {RGBA_DELIM_OPTIONS} from "../lib/Delim.mjs";
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Flip Image operation
|
||||
|
||||
@@ -31,6 +31,11 @@ class FromBinary extends Operation {
|
||||
"name": "Delimiter",
|
||||
"type": "option",
|
||||
"value": BIN_DELIM_OPTIONS
|
||||
},
|
||||
{
|
||||
"name": "Byte Length",
|
||||
"type": "number",
|
||||
"value": 8
|
||||
}
|
||||
];
|
||||
this.checks = [
|
||||
@@ -78,7 +83,8 @@ class FromBinary extends Operation {
|
||||
* @returns {byteArray}
|
||||
*/
|
||||
run(input, args) {
|
||||
return fromBinary(input, args[0]);
|
||||
const byteLen = args[1] ? args[1] : 8;
|
||||
return fromBinary(input, args[0], byteLen);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,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.<br><br>Enter the secret as the input or leave it blank for a random secret to be generated.";
|
||||
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 (OAUTH), and is used in a number of two-factor authentication systems.<br><br>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 = "ArrayBuffer";
|
||||
this.outputType = "string";
|
||||
@@ -59,7 +59,7 @@ class GenerateHOTP extends Operation {
|
||||
name: args[0],
|
||||
keySize: args[1],
|
||||
codeLength: args[2],
|
||||
secret: (new ToBase32).run(input, []),
|
||||
secret: (new ToBase32).run(input, []).split("=")[0],
|
||||
});
|
||||
const counter = args[3];
|
||||
return `URI: ${otpObj.hotpURL}\n\nPassword: ${otpObj.hotp(counter)}`;
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import {isImage} from "../lib/FileType";
|
||||
import {toBase64} from "../lib/Base64";
|
||||
import jimp from "jimp";
|
||||
import {isWorkerEnvironment} from "../Utils";
|
||||
import {isImage} from "../lib/FileType.mjs";
|
||||
import {toBase64} from "../lib/Base64.mjs";
|
||||
import {isWorkerEnvironment} from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Generate Image operation
|
||||
|
||||
@@ -33,7 +33,7 @@ class GeneratePGPKeyPair extends Operation {
|
||||
{
|
||||
"name": "Key type",
|
||||
"type": "option",
|
||||
"value": ["RSA-1024", "RSA-2048", "RSA-4096", "ECC-256", "ECC-384"]
|
||||
"value": ["RSA-1024", "RSA-2048", "RSA-4096", "ECC-256", "ECC-384", "ECC-521"]
|
||||
},
|
||||
{
|
||||
"name": "Password (optional)",
|
||||
@@ -59,12 +59,15 @@ class GeneratePGPKeyPair extends Operation {
|
||||
* @returns {string}
|
||||
*/
|
||||
async run(input, args) {
|
||||
const [keyType, keySize] = args[0].split("-"),
|
||||
password = args[1],
|
||||
let [keyType, keySize] = args[0].split("-");
|
||||
const password = args[1],
|
||||
name = args[2],
|
||||
email = args[3];
|
||||
let userIdentifier = "";
|
||||
|
||||
keyType = keyType.toLowerCase();
|
||||
keySize = parseInt(keySize, 10);
|
||||
|
||||
if (name) userIdentifier += name;
|
||||
if (email) userIdentifier += ` <${email}>`;
|
||||
|
||||
|
||||
@@ -21,7 +21,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.<br><br>Enter the secret as the input or leave it blank for a random secret to be generated. T0 and T1 are in seconds.";
|
||||
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 (OAUTH), and is used in a number of two-factor authentication systems. A TOTP is an HOTP where the counter is the current time.<br><br>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 = "ArrayBuffer";
|
||||
this.outputType = "string";
|
||||
@@ -64,7 +64,7 @@ class GenerateTOTP extends Operation {
|
||||
name: args[0],
|
||||
keySize: args[1],
|
||||
codeLength: args[2],
|
||||
secret: (new ToBase32).run(input, []),
|
||||
secret: (new ToBase32).run(input, []).split("=")[0],
|
||||
epoch: args[3],
|
||||
timeSlice: args[4]
|
||||
});
|
||||
|
||||
@@ -41,8 +41,8 @@ class HaversineDistance extends Operation {
|
||||
|
||||
const lat1 = parseFloat(values[1]);
|
||||
const lng1 = parseFloat(values[3]);
|
||||
const lat2 = parseFloat(values[6]);
|
||||
const lng2 = parseFloat(values[8]);
|
||||
const lat2 = parseFloat(values[5]);
|
||||
const lng2 = parseFloat(values[7]);
|
||||
|
||||
const TO_RAD = Math.PI / 180;
|
||||
const dLat = (lat2-lat1) * TO_RAD;
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Image Brightness / Contrast operation
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Image Filter operation
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Image Hue/Saturation/Lightness operation
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Image Opacity operation
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Invert Image operation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import Operation from "../Operation.mjs";
|
||||
import Terser from "terser";
|
||||
import * as terser from "terser";
|
||||
|
||||
/**
|
||||
* JavaScript Minify operation
|
||||
@@ -32,8 +32,8 @@ class JavaScriptMinify extends Operation {
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*/
|
||||
run(input, args) {
|
||||
const result = Terser.minify(input);
|
||||
async run(input, args) {
|
||||
const result = await terser.minify(input);
|
||||
if (result.error) {
|
||||
throw new OperationError(`Error minifying JavaScript. (${result.error})`);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Normalise Image operation
|
||||
|
||||
@@ -72,7 +72,7 @@ class ParseDateTime extends Operation {
|
||||
"\nLeap year: " + date.isLeapYear() +
|
||||
"\nDays in this month: " + date.daysInMonth() +
|
||||
"\n\nDay of year: " + date.dayOfYear() +
|
||||
"\nWeek number: " + date.weekYear() +
|
||||
"\nWeek number: " + date.week() +
|
||||
"\nQuarter: " + date.quarter();
|
||||
|
||||
return output;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
import BigNumber from "bignumber.js";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
|
||||
/**
|
||||
* RC2 Decrypt operation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,11 @@ class ROT13 extends Operation {
|
||||
type: "boolean",
|
||||
value: true
|
||||
},
|
||||
{
|
||||
name: "Rotate numbers",
|
||||
type: "boolean",
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: "Amount",
|
||||
type: "number",
|
||||
@@ -51,8 +56,9 @@ class ROT13 extends Operation {
|
||||
run(input, args) {
|
||||
const output = input,
|
||||
rot13Lowercase = args[0],
|
||||
rot13Upperacse = args[1];
|
||||
let amount = args[2],
|
||||
rot13Upperacse = args[1],
|
||||
rotNumbers = args[2];
|
||||
let amount = args[3],
|
||||
chr;
|
||||
|
||||
if (amount) {
|
||||
@@ -68,6 +74,9 @@ class ROT13 extends Operation {
|
||||
} else if (rot13Lowercase && chr >= 97 && chr <= 122) { // Lower case
|
||||
chr = (chr - 97 + amount) % 26;
|
||||
output[i] = chr + 97;
|
||||
} else if (rotNumbers && chr >= 48 && chr <= 57) { // Numbers
|
||||
chr = (chr - 48 + amount) % 10;
|
||||
output[i] = chr + 48;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ import Utils from "../Utils.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { runHash } from "../lib/Hash.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Randomize Colour Palette operation
|
||||
|
||||
@@ -19,7 +19,7 @@ class RemoveDiacritics extends Operation {
|
||||
|
||||
this.name = "Remove Diacritics";
|
||||
this.module = "Default";
|
||||
this.description = "Replaces accented characters with their latin character equivalent.";
|
||||
this.description = "Replaces accented characters with their latin character equivalent. Accented characters are made up of Unicode combining characters, so unicode text formatting such as strikethroughs and underlines will also be removed.";
|
||||
this.infoURL = "https://wikipedia.org/wiki/Diacritic";
|
||||
this.inputType = "string";
|
||||
this.outputType = "string";
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Resize Image operation
|
||||
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Rotate Image operation
|
||||
|
||||
@@ -21,7 +21,7 @@ class SSDEEP extends Operation {
|
||||
this.name = "SSDEEP";
|
||||
this.module = "Crypto";
|
||||
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.<br><br>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.<br><br>This operation is fundamentally the same as the CTPH operation, however their outputs differ in format.";
|
||||
this.infoURL = "https://forensicswiki.org/wiki/Ssdeep";
|
||||
this.infoURL = "https://forensicswiki.xyz/wiki/index.php?title=Ssdeep";
|
||||
this.inputType = "string";
|
||||
this.outputType = "string";
|
||||
this.args = [];
|
||||
|
||||
@@ -41,7 +41,7 @@ class ScanForEmbeddedFiles extends Operation {
|
||||
* @returns {string}
|
||||
*/
|
||||
run(input, args) {
|
||||
let output = "Scanning data for 'magic bytes' which may indicate embedded files. The following results may be false positives and should not be treat as reliable. Any sufficiently long file is likely to contain these magic bytes coincidentally.\n",
|
||||
let output = "Scanning data for 'magic bytes' which may indicate embedded files. The following results may be false positives and should not be treated as reliable. Any sufficiently long file is likely to contain these magic bytes coincidentally.\n",
|
||||
numFound = 0;
|
||||
const categories = [],
|
||||
data = new Uint8Array(input);
|
||||
|
||||
@@ -10,7 +10,8 @@ import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { gaussianBlur } from "../lib/ImageManipulation.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Sharpen Image operation
|
||||
|
||||
@@ -8,8 +8,8 @@ import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import {isImage} from "../lib/FileType.mjs";
|
||||
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* Split Colour Channels operation
|
||||
|
||||
@@ -31,6 +31,11 @@ class ToBinary extends Operation {
|
||||
"name": "Delimiter",
|
||||
"type": "option",
|
||||
"value": BIN_DELIM_OPTIONS
|
||||
},
|
||||
{
|
||||
"name": "Byte Length",
|
||||
"type": "number",
|
||||
"value": 8
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -42,7 +47,8 @@ class ToBinary extends Operation {
|
||||
*/
|
||||
run(input, args) {
|
||||
input = new Uint8Array(input);
|
||||
return toBinary(input, args[0]);
|
||||
const padding = args[1] ? args[1] : 8;
|
||||
return toBinary(input, args[0], padding);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
|
||||
/**
|
||||
* Triple DES Decrypt operation
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import forge from "node-forge/dist/forge.min.js";
|
||||
import forge from "node-forge";
|
||||
|
||||
/**
|
||||
* Triple DES Encrypt operation
|
||||
|
||||
@@ -34,7 +34,7 @@ class UNIXTimestampToWindowsFiletime extends Operation {
|
||||
{
|
||||
"name": "Output format",
|
||||
"type": "option",
|
||||
"value": ["Decimal", "Hex"]
|
||||
"value": ["Decimal", "Hex (big endian)", "Hex (little endian)"]
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -65,11 +65,24 @@ class UNIXTimestampToWindowsFiletime extends Operation {
|
||||
|
||||
input = input.plus(new BigNumber("116444736000000000"));
|
||||
|
||||
if (format === "Hex") {
|
||||
return input.toString(16);
|
||||
let result;
|
||||
if (format.startsWith("Hex")) {
|
||||
result = input.toString(16);
|
||||
} else {
|
||||
return input.toFixed();
|
||||
result = input.toFixed();
|
||||
}
|
||||
|
||||
if (format === "Hex (little endian)") {
|
||||
// Swap endianness
|
||||
let flipped = "";
|
||||
for (let i = result.length - 2; i >= 0; i -= 2) {
|
||||
flipped += result.charAt(i);
|
||||
flipped += result.charAt(i + 1);
|
||||
}
|
||||
result = flipped;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
67
src/core/operations/UnicodeTextFormat.mjs
Normal file
67
src/core/operations/UnicodeTextFormat.mjs
Normal file
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @author Matt C [me@mitt.dev]
|
||||
* @copyright Crown Copyright 2020
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
|
||||
/**
|
||||
* Unicode Text Format operation
|
||||
*/
|
||||
class UnicodeTextFormat extends Operation {
|
||||
|
||||
/**
|
||||
* UnicodeTextFormat constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "Unicode Text Format";
|
||||
this.module = "Default";
|
||||
this.description = "Adds Unicode combining characters to change formatting of plaintext.";
|
||||
this.infoURL = "https://wikipedia.org/wiki/Combining_character";
|
||||
this.inputType = "byteArray";
|
||||
this.outputType = "byteArray";
|
||||
this.args = [
|
||||
{
|
||||
name: "Underline",
|
||||
type: "boolean",
|
||||
value: "false"
|
||||
},
|
||||
{
|
||||
name: "Strikethrough",
|
||||
type: "boolean",
|
||||
value: "false"
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {byteArray} input
|
||||
* @param {Object[]} args
|
||||
* @returns {byteArray}
|
||||
*/
|
||||
run(input, args) {
|
||||
const [underline, strikethrough] = args;
|
||||
let output = input.map(char => [char]);
|
||||
if (strikethrough) {
|
||||
output = output.map(charFormat => {
|
||||
charFormat.push(...Utils.strToUtf8ByteArray("\u0336"));
|
||||
return charFormat;
|
||||
});
|
||||
}
|
||||
if (underline) {
|
||||
output = output.map(charFormat => {
|
||||
charFormat.push(...Utils.strToUtf8ByteArray("\u0332"));
|
||||
return charFormat;
|
||||
});
|
||||
}
|
||||
// return output.flat(); - Not supported in Node 10, polyfilled
|
||||
return [].concat(...output);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default UnicodeTextFormat;
|
||||
@@ -9,7 +9,8 @@ import OperationError from "../errors/OperationError.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
|
||||
/**
|
||||
* View Bit Plane operation
|
||||
|
||||
@@ -34,7 +34,7 @@ class WindowsFiletimeToUNIXTimestamp extends Operation {
|
||||
{
|
||||
"name": "Input format",
|
||||
"type": "option",
|
||||
"value": ["Decimal", "Hex"]
|
||||
"value": ["Decimal", "Hex (big endian)", "Hex (little endian)"]
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -49,7 +49,17 @@ class WindowsFiletimeToUNIXTimestamp extends Operation {
|
||||
|
||||
if (!input) return "";
|
||||
|
||||
if (format === "Hex") {
|
||||
if (format === "Hex (little endian)") {
|
||||
// Swap endianness
|
||||
let result = "";
|
||||
for (let i = input.length - 2; i >= 0; i -= 2) {
|
||||
result += input.charAt(i);
|
||||
result += input.charAt(i + 1);
|
||||
}
|
||||
input = result;
|
||||
}
|
||||
|
||||
if (format.startsWith("Hex")) {
|
||||
input = new BigNumber(input, 16);
|
||||
} else {
|
||||
input = new BigNumber(input);
|
||||
|
||||
@@ -50,7 +50,19 @@ class XPathExpression extends Operation {
|
||||
|
||||
let doc;
|
||||
try {
|
||||
doc = new xmldom.DOMParser().parseFromString(input, "application/xml");
|
||||
doc = new xmldom.DOMParser({
|
||||
errorHandler: {
|
||||
warning(w) {
|
||||
throw w;
|
||||
},
|
||||
error(e) {
|
||||
throw e;
|
||||
},
|
||||
fatalError(e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}).parseFromString(input, "application/xml");
|
||||
} catch (err) {
|
||||
throw new OperationError("Invalid input XML.");
|
||||
}
|
||||
|
||||
@@ -24,20 +24,30 @@ class NodeRecipe {
|
||||
|
||||
|
||||
/**
|
||||
* Validate an ingredient $ coerce to operation if necessary.
|
||||
* Validate an ingredient & coerce to operation if necessary.
|
||||
* @param {String | Function | Object} ing
|
||||
* @returns {Function || Object} The operation, or an object with the
|
||||
* operation and its arguments
|
||||
* @throws {TypeError} If it cannot find the operation in chef's list of operations.
|
||||
*/
|
||||
_validateIngredient(ing) {
|
||||
// CASE operation name given. Find operation and validate
|
||||
if (typeof ing === "string") {
|
||||
const op = operations.find((op) => {
|
||||
return sanitise(op.opName) === sanitise(ing);
|
||||
});
|
||||
if (op) {
|
||||
return op;
|
||||
// Need to validate against case 2
|
||||
return this._validateIngredient(op);
|
||||
} else {
|
||||
throw new TypeError(`Couldn't find an operation with name '${ing}'.`);
|
||||
}
|
||||
// CASE operation given. Check its a chef operation and check its not flowcontrol
|
||||
} else if (typeof ing === "function") {
|
||||
if (ing.flowControl) {
|
||||
throw new TypeError(`flowControl operations like ${ing.opName} are not currently allowed in recipes for chef.bake in the Node API`);
|
||||
}
|
||||
|
||||
if (operations.includes(ing)) {
|
||||
return ing;
|
||||
} else {
|
||||
@@ -57,7 +67,7 @@ class NodeRecipe {
|
||||
|
||||
|
||||
/**
|
||||
* Parse config for recipe.
|
||||
* Parse an opList from a recipeConfig and assign it to the recipe's opList.
|
||||
* @param {String | Function | String[] | Function[] | [String | Function]} recipeConfig
|
||||
*/
|
||||
_parseConfig(recipeConfig) {
|
||||
|
||||
@@ -177,6 +177,7 @@ export function _wrap(OpClass) {
|
||||
// Check to see if class's run function is async.
|
||||
const opInstance = new OpClass();
|
||||
const isAsync = opInstance.run.constructor.name === "AsyncFunction";
|
||||
const isFlowControl = opInstance.flowControl;
|
||||
|
||||
let wrapped;
|
||||
|
||||
@@ -191,7 +192,28 @@ export function _wrap(OpClass) {
|
||||
*/
|
||||
wrapped = async (input, args=null) => {
|
||||
const {transformedInput, transformedArgs} = prepareOp(opInstance, input, args);
|
||||
|
||||
// SPECIAL CASE for Magic. Other flowControl operations will
|
||||
// not work because the opList is not passed in.
|
||||
if (isFlowControl) {
|
||||
opInstance.ingValues = transformedArgs;
|
||||
|
||||
const state = {
|
||||
progress: 0,
|
||||
dish: ensureIsDish(transformedInput),
|
||||
opList: [opInstance],
|
||||
};
|
||||
|
||||
const updatedState = await opInstance.run(state);
|
||||
|
||||
return new NodeDish({
|
||||
value: updatedState.dish.value,
|
||||
type: opInstance.outputType,
|
||||
});
|
||||
}
|
||||
|
||||
const result = await opInstance.run(transformedInput, transformedArgs);
|
||||
|
||||
return new NodeDish({
|
||||
value: result,
|
||||
type: opInstance.outputType,
|
||||
@@ -218,6 +240,8 @@ export function _wrap(OpClass) {
|
||||
// used in chef.help
|
||||
wrapped.opName = OpClass.name;
|
||||
wrapped.args = createArgInfo(opInstance);
|
||||
// Used in NodeRecipe to check for flowControl ops
|
||||
wrapped.flowControl = isFlowControl;
|
||||
|
||||
return wrapped;
|
||||
}
|
||||
@@ -292,25 +316,18 @@ export function help(input) {
|
||||
|
||||
|
||||
/**
|
||||
* bake [Wrapped] - Perform an array of operations on some input.
|
||||
* @returns {Function}
|
||||
* bake
|
||||
*
|
||||
* @param {*} input - some input for a recipe.
|
||||
* @param {String | Function | String[] | Function[] | [String | Function]} recipeConfig -
|
||||
* An operation, operation name, or an array of either.
|
||||
* @returns {NodeDish} of the result
|
||||
* @throws {TypeError} if invalid recipe given.
|
||||
*/
|
||||
export function bake() {
|
||||
|
||||
/**
|
||||
* bake
|
||||
*
|
||||
* @param {*} input - some input for a recipe.
|
||||
* @param {String | Function | String[] | Function[] | [String | Function]} recipeConfig -
|
||||
* An operation, operation name, or an array of either.
|
||||
* @returns {SyncDish} of the result
|
||||
* @throws {TypeError} if invalid recipe given.
|
||||
*/
|
||||
return function(input, recipeConfig) {
|
||||
const recipe = new NodeRecipe(recipeConfig);
|
||||
const dish = ensureIsDish(input);
|
||||
return recipe.execute(dish);
|
||||
};
|
||||
export function bake(input, recipeConfig) {
|
||||
const recipe = new NodeRecipe(recipeConfig);
|
||||
const dish = ensureIsDish(input);
|
||||
return recipe.execute(dish);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -100,8 +100,7 @@ Object.keys(operations).forEach((op) => {
|
||||
|
||||
code += `];
|
||||
|
||||
const prebaked = bake(operations);
|
||||
chef.bake = prebaked;
|
||||
chef.bake = bake;
|
||||
export default chef;
|
||||
|
||||
// Operations as top level exports.
|
||||
@@ -114,7 +113,7 @@ Object.keys(operations).forEach((op) => {
|
||||
});
|
||||
|
||||
code += " NodeDish as Dish,\n";
|
||||
code += " prebaked as bake,\n";
|
||||
code += " bake,\n";
|
||||
code += " help,\n";
|
||||
code += " OperationError,\n";
|
||||
code += " ExcludedOperationError,\n";
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import Utils, { debounce } from "../core/Utils";
|
||||
import {fromBase64} from "../core/lib/Base64";
|
||||
import Manager from "./Manager";
|
||||
import HTMLCategory from "./HTMLCategory";
|
||||
import HTMLOperation from "./HTMLOperation";
|
||||
import Utils, { debounce } from "../core/Utils.mjs";
|
||||
import {fromBase64} from "../core/lib/Base64.mjs";
|
||||
import Manager from "./Manager.mjs";
|
||||
import HTMLCategory from "./HTMLCategory.mjs";
|
||||
import HTMLOperation from "./HTMLOperation.mjs";
|
||||
import Split from "split.js";
|
||||
import moment from "moment-timezone";
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
<svg version="1.2" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
x="0px" y="0px" width="550px" height="350px" viewBox="0 0 550 350" xml:space="preserve" onload="setup(evt)">
|
||||
<script type="text/ecmascript">
|
||||
// <![CDATA[
|
||||
<![CDATA[
|
||||
function setup(evt) {
|
||||
const allRotors = evt.target.ownerDocument.querySelectorAll('.rotor');
|
||||
const rotors = [];
|
||||
const initTime = Date.now();
|
||||
const tick = 360/26;
|
||||
const speed = 1000; // Time for one full rotation of the fast rotor
|
||||
const speed = 1000; /* Time for one full rotation of the fast rotor */
|
||||
|
||||
for (const rotor of allRotors) {
|
||||
const row = parseInt(rotor.classList.value.match(/row(\d)/)[1], 10);
|
||||
@@ -46,13 +46,13 @@
|
||||
rotor.last = rotor.last + rotor.wait * numTicks;
|
||||
rotor.el.setAttribute("transform", "rotate(" + rotor.pos + ", " + rotor.x + ", " + rotor.y + ")");
|
||||
} else {
|
||||
// Don't bother looking at the rest
|
||||
/* Don't bother looking at the rest */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, speed/26/1.5 - 5);
|
||||
}
|
||||
// ]]>
|
||||
]]>
|
||||
</script>
|
||||
<style>
|
||||
.row0 {--primary-color: #e5d41b;}
|
||||
|
||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
@@ -4,7 +4,7 @@
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import ChefWorker from "worker-loader?inline&fallback=false!../../core/ChefWorker.js";
|
||||
import ChefWorker from "worker-loader?inline=no-fallback!../../core/ChefWorker.js";
|
||||
|
||||
/**
|
||||
* Waiter to handle conversations with a ChefWorker in the background.
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import LoaderWorker from "worker-loader?inline&fallback=false!../workers/LoaderWorker.js";
|
||||
import InputWorker from "worker-loader?inline&fallback=false!../workers/InputWorker.mjs";
|
||||
import LoaderWorker from "worker-loader?inline=no-fallback!../workers/LoaderWorker.js";
|
||||
import InputWorker from "worker-loader?inline=no-fallback!../workers/InputWorker.mjs";
|
||||
import Utils, { debounce } from "../../core/Utils.mjs";
|
||||
import { toBase64 } from "../../core/lib/Base64.mjs";
|
||||
import { isImage } from "../../core/lib/FileType.mjs";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import Utils, { debounce } from "../../core/Utils.mjs";
|
||||
import Dish from "../../core/Dish.mjs";
|
||||
import FileSaver from "file-saver";
|
||||
import ZipWorker from "worker-loader?inline&fallback=false!../workers/ZipWorker.mjs";
|
||||
import ZipWorker from "worker-loader?inline=no-fallback!../workers/ZipWorker.mjs";
|
||||
|
||||
/**
|
||||
* Waiter to handle events related to the output
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import ChefWorker from "worker-loader?inline&fallback=false!../../core/ChefWorker.js";
|
||||
import DishWorker from "worker-loader?inline&fallback=false!../workers/DishWorker.mjs";
|
||||
import ChefWorker from "worker-loader?inline=no-fallback!../../core/ChefWorker.js";
|
||||
import DishWorker from "worker-loader?inline=no-fallback!../workers/DishWorker.mjs";
|
||||
import { debounce } from "../../core/Utils.mjs";
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
before: browser => {
|
||||
browser
|
||||
|
||||
417
tests/browser/ops.js
Normal file
417
tests/browser/ops.js
Normal file
@@ -0,0 +1,417 @@
|
||||
/**
|
||||
* Tests for operations to ensure they output something sensible where expected
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2021
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
before: browser => {
|
||||
browser
|
||||
.resizeWindow(1280, 800)
|
||||
.url(browser.launchUrl)
|
||||
.useCss()
|
||||
.waitForElementNotPresent("#preloader", 10000)
|
||||
.click("#auto-bake-label");
|
||||
},
|
||||
|
||||
"Sanity check operations": browser => {
|
||||
testOp(browser, "A1Z26 Cipher Decode", "20 5 19 20 15 21 20 16 21 20", "testoutput");
|
||||
testOp(browser, "A1Z26 Cipher Encode", "test input", "20 5 19 20 9 14 16 21 20");
|
||||
testOp(browser, "ADD", "test input", "Ê»ÉÊv¿ÄÆËÊ", [{ "option": "Hex", "string": "56" }]);
|
||||
testOp(browser, "AES Decrypt", "b443f7f7c16ac5396a34273f6f639caa", "test output", [{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" }, { "option": "Hex", "string": "00000000000000000000000000000000" }, "CBC", "Hex", "Raw", { "option": "Hex", "string": "" }]);
|
||||
testOp(browser, "AES Encrypt", "test input", "e42eb8fbfb7a98fff061cd2c1a794d92", [{"option": "Hex", "string": "00112233445566778899aabbccddeeff"}, {"option": "Hex", "string": "00000000000000000000000000000000"}, "CBC", "Raw", "Hex"]);
|
||||
testOp(browser, "AND", "test input", "4$04 $044", [{ "option": "Hex", "string": "34" }]);
|
||||
testOp(browser, "Add line numbers", "test input", "1 test input");
|
||||
// testOp(browser, "Add Text To Image", "test input", "test_output");
|
||||
testOp(browser, "Adler-32 Checksum", "test input", "16160411");
|
||||
testOp(browser, "Affine Cipher Decode", "test input", "rcqr glnsr", [1, 2]);
|
||||
testOp(browser, "Affine Cipher Encode", "test input", "njln rbfpn", [2, 1]);
|
||||
testOp(browser, "Analyse hash", "0123456789abcdef", /CRC-64/);
|
||||
testOp(browser, "Atbash Cipher", "test input", "gvhg rmkfg");
|
||||
// testOp(browser, "Avro to JSON", "test input", "test_output");
|
||||
// testOp(browser, "BLAKE2b", "test input", "test_output");
|
||||
// testOp(browser, "BLAKE2s", "test input", "test_output");
|
||||
// testOp(browser, "BSON deserialise", "test input", "test_output");
|
||||
// testOp(browser, "BSON serialise", "test input", "test_output");
|
||||
// testOp(browser, "Bacon Cipher Decode", "test input", "test_output");
|
||||
// testOp(browser, "Bacon Cipher Encode", "test input", "test_output");
|
||||
// testOp(browser, "Bcrypt", "test input", "test_output");
|
||||
// testOp(browser, "Bcrypt compare", "test input", "test_output");
|
||||
// testOp(browser, "Bcrypt parse", "test input", "test_output");
|
||||
// testOp(browser, "Bifid Cipher Decode", "test input", "test_output");
|
||||
// testOp(browser, "Bifid Cipher Encode", "test input", "test_output");
|
||||
// testOp(browser, "Bit shift left", "test input", "test_output");
|
||||
// testOp(browser, "Bit shift right", "test input", "test_output");
|
||||
// testOp(browser, "Blowfish Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "Blowfish Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "Blur Image", "test input", "test_output");
|
||||
// testOp(browser, "Bombe", "test input", "test_output");
|
||||
// testOp(browser, "Bzip2 Compress", "test input", "test_output");
|
||||
// testOp(browser, "Bzip2 Decompress", "test input", "test_output");
|
||||
// testOp(browser, "CRC-16 Checksum", "test input", "test_output");
|
||||
// testOp(browser, "CRC-32 Checksum", "test input", "test_output");
|
||||
// testOp(browser, "CRC-8 Checksum", "test input", "test_output");
|
||||
// testOp(browser, "CSS Beautify", "test input", "test_output");
|
||||
// testOp(browser, "CSS Minify", "test input", "test_output");
|
||||
// testOp(browser, "CSS selector", "test input", "test_output");
|
||||
// testOp(browser, "CSV to JSON", "test input", "test_output");
|
||||
// testOp(browser, "CTPH", "test input", "test_output");
|
||||
// testOp(browser, "Cartesian Product", "test input", "test_output");
|
||||
// testOp(browser, "Change IP format", "test input", "test_output");
|
||||
// testOp(browser, "Chi Square", "test input", "test_output");
|
||||
// testOp(browser, "CipherSaber2 Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "CipherSaber2 Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "Citrix CTX1 Decode", "test input", "test_output");
|
||||
// testOp(browser, "Citrix CTX1 Encode", "test input", "test_output");
|
||||
// testOp(browser, "Colossus", "test input", "test_output");
|
||||
// testOp(browser, "Comment", "test input", "test_output");
|
||||
// testOp(browser, "Compare CTPH hashes", "test input", "test_output");
|
||||
// testOp(browser, "Compare SSDEEP hashes", "test input", "test_output");
|
||||
// testOp(browser, "Conditional Jump", "test input", "test_output");
|
||||
// testOp(browser, "Contain Image", "test input", "test_output");
|
||||
// testOp(browser, "Convert area", "test input", "test_output");
|
||||
// testOp(browser, "Convert co-ordinate format", "test input", "test_output");
|
||||
// testOp(browser, "Convert data units", "test input", "test_output");
|
||||
// testOp(browser, "Convert distance", "test input", "test_output");
|
||||
// testOp(browser, "Convert Image Format", "test input", "test_output");
|
||||
// testOp(browser, "Convert mass", "test input", "test_output");
|
||||
// testOp(browser, "Convert speed", "test input", "test_output");
|
||||
// testOp(browser, "Convert to NATO alphabet", "test input", "test_output");
|
||||
// testOp(browser, "Count occurrences", "test input", "test_output");
|
||||
// testOp(browser, "Cover Image", "test input", "test_output");
|
||||
// testOp(browser, "Crop Image", "test input", "test_output");
|
||||
// testOp(browser, "DES Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "DES Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "DNS over HTTPS", "test input", "test_output");
|
||||
// testOp(browser, "Dechunk HTTP response", "test input", "test_output");
|
||||
// testOp(browser, "Decode NetBIOS Name", "test input", "test_output");
|
||||
// testOp(browser, "Decode text", "test input", "test_output");
|
||||
// testOp(browser, "Defang IP Addresses", "test input", "test_output");
|
||||
// testOp(browser, "Defang URL", "test input", "test_output");
|
||||
// testOp(browser, "Derive EVP key", "test input", "test_output");
|
||||
// testOp(browser, "Derive PBKDF2 key", "test input", "test_output");
|
||||
// testOp(browser, "Detect File Type", "test input", "test_output");
|
||||
// testOp(browser, "Diff", "test input", "test_output");
|
||||
// testOp(browser, "Disassemble x86", "test input", "test_output");
|
||||
// testOp(browser, "Dither Image", "test input", "test_output");
|
||||
// testOp(browser, "Divide", "test input", "test_output");
|
||||
// testOp(browser, "Drop bytes", "test input", "test_output");
|
||||
// testOp(browser, "Encode NetBIOS Name", "test input", "test_output");
|
||||
// testOp(browser, "Encode text", "test input", "test_output");
|
||||
// testOp(browser, "Enigma", "test input", "test_output");
|
||||
// testOp(browser, "Entropy", "test input", "test_output");
|
||||
// testOp(browser, "Escape string", "test input", "test_output");
|
||||
// testOp(browser, "Escape Unicode Characters", "test input", "test_output");
|
||||
// testOp(browser, "Expand alphabet range", "test input", "test_output");
|
||||
// testOp(browser, "Extract dates", "test input", "test_output");
|
||||
// testOp(browser, "Extract domains", "test input", "test_output");
|
||||
// testOp(browser, "Extract EXIF", "test input", "test_output");
|
||||
// testOp(browser, "Extract email addresses", "test input", "test_output");
|
||||
// testOp(browser, "Extract file paths", "test input", "test_output");
|
||||
// testOp(browser, "Extract Files", "test input", "test_output");
|
||||
// testOp(browser, "Extract IP addresses", "test input", "test_output");
|
||||
// testOp(browser, "Extract LSB", "test input", "test_output");
|
||||
// testOp(browser, "Extract MAC addresses", "test input", "test_output");
|
||||
// testOp(browser, "Extract RGBA", "test input", "test_output");
|
||||
// testOp(browser, "Extract URLs", "test input", "test_output");
|
||||
// testOp(browser, "Filter", "test input", "test_output");
|
||||
// testOp(browser, "Find / Replace", "test input", "test_output");
|
||||
// testOp(browser, "Fletcher-16 Checksum", "test input", "test_output");
|
||||
// testOp(browser, "Fletcher-32 Checksum", "test input", "test_output");
|
||||
// testOp(browser, "Fletcher-64 Checksum", "test input", "test_output");
|
||||
// testOp(browser, "Fletcher-8 Checksum", "test input", "test_output");
|
||||
// testOp(browser, "Flip Image", "test input", "test_output");
|
||||
// testOp(browser, "Fork", "test input", "test_output");
|
||||
// testOp(browser, "Format MAC addresses", "test input", "test_output");
|
||||
// testOp(browser, "Frequency distribution", "test input", "test_output");
|
||||
// testOp(browser, "From BCD", "test input", "test_output");
|
||||
// testOp(browser, "From Base", "test input", "test_output");
|
||||
// testOp(browser, "From Base32", "test input", "test_output");
|
||||
// testOp(browser, "From Base58", "test input", "test_output");
|
||||
// testOp(browser, "From Base62", "test input", "test_output");
|
||||
// testOp(browser, "From Base64", "test input", "test_output");
|
||||
// testOp(browser, "From Base85", "test input", "test_output");
|
||||
// testOp(browser, "From Binary", "test input", "test_output");
|
||||
// testOp(browser, "From Braille", "test input", "test_output");
|
||||
// testOp(browser, "From Case Insensitive Regex", "test input", "test_output");
|
||||
// testOp(browser, "From Charcode", "test input", "test_output");
|
||||
// testOp(browser, "From Decimal", "test input", "test_output");
|
||||
// testOp(browser, "From HTML Entity", "test input", "test_output");
|
||||
// testOp(browser, "From Hex", "test input", "test_output");
|
||||
// testOp(browser, "From Hex Content", "test input", "test_output");
|
||||
// testOp(browser, "From Hexdump", "test input", "test_output");
|
||||
// testOp(browser, "From MessagePack", "test input", "test_output");
|
||||
// testOp(browser, "From Morse Code", "test input", "test_output");
|
||||
// testOp(browser, "From Octal", "test input", "test_output");
|
||||
// testOp(browser, "From Punycode", "test input", "test_output");
|
||||
// testOp(browser, "From Quoted Printable", "test input", "test_output");
|
||||
// testOp(browser, "From UNIX Timestamp", "test input", "test_output");
|
||||
// testOp(browser, "GOST hash", "test input", "test_output");
|
||||
// testOp(browser, "Generate all hashes", "test input", "test_output");
|
||||
// testOp(browser, "Generate HOTP", "test input", "test_output");
|
||||
// testOp(browser, "Generate Image", "test input", "test_output");
|
||||
// testOp(browser, "Generate Lorem Ipsum", "test input", "test_output");
|
||||
// testOp(browser, "Generate PGP Key Pair", "test input", "test_output");
|
||||
// testOp(browser, "Generate QR Code", "test input", "test_output");
|
||||
// testOp(browser, "Generate TOTP", "test input", "test_output");
|
||||
// testOp(browser, "Generate UUID", "test input", "test_output");
|
||||
// testOp(browser, "Generic Code Beautify", "test input", "test_output");
|
||||
// testOp(browser, "Group IP addresses", "test input", "test_output");
|
||||
// testOp(browser, "Gunzip", "test input", "test_output");
|
||||
// testOp(browser, "Gzip", "test input", "test_output");
|
||||
// testOp(browser, "HAS-160", "test input", "test_output");
|
||||
// testOp(browser, "HMAC", "test input", "test_output");
|
||||
// testOp(browser, "HTML To Text", "test input", "test_output");
|
||||
// testOp(browser, "HTTP request", "test input", "test_output");
|
||||
// testOp(browser, "Hamming Distance", "test input", "test_output");
|
||||
// testOp(browser, "Haversine distance", "test input", "test_output");
|
||||
// testOp(browser, "Head", "test input", "test_output");
|
||||
// testOp(browser, "Heatmap chart", "test input", "test_output");
|
||||
// testOp(browser, "Hex Density chart", "test input", "test_output");
|
||||
// testOp(browser, "Hex to Object Identifier", "test input", "test_output");
|
||||
// testOp(browser, "Hex to PEM", "test input", "test_output");
|
||||
// testOp(browser, "Image Brightness / Contrast", "test input", "test_output");
|
||||
// testOp(browser, "Image Filter", "test input", "test_output");
|
||||
// testOp(browser, "Image Hue/Saturation/Lightness", "test input", "test_output");
|
||||
// testOp(browser, "Image Opacity", "test input", "test_output");
|
||||
// testOp(browser, "Index of Coincidence", "test input", "test_output");
|
||||
// testOp(browser, "Invert Image", "test input", "test_output");
|
||||
// testOp(browser, "JPath expression", "test input", "test_output");
|
||||
// testOp(browser, "JSON Beautify", "test input", "test_output");
|
||||
// testOp(browser, "JSON Minify", "test input", "test_output");
|
||||
// testOp(browser, "JSON to CSV", "test input", "test_output");
|
||||
// testOp(browser, "JWT Decode", "test input", "test_output");
|
||||
// testOp(browser, "JWT Sign", "test input", "test_output");
|
||||
// testOp(browser, "JWT Verify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Beautify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Minify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Parser", "test input", "test_output");
|
||||
// testOp(browser, "Jump", "test input", "test_output");
|
||||
// testOp(browser, "Keccak", "test input", "test_output");
|
||||
// testOp(browser, "Label", "test input", "test_output");
|
||||
// testOp(browser, "Lorenz", "test input", "test_output");
|
||||
// testOp(browser, "Luhn Checksum", "test input", "test_output");
|
||||
// testOp(browser, "MD2", "test input", "test_output");
|
||||
// testOp(browser, "MD4", "test input", "test_output");
|
||||
// testOp(browser, "MD5", "test input", "test_output");
|
||||
// testOp(browser, "MD6", "test input", "test_output");
|
||||
// testOp(browser, "Magic", "test input", "test_output");
|
||||
// testOp(browser, "Mean", "test input", "test_output");
|
||||
// testOp(browser, "Median", "test input", "test_output");
|
||||
// testOp(browser, "Merge", "test input", "test_output");
|
||||
// testOp(browser, "Microsoft Script Decoder", "test input", "test_output");
|
||||
// testOp(browser, "Multiple Bombe", "test input", "test_output");
|
||||
// testOp(browser, "Multiply", "test input", "test_output");
|
||||
// testOp(browser, "NOT", "test input", "test_output");
|
||||
// testOp(browser, "Normalise Image", "test input", "test_output");
|
||||
// testOp(browser, "Normalise Unicode", "test input", "test_output");
|
||||
// testOp(browser, "Numberwang", "test input", "test_output");
|
||||
// testOp(browser, "OR", "test input", "test_output");
|
||||
// testOp(browser, "Object Identifier to Hex", "test input", "test_output");
|
||||
// testOp(browser, "Offset checker", "test input", "test_output");
|
||||
// testOp(browser, "Optical Character Recognition", "test input", "test_output");
|
||||
// testOp(browser, "PEM to Hex", "test input", "test_output");
|
||||
// testOp(browser, "PGP Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "PGP Decrypt and Verify", "test input", "test_output");
|
||||
// testOp(browser, "PGP Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "PGP Encrypt and Sign", "test input", "test_output");
|
||||
// testOp(browser, "PGP Verify", "test input", "test_output");
|
||||
// testOp(browser, "PHP Deserialize", "test input", "test_output");
|
||||
// testOp(browser, "Pad lines", "test input", "test_output");
|
||||
// testOp(browser, "Parse ASN.1 hex string", "test input", "test_output");
|
||||
// testOp(browser, "Parse colour code", "test input", "test_output");
|
||||
// testOp(browser, "Parse DateTime", "test input", "test_output");
|
||||
// testOp(browser, "Parse IP range", "test input", "test_output");
|
||||
// testOp(browser, "Parse IPv4 header", "test input", "test_output");
|
||||
// testOp(browser, "Parse IPv6 address", "test input", "test_output");
|
||||
// testOp(browser, "Parse ObjectID timestamp", "test input", "test_output");
|
||||
// testOp(browser, "Parse QR Code", "test input", "test_output");
|
||||
// testOp(browser, "Parse SSH Host Key", "test input", "test_output");
|
||||
// testOp(browser, "Parse TLV", "test input", "test_output");
|
||||
// testOp(browser, "Parse UDP", "test input", "test_output");
|
||||
// testOp(browser, "Parse UNIX file permissions", "test input", "test_output");
|
||||
// testOp(browser, "Parse URI", "test input", "test_output");
|
||||
// testOp(browser, "Parse User Agent", "test input", "test_output");
|
||||
// testOp(browser, "Parse X.509 certificate", "test input", "test_output");
|
||||
// testOp(browser, "Play Media", "test input", "test_output");
|
||||
// testOp(browser, "Power Set", "test input", "test_output");
|
||||
// testOp(browser, "Protobuf Decode", "test input", "test_output");
|
||||
// testOp(browser, "Pseudo-Random Number Generator", "test input", "test_output");
|
||||
// testOp(browser, "RC2 Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "RC2 Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "RC4", "test input", "test_output");
|
||||
// testOp(browser, "RC4 Drop", "test input", "test_output");
|
||||
// testOp(browser, "RIPEMD", "test input", "test_output");
|
||||
// testOp(browser, "ROT13", "test input", "test_output");
|
||||
// testOp(browser, "ROT47", "test input", "test_output");
|
||||
// testOp(browser, "Rail Fence Cipher Decode", "test input", "test_output");
|
||||
// testOp(browser, "Rail Fence Cipher Encode", "test input", "test_output");
|
||||
// testOp(browser, "Randomize Colour Palette", "test input", "test_output");
|
||||
// testOp(browser, "Raw Deflate", "test input", "test_output");
|
||||
// testOp(browser, "Raw Inflate", "test input", "test_output");
|
||||
// testOp(browser, "Register", "test input", "test_output");
|
||||
// testOp(browser, "Regular expression", "test input", "test_output");
|
||||
// testOp(browser, "Remove Diacritics", "test input", "test_output");
|
||||
// testOp(browser, "Remove EXIF", "test input", "test_output");
|
||||
// testOp(browser, "Remove line numbers", "test input", "test_output");
|
||||
// testOp(browser, "Remove null bytes", "test input", "test_output");
|
||||
// testOp(browser, "Remove whitespace", "test input", "test_output");
|
||||
// testOp(browser, "Render Image", "test input", "test_output");
|
||||
// testOp(browser, "Render Markdown", "test input", "test_output");
|
||||
// testOp(browser, "Resize Image", "test input", "test_output");
|
||||
// testOp(browser, "Return", "test input", "test_output");
|
||||
// testOp(browser, "Reverse", "test input", "test_output");
|
||||
// testOp(browser, "Rotate Image", "test input", "test_output");
|
||||
// testOp(browser, "Rotate left", "test input", "test_output");
|
||||
// testOp(browser, "Rotate right", "test input", "test_output");
|
||||
// testOp(browser, "SHA0", "test input", "test_output");
|
||||
// testOp(browser, "SHA1", "test input", "test_output");
|
||||
// testOp(browser, "SHA2", "test input", "test_output");
|
||||
// testOp(browser, "SHA3", "test input", "test_output");
|
||||
// testOp(browser, "SQL Beautify", "test input", "test_output");
|
||||
// testOp(browser, "SQL Minify", "test input", "test_output");
|
||||
// testOp(browser, "SSDEEP", "test input", "test_output");
|
||||
// testOp(browser, "SUB", "test input", "test_output");
|
||||
// testOp(browser, "Scan for Embedded Files", "test input", "test_output");
|
||||
// testOp(browser, "Scatter chart", "test input", "test_output");
|
||||
// testOp(browser, "Scrypt", "test input", "test_output");
|
||||
// testOp(browser, "Series chart", "test input", "test_output");
|
||||
// testOp(browser, "Set Difference", "test input", "test_output");
|
||||
// testOp(browser, "Set Intersection", "test input", "test_output");
|
||||
// testOp(browser, "Set Union", "test input", "test_output");
|
||||
// testOp(browser, "Shake", "test input", "test_output");
|
||||
// testOp(browser, "Sharpen Image", "test input", "test_output");
|
||||
// testOp(browser, "Show Base64 offsets", "test input", "test_output");
|
||||
// testOp(browser, "Show on map", "test input", "test_output");
|
||||
// testOp(browser, "Sleep", "test input", "test_output");
|
||||
// testOp(browser, "Snefru", "test input", "test_output");
|
||||
// testOp(browser, "Sort", "test input", "test_output");
|
||||
// testOp(browser, "Split", "test input", "test_output");
|
||||
// testOp(browser, "Split Colour Channels", "test input", "test_output");
|
||||
// testOp(browser, "Standard Deviation", "test input", "test_output");
|
||||
// testOp(browser, "Streebog", "test input", "test_output");
|
||||
// testOp(browser, "Strings", "test input", "test_output");
|
||||
// testOp(browser, "Strip HTML tags", "test input", "test_output");
|
||||
// testOp(browser, "Strip HTTP headers", "test input", "test_output");
|
||||
// testOp(browser, "Subsection", "test input", "test_output");
|
||||
// testOp(browser, "Substitute", "test input", "test_output");
|
||||
// testOp(browser, "Subtract", "test input", "test_output");
|
||||
// testOp(browser, "Sum", "test input", "test_output");
|
||||
// testOp(browser, "Swap endianness", "test input", "test_output");
|
||||
// testOp(browser, "Symmetric Difference", "test input", "test_output");
|
||||
// testOp(browser, "Syntax highlighter", "test input", "test_output");
|
||||
// testOp(browser, "TCP/IP Checksum", "test input", "test_output");
|
||||
// testOp(browser, "Tail", "test input", "test_output");
|
||||
// testOp(browser, "Take bytes", "test input", "test_output");
|
||||
// testOp(browser, "Tar", "test input", "test_output");
|
||||
// testOp(browser, "Text Encoding Brute Force", "test input", "test_output");
|
||||
// testOp(browser, "To BCD", "test input", "test_output");
|
||||
// testOp(browser, "To Base", "test input", "test_output");
|
||||
// testOp(browser, "To Base32", "test input", "test_output");
|
||||
// testOp(browser, "To Base58", "test input", "test_output");
|
||||
// testOp(browser, "To Base62", "test input", "test_output");
|
||||
// testOp(browser, "To Base64", "test input", "test_output");
|
||||
// testOp(browser, "To Base85", "test input", "test_output");
|
||||
// testOp(browser, "To Binary", "test input", "test_output");
|
||||
// testOp(browser, "To Braille", "test input", "test_output");
|
||||
// testOp(browser, "To Camel case", "test input", "test_output");
|
||||
// testOp(browser, "To Case Insensitive Regex", "test input", "test_output");
|
||||
// testOp(browser, "To Charcode", "test input", "test_output");
|
||||
// testOp(browser, "To Decimal", "test input", "test_output");
|
||||
// testOp(browser, "To HTML Entity", "test input", "test_output");
|
||||
// testOp(browser, "To Hex", "test input", "test_output");
|
||||
// testOp(browser, "To Hex Content", "test input", "test_output");
|
||||
// testOp(browser, "To Hexdump", "test input", "test_output");
|
||||
// testOp(browser, "To Kebab case", "test input", "test_output");
|
||||
// testOp(browser, "To Lower case", "test input", "test_output");
|
||||
// testOp(browser, "To MessagePack", "test input", "test_output");
|
||||
// testOp(browser, "To Morse Code", "test input", "test_output");
|
||||
// testOp(browser, "To Octal", "test input", "test_output");
|
||||
// testOp(browser, "To Punycode", "test input", "test_output");
|
||||
// testOp(browser, "To Quoted Printable", "test input", "test_output");
|
||||
// testOp(browser, "To Snake case", "test input", "test_output");
|
||||
// testOp(browser, "To Table", "test input", "test_output");
|
||||
// testOp(browser, "To UNIX Timestamp", "test input", "test_output");
|
||||
// testOp(browser, "To Upper case", "test input", "test_output");
|
||||
// testOp(browser, "Translate DateTime Format", "test input", "test_output");
|
||||
// testOp(browser, "Triple DES Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "Triple DES Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "Typex", "test input", "test_output");
|
||||
// testOp(browser, "UNIX Timestamp to Windows Filetime", "test input", "test_output");
|
||||
// testOp(browser, "URL Decode", "test input", "test_output");
|
||||
// testOp(browser, "URL Encode", "test input", "test_output");
|
||||
// testOp(browser, "Unescape string", "test input", "test_output");
|
||||
// testOp(browser, "Unescape Unicode Characters", "test input", "test_output");
|
||||
// testOp(browser, "Unique", "test input", "test_output");
|
||||
// testOp(browser, "Untar", "test input", "test_output");
|
||||
// testOp(browser, "Unzip", "test input", "test_output");
|
||||
// testOp(browser, "VarInt Decode", "test input", "test_output");
|
||||
// testOp(browser, "VarInt Encode", "test input", "test_output");
|
||||
// testOp(browser, "View Bit Plane", "test input", "test_output");
|
||||
// testOp(browser, "Vigenère Decode", "test input", "test_output");
|
||||
// testOp(browser, "Vigenère Encode", "test input", "test_output");
|
||||
// testOp(browser, "Whirlpool", "test input", "test_output");
|
||||
// testOp(browser, "Windows Filetime to UNIX Timestamp", "test input", "test_output");
|
||||
// testOp(browser, "XKCD Random Number", "test input", "test_output");
|
||||
// testOp(browser, "XML Beautify", "test input", "test_output");
|
||||
// testOp(browser, "XML Minify", "test input", "test_output");
|
||||
// testOp(browser, "XOR", "test input", "test_output");
|
||||
// testOp(browser, "XOR Brute Force", "test input", "test_output");
|
||||
// testOp(browser, "XPath expression", "test input", "test_output");
|
||||
// testOp(browser, "YARA Rules", "test input", "test_output");
|
||||
// testOp(browser, "Zip", "test input", "test_output");
|
||||
// testOp(browser, "Zlib Deflate", "test input", "test_output");
|
||||
// testOp(browser, "Zlib Inflate", "test input", "test_output");
|
||||
},
|
||||
|
||||
|
||||
after: browser => {
|
||||
browser.end();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the current recipe and tests a new operation.
|
||||
*
|
||||
* @param {string} opName
|
||||
* @param {Browser} browser
|
||||
*/
|
||||
function testOp(browser, opName, input, output, args=[]) {
|
||||
|
||||
const recipeConfig = JSON.stringify([{
|
||||
"op": opName,
|
||||
"args": args
|
||||
}]);
|
||||
|
||||
browser
|
||||
.perform(function() {
|
||||
console.log(opName);
|
||||
})
|
||||
.useCss()
|
||||
.click("#clr-recipe")
|
||||
.click("#clr-io")
|
||||
.waitForElementNotPresent("#rec-list li.operation")
|
||||
.expect.element("#input-text").to.have.value.that.equals("");
|
||||
|
||||
browser
|
||||
.urlHash("recipe=" + recipeConfig)
|
||||
.setValue("#input-text", input)
|
||||
.waitForElementPresent("#rec-list li.operation")
|
||||
.expect.element("#input-text").to.have.value.that.equals(input);
|
||||
|
||||
browser
|
||||
.waitForElementVisible("#stale-indicator", 5000)
|
||||
.pause(100)
|
||||
.click("#bake")
|
||||
.pause(100)
|
||||
.waitForElementPresent("#stale-indicator.hidden", 5000)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
if (typeof output === "string") {
|
||||
browser.expect.element("#output-text").to.have.value.that.equals(output);
|
||||
} else if (output instanceof RegExp) {
|
||||
browser.expect.element("#output-text").to.have.value.that.matches(output);
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ class TestRegister {
|
||||
result.status = "passing";
|
||||
} catch (e) {
|
||||
result.status = "erroring";
|
||||
result.output = e.message;
|
||||
result.output = `${e.message}\nError: ${e.stack}`;
|
||||
}
|
||||
|
||||
testResults.push(result);
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
import assert from "assert";
|
||||
import it from "../assertionHandler.mjs";
|
||||
import chef from "../../../src/node/index.mjs";
|
||||
import OperationError from "../../../src/core/errors/OperationError.mjs";
|
||||
import { OperationError, ExcludedOperationError } from "../../../src/core/errors/index.mjs";
|
||||
import NodeDish from "../../../src/node/NodeDish.mjs";
|
||||
|
||||
import { toBase32} from "../../../src/node/index.mjs";
|
||||
import { toBase32, magic} from "../../../src/node/index.mjs";
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addApiTests([
|
||||
@@ -181,22 +181,17 @@ TestRegister.addApiTests([
|
||||
}),
|
||||
|
||||
it("chef.bake: should complain if recipe isnt a valid object", () => {
|
||||
try {
|
||||
chef.bake("some input", 3264);
|
||||
} catch (e) {
|
||||
assert.strictEqual(e.name, "TypeError");
|
||||
assert.strictEqual(e.message, "Recipe can only contain function names or functions");
|
||||
}
|
||||
assert.throws(() => chef.bake("some input", 3264), {
|
||||
name: "TypeError",
|
||||
message: "Recipe can only contain function names or functions"
|
||||
});
|
||||
}),
|
||||
|
||||
it("chef.bake: Should complain if string op is invalid", () => {
|
||||
try {
|
||||
chef.bake("some input", "not a valid operation");
|
||||
assert.fail("Shouldn't be hit");
|
||||
} catch (e) {
|
||||
assert.strictEqual(e.name, "TypeError");
|
||||
assert.strictEqual(e.message, "Couldn't find an operation with name 'not a valid operation'.");
|
||||
}
|
||||
assert.throws(() => chef.bake("some input", "not a valid operation"), {
|
||||
name: "TypeError",
|
||||
message: "Couldn't find an operation with name 'not a valid operation'."
|
||||
});
|
||||
}),
|
||||
|
||||
it("chef.bake: Should take an input and an operation and perform it", () => {
|
||||
@@ -205,13 +200,10 @@ TestRegister.addApiTests([
|
||||
}),
|
||||
|
||||
it("chef.bake: Should complain if an invalid operation is inputted", () => {
|
||||
try {
|
||||
chef.bake("https://google.com/search?q=help", () => {});
|
||||
assert.fail("Shouldn't be hit");
|
||||
} catch (e) {
|
||||
assert.strictEqual(e.name, "TypeError");
|
||||
assert.strictEqual(e.message, "Inputted function not a Chef operation.");
|
||||
}
|
||||
assert.throws(() => chef.bake("https://google.com/search?q=help", () => {}), {
|
||||
name: "TypeError",
|
||||
message: "Inputted function not a Chef operation."
|
||||
});
|
||||
}),
|
||||
|
||||
it("chef.bake: accepts an array of operation names and performs them all in order", () => {
|
||||
@@ -241,12 +233,10 @@ TestRegister.addApiTests([
|
||||
}),
|
||||
|
||||
it("should complain if an invalid operation is inputted as part of array", () => {
|
||||
try {
|
||||
chef.bake("something", [() => {}]);
|
||||
} catch (e) {
|
||||
assert.strictEqual(e.name, "TypeError");
|
||||
assert.strictEqual(e.message, "Inputted function not a Chef operation.");
|
||||
}
|
||||
assert.throws(() => chef.bake("something", [() => {}]), {
|
||||
name: "TypeError",
|
||||
message: "Inputted function not a Chef operation."
|
||||
});
|
||||
}),
|
||||
|
||||
it("chef.bake: should take single JSON object describing op and args OBJ", () => {
|
||||
@@ -275,15 +265,13 @@ TestRegister.addApiTests([
|
||||
}),
|
||||
|
||||
it("chef.bake: should error if op in JSON is not chef op", () => {
|
||||
try {
|
||||
chef.bake("some input", {
|
||||
op: () => {},
|
||||
args: ["Colon"],
|
||||
});
|
||||
} catch (e) {
|
||||
assert.strictEqual(e.name, "TypeError");
|
||||
assert.strictEqual(e.message, "Inputted function not a Chef operation.");
|
||||
}
|
||||
assert.throws(() => chef.bake("some input", {
|
||||
op: () => {},
|
||||
args: ["Colon"],
|
||||
}), {
|
||||
name: "TypeError",
|
||||
message: "Inputted function not a Chef operation."
|
||||
});
|
||||
}),
|
||||
|
||||
it("chef.bake: should take multiple ops in JSON object form, some ops by string", () => {
|
||||
@@ -357,22 +345,38 @@ TestRegister.addApiTests([
|
||||
assert.strictEqual(result.toString(), "begin_something_aaaaaaaaaaaaaa_end_something");
|
||||
}),
|
||||
|
||||
it("Excluded operations: throw a sensible error when you try and call one", () => {
|
||||
try {
|
||||
chef.fork();
|
||||
} catch (e) {
|
||||
assert.strictEqual(e.type, "ExcludedOperationError");
|
||||
assert.strictEqual(e.message, "Sorry, the Fork operation is not available in the Node.js version of CyberChef.");
|
||||
}
|
||||
it("chef.bake: cannot accept flowControl operations in recipe", () => {
|
||||
assert.throws(() => chef.bake("some input", "magic"), {
|
||||
name: "TypeError",
|
||||
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
|
||||
});
|
||||
assert.throws(() => chef.bake("some input", magic), {
|
||||
name: "TypeError",
|
||||
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
|
||||
});
|
||||
assert.throws(() => chef.bake("some input", ["to base 64", "magic"]), {
|
||||
name: "TypeError",
|
||||
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
|
||||
});
|
||||
}),
|
||||
|
||||
it("Excluded operations: throw a sensible error when you try and call one", () => {
|
||||
try {
|
||||
chef.renderImage();
|
||||
} catch (e) {
|
||||
assert.strictEqual(e.type, "ExcludedOperationError");
|
||||
assert.strictEqual(e.message, "Sorry, the RenderImage operation is not available in the Node.js version of CyberChef.");
|
||||
}
|
||||
assert.throws(chef.fork,
|
||||
(err) => {
|
||||
assert(err instanceof ExcludedOperationError);
|
||||
assert.deepEqual(err.message, "Sorry, the Fork operation is not available in the Node.js version of CyberChef.");
|
||||
return true;
|
||||
},
|
||||
"Unexpected error type"
|
||||
);
|
||||
assert.throws(chef.javaScriptBeautify,
|
||||
(err) => {
|
||||
assert(err instanceof ExcludedOperationError);
|
||||
assert.deepEqual(err.message, "Sorry, the JavaScriptBeautify operation is not available in the Node.js version of CyberChef.");
|
||||
return true;
|
||||
},
|
||||
"Unexpected error type"
|
||||
);
|
||||
}),
|
||||
|
||||
it("Operation arguments: should be accessible from operation object if op has array arg", () => {
|
||||
@@ -405,4 +409,5 @@ TestRegister.addApiTests([
|
||||
assert.equal(chef.convertDistance.args.inputUnits.options[0], "Nanometres (nm)");
|
||||
assert.equal(chef.defangURL.args.process.options[1], "Only full URLs");
|
||||
}),
|
||||
|
||||
]);
|
||||
|
||||
@@ -588,7 +588,7 @@ Password: 034148`;
|
||||
const result = await chef.generatePGPKeyPair("Back To the Drawing Board", {
|
||||
keyType: "ECC-256",
|
||||
});
|
||||
assert.strictEqual(result.toString().length, 2007);
|
||||
assert.strictEqual(result.toString().length, 2560);
|
||||
}),
|
||||
|
||||
it("Generate UUID", () => {
|
||||
@@ -640,7 +640,7 @@ WWFkYSBZYWRh\r
|
||||
}),
|
||||
|
||||
it("Parse ASN.1 Hex string", () => {
|
||||
assert.strictEqual(chef.parseASN1HexString(chef.toHex("Mouth-watering")).toString(), "UNKNOWN(4d) 7574682d7761746572696e67\n");
|
||||
assert.strictEqual(chef.parseASN1HexString(chef.toHex("Mouth-watering")).toString(), "UNKNOWN(77) 7574682d7761746572696e67\n");
|
||||
}),
|
||||
|
||||
it("Parse DateTime", () => {
|
||||
@@ -656,7 +656,7 @@ Leap year: false
|
||||
Days in this month: 31
|
||||
|
||||
Day of year: 187
|
||||
Week number: 2001
|
||||
Week number: 27
|
||||
Quarter: 3`;
|
||||
assert.strictEqual(result.toString(), expected);
|
||||
}),
|
||||
@@ -1075,6 +1075,60 @@ ExifImageHeight: 57`);
|
||||
assert.equal(output, res.value);
|
||||
}),
|
||||
|
||||
it("performs MAGIC", async () => {
|
||||
const input = "WUagwsiae6mP8gNtCCLUFpCpCB26RmBDoDD8PacdAmzAzBVjkK2QstFXaKhpC6iUS7RHqXrJtFisoRSgoJ4whjm1arm864qaNq4RcfUmLHrcsAaZc5TXCYifNdgS83gDeejGX46gaiMyuBV6EskHt1scgJ88x2tNSotQDwbGY1mmCob2ARGFvCKYNqiN9ipMq1ZU1mgkdbNuGcb76aRtYWhCGUc8g93UJudhb8htsheZnwTpgqhx83SVJSZXMXUjJT2zmpC7uXWtumqokbdSi88YtkWDAc1Toouh2oH4D4ddmNKJWUDpMwmngUmK14xwmomccPQE9hM172APnSqwxdKQ172RkcAsysnmj5gGtRmVNNh2s359wr6mS2QRP";
|
||||
const depth = 1;
|
||||
|
||||
const res = await chef.magic(input, {
|
||||
depth,
|
||||
});
|
||||
|
||||
// assert against the structure of the output, rather than the values.
|
||||
assert.strictEqual(res.value.length, depth + 1);
|
||||
res.value.forEach(row => {
|
||||
assert.ok(row.recipe);
|
||||
assert.ok(row.data);
|
||||
assert.ok(row.languageScores);
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(row, "fileType")); // Can be null, so cannot just use ok
|
||||
assert.ok(row.entropy);
|
||||
assert.ok(row.matchingOps);
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(row, "useful"));
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(row, "matchesCrib"));
|
||||
|
||||
row.recipe.forEach(item => {
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(item, "op"), `No 'op' property in item ${item}`);
|
||||
assert.strictEqual(typeof item.op, "string");
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(item, "args"), `No 'args' property in item ${item}`);
|
||||
assert.ok(Array.isArray(item.args));
|
||||
});
|
||||
|
||||
row.languageScores.forEach(score => {
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(score, "lang"), `No 'lang' property in languageScore ${score}`);
|
||||
assert.strictEqual(typeof score.lang, "string");
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(score, "score"), `No 'score' property in languageScore ${score}`);
|
||||
assert.strictEqual(typeof score.score, "number");
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(score, "probability"), `No 'probability' property in languageScore ${score}`);
|
||||
assert.strictEqual(typeof score.probability, "number");
|
||||
});
|
||||
|
||||
row.matchingOps.forEach(op => {
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(op, "op"), `No 'op' property in matchingOp ${JSON.stringify(op)}`);
|
||||
assert.strictEqual(typeof op.op, "string");
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(op, "pattern"), `No 'pattern' property in matchingOp ${JSON.stringify(op)}`);
|
||||
assert.ok(op.pattern instanceof RegExp);
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(op, "args"), `No 'args' property in matchingOp ${JSON.stringify(op)}`);
|
||||
assert.ok(Array.isArray(op.args));
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(op, "useful"), `No 'useful' property in matchingOp ${JSON.stringify(op)}`);
|
||||
assert.ifError(op.useful); // Expect this to be undefined
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(op, "entropyRange"), `No 'entropyRange' property in matchingOp ${JSON.stringify(op)}`);
|
||||
assert.ifError(op.entropyRange); // Expect this to be undefined
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(op, "output"), `No 'output' property in matchingOp ${JSON.stringify(op)}`);
|
||||
assert.ifError(op.output); // Expect this to be undefined
|
||||
});
|
||||
});
|
||||
|
||||
}),
|
||||
|
||||
|
||||
]);
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ import "./tests/ParseQRCode.mjs";
|
||||
import "./tests/PowerSet.mjs";
|
||||
import "./tests/Regex.mjs";
|
||||
import "./tests/Register.mjs";
|
||||
import "./tests/RemoveDiacritics.mjs";
|
||||
import "./tests/Rotate.mjs";
|
||||
import "./tests/SeqUtils.mjs";
|
||||
import "./tests/SetDifference.mjs";
|
||||
@@ -101,6 +100,7 @@ import "./tests/LuhnChecksum.mjs";
|
||||
import "./tests/CipherSaber2.mjs";
|
||||
import "./tests/Colossus.mjs";
|
||||
import "./tests/ParseObjectIDTimestamp.mjs";
|
||||
import "./tests/Unicode.mjs";
|
||||
|
||||
|
||||
// Cannot test operations that use the File type yet
|
||||
|
||||
@@ -11,7 +11,18 @@ TestRegister.addTests([
|
||||
{
|
||||
name: "Haversine distance",
|
||||
input: "51.487263,-0.124323, 38.9517,-77.1467",
|
||||
expectedOutput: "5619355.701829259",
|
||||
expectedOutput: "5902542.836307819",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Haversine distance",
|
||||
"args": []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Haversine distance, zero distance",
|
||||
input: "51.487263,-0.124323, 51.487263,-0.124323",
|
||||
expectedOutput: "0",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Haversine distance",
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* Remove Diacritics tests.
|
||||
*
|
||||
* @author Klaxon [klaxon@veyr.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Remove Diacritics",
|
||||
input: "\xe0, \xe8, \xec, \xf2, \xf9 \xc0, \xc8, \xcc, \xd2, \xd9\n\xe1, \xe9, \xed, \xf3, \xfa, \xfd \xc1, \xc9, \xcd, \xd3, \xda, \xdd\n\xe2, \xea, \xee, \xf4, \xfb \xc2, \xca, \xce, \xd4, \xdb\n\xe3, \xf1, \xf5 \xc3, \xd1, \xd5\n\xe4, \xeb, \xef, \xf6, \xfc, \xff \xc4, \xcb, \xcf, \xd6, \xdc, \u0178\n\xe5, \xc5",
|
||||
expectedOutput: "a, e, i, o, u A, E, I, O, U\na, e, i, o, u, y A, E, I, O, U, Y\na, e, i, o, u A, E, I, O, U\na, n, o A, N, O\na, e, i, o, u, y A, E, I, O, U, Y\na, A",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Remove Diacritics",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
@@ -131,7 +131,7 @@ TestRegister.addTests([
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, true, 13]
|
||||
args: [true, true, true, 13]
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -142,7 +142,7 @@ TestRegister.addTests([
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, true, 13]
|
||||
args: [true, true, true, 13]
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -153,7 +153,7 @@ TestRegister.addTests([
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, true, 26]
|
||||
args: [true, true, true, 26]
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -164,7 +164,7 @@ TestRegister.addTests([
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, false, 13]
|
||||
args: [true, false, false, 13]
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -175,7 +175,7 @@ TestRegister.addTests([
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [false, true, 13]
|
||||
args: [false, true, false, 13]
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
83
tests/operations/tests/Unicode.mjs
Normal file
83
tests/operations/tests/Unicode.mjs
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Unicode operation tests.
|
||||
*
|
||||
* @author Matt C [me@mitt.dev]
|
||||
* @author Klaxon [klaxon@veyr.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2020
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Unicode Text Format: underline",
|
||||
input: "a",
|
||||
expectedOutput: "a\u0332",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Unicode Text Format",
|
||||
"args": [true, false],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Unicode Text Format: strikethrough",
|
||||
input: "a",
|
||||
expectedOutput: "a\u0336",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Unicode Text Format",
|
||||
"args": [false, true],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Unicode Text Format: both",
|
||||
input: "a",
|
||||
expectedOutput: "a\u0336\u0332",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Unicode Text Format",
|
||||
"args": [true, true],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Remove Diacritics: text formatting",
|
||||
input: "a",
|
||||
expectedOutput: "a",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Unicode Text Format",
|
||||
"args": [true, true],
|
||||
},
|
||||
{
|
||||
"op": "Remove Diacritics",
|
||||
"args": []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Remove Diacritics: all diacritical marks one char",
|
||||
input: "à̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́̕̚͠͡ͅ", // sorry about this line lol
|
||||
expectedOutput: "a",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Remove Diacritics",
|
||||
"args": []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Remove Diacritics: default",
|
||||
input: "\xe0, \xe8, \xec, \xf2, \xf9 \xc0, \xc8, \xcc, \xd2, \xd9\n\xe1, \xe9, \xed, \xf3, \xfa, \xfd \xc1, \xc9, \xcd, \xd3, \xda, \xdd\n\xe2, \xea, \xee, \xf4, \xfb \xc2, \xca, \xce, \xd4, \xdb\n\xe3, \xf1, \xf5 \xc3, \xd1, \xd5\n\xe4, \xeb, \xef, \xf6, \xfc, \xff \xc4, \xcb, \xcf, \xd6, \xdc, \u0178\n\xe5, \xc5",
|
||||
expectedOutput: "a, e, i, o, u A, E, I, O, U\na, e, i, o, u, y A, E, I, O, U, Y\na, e, i, o, u A, E, I, O, U\na, n, o A, N, O\na, e, i, o, u, y A, E, I, O, U, Y\na, A",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Remove Diacritics",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
@@ -34,11 +34,20 @@ const banner = `/**
|
||||
|
||||
|
||||
module.exports = {
|
||||
output: {
|
||||
publicPath: "",
|
||||
globalObject: "this"
|
||||
},
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin({
|
||||
$: "jquery",
|
||||
jQuery: "jquery",
|
||||
log: "loglevel"
|
||||
log: "loglevel",
|
||||
// process and Buffer are no longer polyfilled in webpack 5 but
|
||||
// many of our dependencies expect them, so it is easiest to just
|
||||
// provide them everywhere as was the case in webpack 4-
|
||||
process: "process",
|
||||
Buffer: ["buffer", "Buffer"]
|
||||
}),
|
||||
new webpack.BannerPlugin({
|
||||
banner: banner,
|
||||
@@ -46,37 +55,52 @@ module.exports = {
|
||||
entryOnly: true
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
// Required by Jimp to improve loading speed in browsers
|
||||
"process.browser": "true"
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: "assets/[name].css"
|
||||
}),
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
context: "src/core/vendor/",
|
||||
from: "tesseract/**/*",
|
||||
to: "assets/"
|
||||
}, {
|
||||
context: "node_modules/tesseract.js/",
|
||||
from: "dist/worker.min.js",
|
||||
to: "assets/tesseract"
|
||||
}, {
|
||||
context: "node_modules/tesseract.js-core/",
|
||||
from: "tesseract-core.wasm.js",
|
||||
to: "assets/tesseract"
|
||||
}
|
||||
])
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{
|
||||
context: "src/core/vendor/",
|
||||
from: "tesseract/**/*",
|
||||
to: "assets/"
|
||||
}, {
|
||||
context: "node_modules/tesseract.js/",
|
||||
from: "dist/worker.min.js",
|
||||
to: "assets/tesseract"
|
||||
}, {
|
||||
context: "node_modules/tesseract.js-core/",
|
||||
from: "tesseract-core.wasm.js",
|
||||
to: "assets/tesseract"
|
||||
}
|
||||
]
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
extensions: [".mjs", ".js", ".json"], // Allows importing files without extensions
|
||||
alias: {
|
||||
jquery: "jquery/src/jquery",
|
||||
},
|
||||
fallback: {
|
||||
"fs": false,
|
||||
"child_process": false,
|
||||
"net": false,
|
||||
"tls": false,
|
||||
"path": require.resolve("path/"),
|
||||
"buffer": require.resolve("buffer/"),
|
||||
"crypto": require.resolve("crypto-browserify"),
|
||||
"stream": require.resolve("stream-browserify"),
|
||||
"zlib": require.resolve("browserify-zlib")
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.m?js$/,
|
||||
exclude: /node_modules\/(?!jsesc|crypto-api|bootstrap)/,
|
||||
exclude: /node_modules\/(?!crypto-api|bootstrap)/,
|
||||
options: {
|
||||
configFile: path.resolve(__dirname, "babel.config.js"),
|
||||
cacheDirectory: true,
|
||||
@@ -86,12 +110,26 @@ module.exports = {
|
||||
loader: "babel-loader"
|
||||
},
|
||||
{
|
||||
test: /forge.min.js$/,
|
||||
loader: "imports-loader?jQuery=>null"
|
||||
test: /node-forge/,
|
||||
loader: "imports-loader",
|
||||
options: {
|
||||
additionalCode: "var jQuery = false;"
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /bootstrap-material-design/,
|
||||
loader: "imports-loader?Popper=popper.js/dist/umd/popper.js"
|
||||
loader: "imports-loader",
|
||||
options: {
|
||||
imports: "default popper.js/dist/umd/popper.js Popper"
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /blueimp-load-image/,
|
||||
loader: "imports-loader",
|
||||
options: {
|
||||
type: "commonjs",
|
||||
imports: "single min-document document"
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
@@ -181,12 +219,6 @@ module.exports = {
|
||||
/Can't resolve 'sodium'/
|
||||
],
|
||||
},
|
||||
node: {
|
||||
fs: "empty",
|
||||
"child_process": "empty",
|
||||
net: "empty",
|
||||
tls: "empty"
|
||||
},
|
||||
performance: {
|
||||
hints: false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user