2
0
mirror of https://github.com/gchq/CyberChef synced 2025-12-05 23:53:27 +00:00

Compare commits

...

225 Commits

Author SHA1 Message Date
n1474335
6d138f345f 9.7.19 2019-10-27 15:27:36 +00:00
n1474335
3c165dd7e8 Merge branch 'mattnotmitt-chores/yara-update' 2019-10-27 15:27:12 +00:00
n1474335
04561d29b5 Dependency update 2019-10-27 15:26:48 +00:00
n1474335
e5e6c1a2dd Merge branch 'chores/yara-update' of https://github.com/mattnotmitt/CyberChef into mattnotmitt-chores/yara-update 2019-10-27 15:23:47 +00:00
n1474335
882efea314 Updated README 2019-10-27 15:21:41 +00:00
n1474335
89d979d92e Merge branch 'rianadon-theme-by-url' 2019-10-27 15:17:33 +00:00
n1474335
383aab5f85 Improved theme selection. Added changeTheme method. 2019-10-27 15:17:06 +00:00
n1474335
6659174f88 Merge branch 'theme-by-url' of https://github.com/rianadon/CyberChef into rianadon-theme-by-url 2019-10-27 14:43:59 +00:00
n1474335
3ca29b8744 Merge branch 'brian-digital-labs-autofocus-search' 2019-10-27 14:39:05 +00:00
n1474335
726bf3345e Added tabindex to ingredients 2019-10-27 14:38:55 +00:00
n1474335
b2d61482d5 Merge branch 'autofocus-search' of https://github.com/brian-digital-labs/CyberChef into brian-digital-labs-autofocus-search 2019-10-27 14:17:06 +00:00
n1474335
88d8e9a7f9 9.7.18 2019-10-27 14:13:37 +00:00
n1474335
0b0ddd3140 Merge branch 'mattnotmitt-chores/nightwatch-update' 2019-10-27 14:12:22 +00:00
Matt
3d4f74945c Update nightwatch and chromedriver
Rebase onto master
2019-10-26 16:59:41 +01:00
Matt
4387038351 Update libyara-wasm 2019-10-26 16:14:25 +01:00
Brian Hoang
49f444dfe9 auto focus on search bar and made searchbar and text area tab-able 2019-10-26 15:30:27 +01:00
Ryan Adolf
061533bb57 Document theme option in README 2019-10-24 16:37:10 -07:00
Ryan Adolf
6e2fb67d76 Theme configuration through url 2019-10-24 16:32:14 -07:00
n1474335
60f5093c6c Update .travis.yml 2019-10-21 13:56:52 +01:00
n1474335
665f91ec37 Update README.md 2019-10-21 13:49:42 +01:00
n1474335
0805a011b9 9.7.17 2019-10-18 13:57:26 +01:00
n1474335
3e3322e1f0 Fork no longer appends its merge delimiter to the end of the output. Closes #692 2019-10-18 13:57:21 +01:00
Matt
252b1b65c4 Add YARA rules node test 2019-10-18 12:58:17 +01:00
Matt
e8b4536ec2 Updated yara to v3.11.0 and openssl to v1.1.1d
finally managed to fudge the compiler
2019-10-18 12:57:13 +01:00
n1474335
61d40b5a0b 9.7.16 2019-10-18 11:11:17 +01:00
n1474335
d175aa958c DES no longer requires an IV in ECB mode 2019-10-18 11:09:12 +01:00
n1474335
ac3c220789 9.7.15 2019-10-16 17:36:25 +01:00
n1474335
add65e121a Merge branch 'Storms-Engineering-master' 2019-10-16 17:36:02 +01:00
n1474335
de2e757691 Merge branch 'master' of https://github.com/Storms-Engineering/CyberChef into Storms-Engineering-master 2019-10-16 17:34:58 +01:00
n1474335
eb34ab4f6a 9.7.14 2019-10-16 17:23:59 +01:00
n1474335
08e4232166 Merge branch 'wh0-backslash' 2019-10-16 17:23:47 +01:00
n1474335
adf9772928 Added tests for Utils.parseEscapedChars 2019-10-16 17:22:48 +01:00
n1474335
562171ec86 Merge branch 'backslash' of https://github.com/wh0/CyberChef into wh0-backslash 2019-10-16 16:47:01 +01:00
n1474335
e9e162319f Merge branch 'BjoernAkAManf-master' 2019-10-16 16:32:20 +01:00
n1474335
17c9ffe107 Tidied up chainCommands function in Gruntfile 2019-10-16 16:32:06 +01:00
n1474335
1831c84a29 Merge branch 'master' of https://github.com/BjoernAkAManf/CyberChef into BjoernAkAManf-master 2019-10-16 16:23:09 +01:00
n1474335
7e27449204 Fixed search box appaerance in Firefox 2019-10-16 16:12:22 +01:00
n1474335
282476d530 Merge branch 'Xenonym-chore/remove-duplicate-issue-template' 2019-10-16 16:04:49 +01:00
n1474335
fce0728d5d Updated bug report template 2019-10-16 16:04:36 +01:00
n1474335
0e9ac90607 Merge branch 'chore/remove-duplicate-issue-template' of https://github.com/Xenonym/CyberChef into Xenonym-chore/remove-duplicate-issue-template 2019-10-16 15:59:59 +01:00
n1474335
5383f56b26 9.7.13 2019-10-16 15:51:06 +01:00
n1474335
a02484c6cd Merge branch 'Storms-Engineering-IV-length-Error' 2019-10-16 15:50:51 +01:00
n1474335
be365f66ef Added length check to Triple DES IVs 2019-10-16 15:50:37 +01:00
n1474335
011dc09d5e Merge branch 'IV-length-Error' of https://github.com/Storms-Engineering/CyberChef into Storms-Engineering-IV-length-Error 2019-10-16 15:43:47 +01:00
n1474335
fc4d6d2d2e 9.7.12 2019-10-16 15:39:56 +01:00
n1474335
9d73127cae Fixed some typos 2019-10-16 15:38:20 +01:00
n1474335
223743e3b5 Removed Clippy 2019-10-16 15:37:18 +01:00
n1474335
44ed372f21 9.7.11 2019-10-16 15:10:16 +01:00
n1474335
4d1f970105 Added test to ensure all operations are in a category. Added various operations to categories. 2019-10-16 15:10:03 +01:00
n1474335
b28a891a40 9.7.10 2019-10-15 16:26:01 +01:00
n1474335
834ff95702 Base64 operations now throw a meaningful error if the alphabet is the wrong length 2019-10-15 16:25:52 +01:00
Storms-Engineering
3e93580aa4 DES Encrypt/Decrypt - checks length of IV string
Checks the length of IV string when encrypting.  DES encrypt/decrypt test swas updated to use utf8 instead of HEX.
2019-10-12 09:42:13 -08:00
Storms-Engineering
7a3ca027bb PHP Deserialize NULL values converted to correctly
PHP Deserialize now correctly returns N as a null instead of an empty object
2019-10-12 05:56:10 -08:00
Tan Zhen Yong
3c021919dd Rename feature request issue template
- to remain consistent with other issue templates using a `-` instead of `_`
2019-10-12 16:17:40 +08:00
Tan Zhen Yong
2106e8ddb0 Remove duplicate bug report issue template
The bug report issue template is duplicated (`bug-report.md` and
`bug_report.md`, note the `-`/`_` difference).

Thus, GitHub was unable to use the bug report issue template, and it
does not show up when a new issue is being created.

Let's remove the duplicate template `bug_report.md`.
2019-10-12 16:13:40 +08:00
n1474335
3472484601 Merge branch 'd98762625-fix-node-tests' 2019-10-09 16:19:39 +01:00
n1474335
826a8c8a74 Merge branch 'fix-node-tests' of https://github.com/d98762625/CyberChef into d98762625-fix-node-tests 2019-10-09 16:18:54 +01:00
n1474335
c66703f0ca 9.7.9 2019-10-09 16:14:47 +01:00
n1474335
874e7d8d54 Merge branch 'expose-operationerror' 2019-10-09 16:14:38 +01:00
n1474335
4e2b85b8c8 Merge branch 'master' into expose-operationerror 2019-10-09 16:14:03 +01:00
n1474335
5314a456cb 9.7.8 2019-10-09 16:12:46 +01:00
n1474335
ba2a5b195c Improved PE extractor to also carve the overlay if possible 2019-10-09 16:12:41 +01:00
d98762625
f8115671ee fix linting tests 2019-10-07 18:05:28 +01:00
d98762625
494279edd8 update gitignore 2019-10-07 18:01:35 +01:00
d98762625
bd6673afed Merge branch 'master' of github.com:gchq/CyberChef into expose-operationerror 2019-10-07 17:59:00 +01:00
d98762625
210daf7324 make async node tests actually fail when they fail. Update tests that were failing 2019-10-07 17:41:51 +01:00
wh0
d60d595254 Utils: don't consume three backslashes at a time 2019-10-06 17:07:58 -07:00
n1474335
06708949a1 9.7.7 2019-10-04 17:52:15 +01:00
n1474335
da901e20d9 Added several more file signatures. The background magic button now highlights when a file type has been detected. 2019-10-04 17:52:09 +01:00
Björn Heinrichs
c28999ec6f Fixed building on Windows
On Windows OperationConfig was not generated.
See #360 #645 for more Information.
2019-10-03 02:23:18 +02:00
n1474335
6810f38808 9.7.6 2019-10-01 17:11:36 +01:00
n1474335
087cc6b8fd Fixed webm signature 2019-10-01 17:11:31 +01:00
n1474335
10c8101476 9.7.5 2019-10-01 16:54:26 +01:00
n1474335
22028b074a Added support for many more file types to file signature operations 2019-10-01 16:54:19 +01:00
n1474335
3d086beed2 9.7.4 2019-10-01 12:15:07 +01:00
n1474335
777d814e70 Updated package-lock.json 2019-10-01 12:14:57 +01:00
n1474335
15c26a95c5 Merge branch 'master' into edit-node-recipe 2019-10-01 12:12:49 +01:00
n1474335
f87d3bd1cb 9.7.3 2019-10-01 12:10:43 +01:00
n1474335
b9ea1e8c71 Merge branch 'forge-update' of https://github.com/cbeuw/CyberChef into cbeuw-forge-update 2019-10-01 10:56:30 +01:00
n1474335
db232f4ff2 9.7.2 2019-09-27 11:29:01 +01:00
n1474335
70f705afbc Fixed typo in 'Convert Data Units' preventing Kilobits from working. Closes #649 2019-09-27 11:28:57 +01:00
Andy Wang
880df212d5 Correct wrong DES and 3DES tests 2019-09-26 22:00:13 +01:00
Andy Wang
b06acd99ec Adapt AES "no IV" tests 2019-09-26 21:52:34 +01:00
Andy Wang
a59de80d18 Update node API tests 2019-09-26 21:41:35 +01:00
Andy Wang
1e8dee9935 update node-forge version 2019-09-26 21:32:08 +01:00
n1474335
928f1c3e4b Remove excess slashes from Tesseract paths 2019-09-25 15:39:04 +01:00
d98762625
014e70a7b1 add node index to source 2019-09-20 18:44:13 +01:00
d98762625
5148b16246 Export cyberchef error types to be used in consuming applications 2019-09-20 18:40:21 +01:00
n1474335
b4ae4c5a00 9.7.1 2019-09-13 17:40:26 +01:00
n1474335
70346bce35 OCR operation now relies on local files 2019-09-13 17:40:20 +01:00
n1474335
3539e065fa 9.7.0 2019-09-13 14:36:00 +01:00
n1474335
8ffc58b340 Updated CHANGELOG 2019-09-13 14:35:54 +01:00
n1474335
503e733c81 Merge branch 'MShwed-feature/ocr' 2019-09-13 14:34:22 +01:00
n1474335
7eabaf0de6 Cleaned up and improved OCR operation 2019-09-13 14:34:08 +01:00
n1474335
a8ad10757c Merge branch 'feature/ocr' of https://github.com/MShwed/CyberChef into MShwed-feature/ocr 2019-09-13 12:41:38 +01:00
d98762625
111546ad1a update function comments 2019-09-06 12:26:24 +01:00
d98762625
a8fbd5164e Update NodeRecipe so args is optional in bake config 2019-09-06 12:21:53 +01:00
mshwed
8dde732514 Fixed linting issues 2019-09-05 09:20:59 -04:00
mshwed
f1659af5e4 Added basic OCR text extraction 2019-09-04 14:37:02 -04:00
n1474335
e68fb51f44 Merge branch 'master' of github.com:gchq/CyberChef 2019-09-04 17:17:17 +01:00
n1474335
95453131c8 9.6.0 2019-09-04 17:16:54 +01:00
n1474335
c60d5c8e85 Updated CHANGELOG 2019-09-04 17:16:47 +01:00
n1474335
b31f32a7e7 Tidied up Bacon Cipher operations 2019-09-04 17:13:05 +01:00
n1474335
f0b3bd0ede Merge branch 'bacon' of https://github.com/kassi/CyberChef 2019-09-04 16:30:05 +01:00
n1474335
de5243ec67 Update issue templates 2019-09-04 14:51:57 +01:00
n1474335
c6de3eb2ae 9.5.0 2019-09-04 14:00:29 +01:00
n1474335
d7b6f29c81 Updated CHANGELOG 2019-09-04 14:00:25 +01:00
n1474335
5bebd71a44 Merge branch 'Ge0rg3-steganography' 2019-09-04 13:55:17 +01:00
n1474335
eb769c7fb4 Tidied up Steganography operations. FileType and toBase64 functions now accept ArrayBuffers. 2019-09-04 13:54:59 +01:00
n1474335
5bc5c0df90 Merge branch 'steganography' of https://github.com/Ge0rg3/CyberChef into Ge0rg3-steganography 2019-09-04 11:31:58 +01:00
n1474335
cfc3684a16 Merge branch 'wesinator-patch-1' 2019-09-04 11:17:13 +01:00
n1474335
0590020130 Merge branch 'patch-1' of https://github.com/wesinator/CyberChef into wesinator-patch-1 2019-09-04 11:16:57 +01:00
n1474335
2a91af152d Fixed sitemap generation 2019-09-04 11:14:45 +01:00
Ԝеѕ
d8120d4e13 Add Quoted-printable example 2019-09-03 11:21:58 -04:00
n1474335
0ac211ce77 9.4.1 2019-08-30 18:49:11 +01:00
n1474335
32c0d6f253 Updated dependencies 2019-08-30 18:49:05 +01:00
n1474335
de762847e9 9.4.0 2019-08-30 15:48:47 +01:00
n1474335
6248e32148 Updated CHANGELOG 2019-08-30 15:47:50 +01:00
n1474335
52f88ee32d Merge branch 'j433866-render-markdown' 2019-08-30 15:46:37 +01:00
n1474335
f8d1cf2f60 Tidied up 'Render Markdown' operation 2019-08-30 15:46:24 +01:00
n1474335
e129425d8d Merge branch 'render-markdown' of https://github.com/j433866/CyberChef into j433866-render-markdown 2019-08-30 15:33:47 +01:00
n1474335
ae20d82e1d Fix Nightwatch test 2019-08-30 15:30:30 +01:00
n1474335
463b2ce040 9.3.0 2019-08-30 11:58:37 +01:00
n1474335
412b47abba Updated CHANGELOG 2019-08-30 11:58:32 +01:00
n1474335
ed216eee73 Merge branch 'j433866-show-on-map' 2019-08-30 11:57:00 +01:00
n1474335
9dd5234962 Tidied up 'Show on map' operation 2019-08-30 11:56:48 +01:00
n1474335
018532016b Merge branch 'show-on-map' of https://github.com/j433866/CyberChef into j433866-show-on-map 2019-08-30 11:44:12 +01:00
n1474335
7dfecc38f6 Added more UI tests to ensure all modules load, categories can be viewed, and operations can be dragged 2019-08-30 11:43:30 +01:00
Ge0rg3
aa5afadcce Tests for Randomize Colour Palette Op 2019-08-29 16:24:21 +01:00
Ge0rg3
d23a584b9e Randomize Colour Palette Operation 2019-08-29 16:17:07 +01:00
n1474335
572f035877 Background magic is now debounced to prevent it firing too often. 2019-08-29 14:08:56 +01:00
j433866
b94eb6adb0 Add syntax highlighting
Explicitly disable HTML rendering.
Updated description.
2019-08-29 14:08:07 +01:00
j433866
45fccb94e1 Merge remote-tracking branch 'upstream/master' into render-markdown 2019-08-29 13:23:37 +01:00
j433866
2628f17fae Change maps source to use Wikimedia maps.
Add link to Wikimedia maps ToS.
If there's no data, show the map anyway.
2019-08-29 11:43:45 +01:00
j433866
69fb6e77fc Merge remote-tracking branch 'upstream/master' into show-on-map 2019-08-29 10:42:40 +01:00
j433866
6992858e67 9.2.3 2019-08-29 10:23:41 +01:00
j433866
59917cca45 Add overflow CSS rule to fix scrolling. Fixes #626 2019-08-29 10:18:52 +01:00
n1474335
2f0b959aa4 Fixed copy:ghPages docs error 2019-08-28 18:48:31 +01:00
n1474335
4f2749e0dc 9.2.2 2019-08-28 17:14:20 +01:00
n1474335
c9deaae744 Updated supported browser versions. 2019-08-28 17:14:12 +01:00
Ge0rg3
950a12360e Tests + Bug Fixes
* Test cases for LSB extraction, RGBA extraction and bit plane browsing
* Bug fix for alpha planes in bit plane browser
2019-08-28 17:07:43 +01:00
n1474335
686ca284fe Removed JSDoc generation as it is never really used. JSDoc comments are still required but the doc files will no longer be generated. This simplifies the build process and config scripts. 2019-08-28 16:37:31 +01:00
n1474335
b21643f485 Merge branch 'master' of github.com:gchq/CyberChef 2019-08-28 16:14:49 +01:00
n1474335
4c28627459 Added pulse to Background Magic button to draw attention. 2019-08-28 16:14:13 +01:00
n1474335
6a6fe0f56d Update CONTRIBUTING.md 2019-08-28 15:47:33 +01:00
Ge0rg3
48831225ac Extract RGBA Values Operation 2019-08-28 09:58:00 +01:00
Ge0rg3
4e8a79d8f1 Bit Plane Browser and LSB Extraction
Bit Plane Browser and LSB Extraction

Bit Plane Browser and LSB Extraction
2019-08-28 01:06:59 +01:00
n1474335
570a4c7fca Update CHANGELOG.md 2019-08-27 18:30:33 +01:00
n1474335
094d352e5f Added eslint space-before-blocks rule 2019-08-27 18:13:33 +01:00
n1474335
44b90be7d6 Added 'fully qualified' to the description for the 'Extract Domains' operation to reduce ambiguity. #618 2019-08-27 17:59:45 +01:00
n1474335
e7980a8886 9.2.1 2019-08-27 13:02:24 +01:00
n1474335
1c9c0a48be Merge branch 'csmith-ip-format-octal' 2019-08-27 13:02:18 +01:00
n1474335
c541eebe3e Merge branch 'ip-format-octal' of https://github.com/csmith/CyberChef into csmith-ip-format-octal 2019-08-27 13:00:54 +01:00
n1474335
c51e6efe74 Merge branch 'chrishepner-scanembedded-typo' 2019-08-27 12:57:20 +01:00
Chris Smith
6c9ce15b26 Add octal support to Change IP Format.
Also add test cases covering interchanging between all four
formats.
2019-08-24 01:14:44 +01:00
Chris Hepner
8e1bd36b4c Fix typo in ScanForEmbeddedFiles
Change "suffiently" to "sufficiently"
2019-08-23 14:52:16 -07:00
n1474335
d3e3e6e6fc 9.2.0 2019-08-23 11:22:03 +01:00
n1474335
f1794a2dfe Updated CHANGELOG 2019-08-23 11:22:00 +01:00
n1474335
1efccff730 Merge branch 'h345983745-udp-header-parser' 2019-08-23 10:56:25 +01:00
n1474335
0031345383 Tidied up 'Parse UDP' operation 2019-08-23 10:56:13 +01:00
n1474335
46fa7475cf Merge branch 'udp-header-parser' of https://github.com/h345983745/CyberChef into h345983745-udp-header-parser 2019-08-23 10:40:24 +01:00
n1474335
afc7c40975 Create SECURITY.md 2019-08-22 17:38:56 +01:00
n1474335
dc99797f7b 9.1.0 2019-08-22 16:51:50 +01:00
n1474335
4624266a5c Updated CHANGELOG 2019-08-22 16:50:43 +01:00
n1474335
05bfd99318 9.0.10 2019-08-22 16:35:20 +01:00
n1474335
db3faf16b0 Merge branch 'master' of github.com:gchq/CyberChef 2019-08-22 16:34:00 +01:00
n1474335
9fc451ece8 9.0.9 2019-08-22 16:31:59 +01:00
n1474335
9e1079027b Merge branch 'j433866-carriage-returns' 2019-08-22 16:31:41 +01:00
n1474335
9774a4bd26 Tidied up CR preservation code 2019-08-22 16:31:21 +01:00
j433866
ce9e864757 9.0.9 2019-08-22 14:58:20 +01:00
j433866
737ea19c9e Fix AES decryption in GCM mode not using IVs.
Updated tests to match new results.
Included a Python script to generate AES-GCM tests
2019-08-22 14:54:58 +01:00
j433866
82b5e97a2b Merge branch 'master' into render-markdown 2019-08-22 12:31:52 +01:00
j433866
c43f829854 Slightly change wording of alerts 2019-08-22 11:56:14 +01:00
j433866
f43a868607 Add carriage return detection for pasted and switched inputs.
Fix switching the output to input not working properly.
Add nicer confirmation boxes for zipping outputs.
2019-08-22 11:53:41 +01:00
j433866
9f2d1453ed Make the wordWrap change event only fire when the
word wrap checkbox is changed
2019-08-22 11:26:43 +01:00
j433866
082d939f7d Add customisations for confirm box.
Can change the text of the accept and reject buttons.
Now returns undefined if the user clicks off it
2019-08-22 11:26:04 +01:00
j433866
8d628cf0ed Merge remote-tracking branch 'upstream/master' 2019-08-22 11:20:40 +01:00
j433866
19553dcfed Fix parse colour code operation.
The interactive part broke due to changes for multiple inputs.
Now fires the inputChange event with a fake keyup event to autobake
2019-08-22 11:00:04 +01:00
n1474335
a7938526aa 9.0.8 2019-08-21 14:28:04 +01:00
n1474335
863551ee1d AES Decrypt now handles blank IVs correctly. Fixes #613 2019-08-21 14:27:56 +01:00
n1474335
772c6bbba5 Tidied up test runner. Passing tests are no longer printed to the console. 2019-08-20 17:13:05 +01:00
n1474335
148dcbb0c5 9.0.7 2019-08-20 15:21:18 +01:00
n1474335
82abdb50b1 Fixed bug in Protobuf library causing issues with long keys 2019-08-20 15:20:43 +01:00
h345983745
b8dbb11136 Spelling 2019-08-19 21:05:38 +01:00
h345983745
b14cb99587 Removed console.log 2019-08-19 20:55:04 +01:00
h345983745
1d32a5939c Core UDP parsing functionality
Added to categorie

Description

Added Tests

Added tests
2019-08-19 20:48:05 +01:00
j433866
ae1cd8ba3e Add fade animation to modals 2019-08-15 15:03:13 +01:00
j433866
1fb6bffe1c 9.0.6 2019-08-13 16:46:17 +01:00
j433866
59864e3781 Fix Defang IP tests causing the tests to fail 2019-08-13 16:45:53 +01:00
j433866
e2c7d8c678 Increase size limit for inlined fonts / icons 2019-08-13 16:03:52 +01:00
j433866
62f82c5d12 Merge branch 'inline-fonts' 2019-08-13 15:39:33 +01:00
n1474335
ec70d8a3a2 Updated CHANGELOG 2019-08-13 14:25:36 +01:00
n1474335
1b4471a946 Merge branch 'h345983745-defang-ip' 2019-08-13 14:23:54 +01:00
n1474335
43472394c7 Tidied up 'Defang IP Addresses' operation 2019-08-13 14:23:41 +01:00
n1474335
a4e9025b8e Merge branch 'defang-ip' of https://github.com/h345983745/CyberChef into h345983745-defang-ip 2019-08-13 14:19:34 +01:00
n1474335
6b9e93e310 Updated CHANGELOG 2019-08-13 14:13:59 +01:00
n1474335
06b385563c Merge branch 'j433866-ssh-host-key' 2019-08-13 14:12:04 +01:00
n1474335
d90a23bfd5 Added 'Parse SSH Host Key' operation to the Networking category 2019-08-13 14:11:52 +01:00
j433866
91cdd50ba7 Increase size limit for inlined fonts / icons 2019-08-13 14:03:21 +01:00
j433866
4bc4db8232 Fix incorrect import of TestRegister 2019-08-13 13:39:21 +01:00
j433866
863675e636 Update nodeApi test.
'base 64' now returns 11 results as the SSH host key module mentions it
2019-08-13 13:37:21 +01:00
j433866
1cdcaebb4d Merge remote-tracking branch 'upstream/master' into ssh-host-key
Bring up to date with master
2019-08-13 13:26:40 +01:00
n1474335
cdb30d86b0 9.0.5 2019-08-12 15:27:45 +01:00
n1474335
138e3c4239 Merge branch 'use-std-esm' 2019-08-12 15:27:21 +01:00
n1474335
66b82598e3 Merge branch 'use-std-esm' of github.com:gchq/CyberChef 2019-08-12 15:26:15 +01:00
d98762625
780eecf35b update readme with Node.js compatibility 2019-08-02 14:36:40 +01:00
d98762625
8548d39318 add node consumer tests to travis 2019-08-02 11:10:15 +01:00
n1474335
6f26ff0a89 Merge branch 'master' into use-std-esm 2019-07-31 15:05:04 +01:00
d98762625
e4d98eba6b use std/esm to make chef compatible with cjs projects. Remove webpack work for node 2019-07-19 13:14:32 +01:00
j433866
9c6ceaa58a Add tests 2019-07-15 14:12:40 +01:00
j433866
7f168d49a6 Add render markdown operation 2019-07-12 09:33:13 +01:00
j433866
ac1c93d29b Fix incorrect curve detection for ecdsa-sha2 2019-07-08 16:58:03 +01:00
j433866
944842d4eb Improve description and add to Categories 2019-07-08 16:44:36 +01:00
j433866
d56ff0825a Add extraction of actual key from public key file 2019-07-08 15:58:56 +01:00
h345983745
bac2e8c014 Removed V4 + V6 options 2019-06-29 01:12:50 +01:00
j433866
59cdd259ac Add new parse ssh host key operation 2019-05-23 11:11:37 +01:00
h345983745
219469f24f Intial Commit
Consolidated IP Regex's

Fixed Logic Error

Added Tests

Removed Changes Outside Of Operation

Added to category
2019-05-12 21:19:54 +01:00
Karsten Silkenbäumer
ad571e6019 Change author URL 2019-03-03 17:20:54 +01:00
Karsten Silkenbäumer
14d924f6c7 Add test for the error fixed before 2019-03-02 22:27:53 +01:00
Karsten Silkenbäumer
282f02f4d5 Fix error when decoding a text with 2+ whitespaces in AMNZ mode 2019-03-02 22:17:44 +01:00
Karsten Silkenbäumer
d36cede0c7 Use better names for the alphabet selection 2019-03-02 17:55:03 +01:00
Karsten Silkenbäumer
a262d70b88 Add Bacon cipher encoding 2019-03-02 17:33:17 +01:00
Karsten Silkenbäumer
77b098c5fe Add Bacon cipher decoding 2019-03-02 15:00:42 +01:00
j433866
b491b9d77d Move conversion of co-ordinates to run() instead of present() 2019-01-18 11:31:53 +00:00
j433866
237f792fb4 Add new Show on map operation 2019-01-18 11:19:06 +00:00
158 changed files with 5819 additions and 3106 deletions

View File

@@ -1,2 +1 @@
src/core/vendor/**
src/web/static/clippy_assets/**
src/core/vendor/**

View File

@@ -43,6 +43,7 @@
// stylistic conventions
"brace-style": ["error", "1tbs"],
"space-before-blocks": ["error", "always"],
"block-spacing": "error",
"array-bracket-spacing": "error",
"comma-spacing": "error",

View File

@@ -6,7 +6,7 @@ There are lots of opportunities to contribute to CyberChef. If you want ideas, t
Before your contributions can be accepted, you must:
- Sign the [GCHQ Contributor Licence Agreement](https://github.com/gchq/Gaffer/wiki/GCHQ-OSS-Contributor-License-Agreement-V1.0)
- Sign the [GCHQ Contributor Licence Agreement](https://cla-assistant.io/gchq/CyberChef)
- Push your changes to your fork.
- Submit a pull request.
@@ -25,9 +25,9 @@ Before your contributions can be accepted, you must:
## Design Principles
1. If at all possible, all operations and features should be client-side and not rely on connections to an external server. This increases the utility of CyberChef on closed networks and in virtual machines that are not connected to the Internet. Calls to external APIs may be accepted if there is no other option, but not for critical components.
2. Latency should be kept to a minimum to enhance the user experience. This means that all operation code should sit on the client, rather than being loaded dynamically from a server.
3. Use Vanilla JS if at all possible to reduce the number of libraries required and relied upon. Frameworks like jQuery, although included, should not be used unless absolutely necessary.
4. Minimise the use of large libraries, especially for niche operations that won't be used very often - these will be downloaded by everyone using the app, whether they use that operation or not (due to principal 2).
2. Latency should be kept to a minimum to enhance the user experience. This means that operation code should sit on the client and be executed there. However, as a trade-off between latency and bandwidth, operation code with large dependencies can be loaded in discrete modules in order to reduce the size of the initial download. The downloading of additional modules must remain entirely transparent so that the user is not inconvenienced.
3. Large libraries should be kept in separate modules so that they are not downloaded by everyone who uses the app, just those who specifically require the relevant operations.
4. Use Vanilla JS if at all possible to reduce the number of libraries required and relied upon. Frameworks like jQuery, although included, should not be used unless absolutely necessary.
With these principles in mind, any changes or additions to CyberChef should keep it:

View File

@@ -7,19 +7,18 @@ assignees: ''
---
<!-- Prefix the title above with 'Bug report:' -->
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior or a link to the recipe / input used to cause the bug:
Steps to reproduce the behaviour or a link to the recipe / input used to cause the bug:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
**Expected behaviour**
A clear and concise description of what you expected to happen.
**Screenshots**
@@ -27,9 +26,8 @@ If applicable, add screenshots to help explain your problem.
**Desktop (if relevant, please complete the following information):**
- OS: [e.g. Windows]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
- Browser: [e.g. chrome 72, firefox 60]
- CyberChef version: [e.g. 9.7.14]
**Additional context**
Add any other context about the problem here.

View File

@@ -6,9 +6,9 @@ labels: feature
assignees: ''
---
<!-- Prefix the title above with 'Feature request:' -->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
A clear and concise description of what the problem is. E.g. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.

View File

@@ -7,8 +7,6 @@ assignees: ''
---
<!-- Prefix the title above with 'Operation request:' -->
## Summary
### Example Input

4
.gitignore vendored
View File

@@ -2,12 +2,8 @@ node_modules
npm-debug.log
travis.log
build
docs/*
!docs/*.conf.json
!docs/*.ico
.vscode
.*.swp
.DS_Store
src/core/config/modules/*
src/core/config/OperationConfig.json
src/core/operations/index.mjs

View File

@@ -3,6 +3,5 @@ npm-debug.log
travis.log
build/*
!build/node
docs
.vscode
.github

View File

@@ -1,6 +1,6 @@
language: node_js
node_js:
- lts/*
- lts/dubnium
cache: npm
addons:
chrome: stable
@@ -11,8 +11,7 @@ before_script:
script:
- grunt lint
- grunt test
- grunt docs
- npm run node-prod
- grunt testnodeconsumer
- grunt prod --msg="$COMPILE_MSG"
- xvfb-run --server-args="-screen 0 1200x800x24" grunt testui
before_deploy:
@@ -34,7 +33,7 @@ deploy:
file_glob: true
file:
- build/prod/*.zip
- build/node/CyberChef.js
- src/node/cjs.js
on:
repo: gchq/CyberChef
tags: true

View File

@@ -2,12 +2,37 @@
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.7.0] - 2019-09-13
- 'Optical Character Recognition' operation added [@MShwed] [@n1474335] | [#632]
### [9.6.0] - 2019-09-04
- 'Bacon Cipher Encode' and 'Bacon Cipher Decode' operations added [@kassi] | [#500]
### [9.5.0] - 2019-09-04
- Various Steganography operations added: 'Extract LSB', 'Extract RGBA', 'Randomize Colour Palette', and 'View Bit Plane' [@Ge0rg3] | [#625]
### [9.4.0] - 2019-08-30
- 'Render Markdown' operation added [@j433866] | [#627]
### [9.3.0] - 2019-08-30
- 'Show on map' operation added [@j433866] | [#477]
### [9.2.0] - 2019-08-23
- 'Parse UDP' operation added [@h345983745] | [#614]
### [9.1.0] - 2019-08-22
- 'Parse SSH Host Key' operation added [@j433866] | [#595]
- 'Defang IP Addresses' operation added [@h345983745] | [#556]
## [9.0.0] - 2019-07-09
- [Multiple inputs](https://github.com/gchq/CyberChef/wiki/Multiple-Inputs) are now supported in the main web UI, allowing you to upload and process multiple files at once [@j433866] | [#566]
- A [Node.js API](https://github.com/gchq/CyberChef/wiki/Node-API) has been implemented, meaning that CyberChef can now be used as a library, either to provide specific operations, or an entire baking environment [@d98762625] | [#291]
- A [read-eval-print loop (REPL)](https://github.com/gchq/CyberChef/wiki/Node-API#repl) is also included to enable prototyping and experimentation with the API [@d98762625] | [#291]
- Light and dark Solarized themes added [@j433866] | [#566]
<details>
<summary>Click to expand v8 minor versions</summary>
### [8.38.0] - 2019-07-03
- 'Streebog' and 'GOST hash' operations added [@MShwed] [@n1474335] | [#530]
@@ -129,6 +154,8 @@ All major and minor version changes will be documented in this file. Details of
### [8.1.0] - 2018-08-19
- 'Dechunk HTTP response' operation added [@sevzero] | [#311]
</details>
## [8.0.0] - 2018-08-05
- Codebase rewritten using [ES modules](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/) and [classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) [@n1474335] [@d98762625] [@artemisbot] [@picapi] | [#284]
- Operation architecture restructured to make adding new operations a lot simpler [@n1474335] | [#284]
@@ -158,6 +185,13 @@ All major and minor version changes will be documented in this file. Details of
[9.7.0]: https://github.com/gchq/CyberChef/releases/tag/v9.7.0
[9.6.0]: https://github.com/gchq/CyberChef/releases/tag/v9.6.0
[9.5.0]: https://github.com/gchq/CyberChef/releases/tag/v9.5.0
[9.4.0]: https://github.com/gchq/CyberChef/releases/tag/v9.4.0
[9.3.0]: https://github.com/gchq/CyberChef/releases/tag/v9.3.0
[9.2.0]: https://github.com/gchq/CyberChef/releases/tag/v9.2.0
[9.1.0]: https://github.com/gchq/CyberChef/releases/tag/v9.1.0
[9.0.0]: https://github.com/gchq/CyberChef/releases/tag/v9.0.0
[8.38.0]: https://github.com/gchq/CyberChef/releases/tag/v8.38.0
[8.37.0]: https://github.com/gchq/CyberChef/releases/tag/v8.37.0
@@ -227,6 +261,7 @@ All major and minor version changes will be documented in this file. Details of
[@masq]: https://github.com/masq
[@Ge0rg3]: https://github.com/Ge0rg3
[@MShwed]: https://github.com/MShwed
[@kassi]: https://github.com/kassi
[#95]: https://github.com/gchq/CyberChef/pull/299
[#173]: https://github.com/gchq/CyberChef/pull/173
@@ -265,8 +300,10 @@ All major and minor version changes will be documented in this file. Details of
[#467]: https://github.com/gchq/CyberChef/pull/467
[#468]: https://github.com/gchq/CyberChef/pull/468
[#476]: https://github.com/gchq/CyberChef/pull/476
[#477]: https://github.com/gchq/CyberChef/pull/477
[#489]: https://github.com/gchq/CyberChef/pull/489
[#496]: https://github.com/gchq/CyberChef/pull/496
[#500]: https://github.com/gchq/CyberChef/pull/500
[#506]: https://github.com/gchq/CyberChef/pull/506
[#515]: https://github.com/gchq/CyberChef/pull/515
[#516]: https://github.com/gchq/CyberChef/pull/516
@@ -275,7 +312,13 @@ All major and minor version changes will be documented in this file. Details of
[#531]: https://github.com/gchq/CyberChef/pull/531
[#533]: https://github.com/gchq/CyberChef/pull/533
[#535]: https://github.com/gchq/CyberChef/pull/535
[#556]: https://github.com/gchq/CyberChef/pull/556
[#566]: https://github.com/gchq/CyberChef/pull/566
[#571]: https://github.com/gchq/CyberChef/pull/571
[#585]: https://github.com/gchq/CyberChef/pull/585
[#591]: https://github.com/gchq/CyberChef/pull/591
[#595]: https://github.com/gchq/CyberChef/pull/595
[#614]: https://github.com/gchq/CyberChef/pull/614
[#625]: https://github.com/gchq/CyberChef/pull/625
[#627]: https://github.com/gchq/CyberChef/pull/627
[#632]: https://github.com/gchq/CyberChef/pull/632

View File

@@ -3,7 +3,6 @@
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const NodeExternals = require("webpack-node-externals");
const glob = require("glob");
const path = require("path");
@@ -15,8 +14,6 @@ const path = require("path");
* @license Apache-2.0
*/
const NODE_PROD = process.env.NODE_ENV === "production";
module.exports = function (grunt) {
grunt.file.defaultEncoding = "utf8";
grunt.file.preserveBOM = false;
@@ -36,8 +33,7 @@ module.exports = function (grunt) {
grunt.registerTask("node",
"Compiles CyberChef into a single NodeJS module.",
[
"clean:node", "clean:config", "clean:nodeConfig", "exec:generateConfig",
"exec:generateNodeIndex", "webpack:node", "webpack:nodeRepl", "chmod:build"
"clean:node", "clean:config", "clean:nodeConfig", "exec:generateConfig", "exec:generateNodeIndex"
]);
grunt.registerTask("test",
@@ -51,17 +47,14 @@ module.exports = function (grunt) {
"A task which runs all the UI tests in the tests directory. The prod task must already have been run.",
["connect:prod", "exec:browserTests"]);
grunt.registerTask("docs",
"Compiles documentation in the /docs directory.",
["clean:docs", "jsdoc", "chmod:docs"]);
grunt.registerTask("testnodeconsumer",
"A task which checks whether consuming CJS and ESM apps work with the CyberChef build",
["exec:setupNodeConsumers", "exec:testCJSNodeConsumer", "exec:testESMNodeConsumer", "exec:testESMDeepImportNodeConsumer", "exec:teardownNodeConsumers"]);
grunt.registerTask("default",
"Lints the code base",
["eslint", "exec:repoSize"]);
grunt.registerTask("doc", "docs");
grunt.registerTask("tests", "test");
grunt.registerTask("lint", "eslint");
@@ -69,7 +62,6 @@ module.exports = function (grunt) {
// Load tasks provided by each plugin
grunt.loadNpmTasks("grunt-eslint");
grunt.loadNpmTasks("grunt-webpack");
grunt.loadNpmTasks("grunt-jsdoc");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-watch");
@@ -90,7 +82,8 @@ module.exports = function (grunt) {
COMPILE_MSG: JSON.stringify(grunt.option("compile-msg") || grunt.option("msg") || ""),
PKG_VERSION: JSON.stringify(pkg.version),
},
moduleEntryPoints = listEntryModules();
moduleEntryPoints = listEntryModules(),
nodeConsumerTestPath = "~/tmp-cyberchef";
/**
@@ -108,6 +101,26 @@ module.exports = function (grunt) {
return entryModules;
}
/**
* Detects the correct delimiter to use to chain shell commands together
* based on the current OS.
*
* @param {string[]} cmds
* @returns {string}
*/
function chainCommands(cmds) {
const win = process.platform === "win32";
if (!win) {
return cmds.join(";");
}
return cmds
// && means that subsequent commands will not be executed if the
// previous one fails. & would coninue on a fail
.join("&&")
// Windows does not support \n properly
.replace("\n", "\\n");
}
grunt.initConfig({
clean: {
dev: ["build/dev/*"],
@@ -115,7 +128,6 @@ module.exports = function (grunt) {
node: ["build/node/*"],
config: ["src/core/config/OperationConfig.json", "src/core/config/modules/*", "src/code/operations/index.mjs"],
nodeConfig: ["src/node/index.mjs", "src/node/config/OperationConfig.json"],
docs: ["docs/*", "!docs/*.conf.json", "!docs/*.ico", "!docs/*.png"],
standalone: ["build/prod/CyberChef*.html"]
},
eslint: {
@@ -128,22 +140,6 @@ module.exports = function (grunt) {
node: ["src/node/**/*.{js,mjs}"],
tests: ["tests/**/*.{js,mjs}"],
},
jsdoc: {
options: {
destination: "docs",
template: "node_modules/ink-docstrap/template",
recurse: true,
readme: "./README.md",
configure: "docs/jsdoc.conf.json"
},
all: {
src: [
"src/**/*.js",
"src/**/*.mjs",
"!src/core/vendor/**/*"
],
}
},
accessibility: {
options: {
accessibilityLevel: "WCAG2A",
@@ -163,8 +159,7 @@ module.exports = function (grunt) {
mode: "production",
target: "web",
entry: Object.assign({
main: "./src/web/index.js",
sitemap: "./src/web/static/sitemap.js"
main: "./src/web/index.js"
}, moduleEntryPoints),
output: {
path: __dirname + "/build/prod",
@@ -201,46 +196,6 @@ module.exports = function (grunt) {
]
};
},
node: {
mode: NODE_PROD ? "production" : "development",
target: "node",
entry: "./src/node/index.mjs",
externals: [NodeExternals({
whitelist: ["crypto-api/src/crypto-api"]
})],
output: {
filename: "CyberChef.js",
path: __dirname + "/build/node",
library: "CyberChef",
libraryTarget: "commonjs2"
},
plugins: [
new webpack.DefinePlugin(BUILD_CONSTANTS),
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1
})
],
},
nodeRepl: {
mode: NODE_PROD ? "production" : "development",
target: "node",
entry: "./src/node/repl-index.mjs",
externals: [NodeExternals({
whitelist: ["crypto-api/src/crypto-api"]
})],
output: {
filename: "CyberChef-repl.js",
path: __dirname + "/build/node",
library: "CyberChef",
libraryTarget: "commonjs2"
},
plugins: [
new webpack.DefinePlugin(BUILD_CONSTANTS),
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1
})
],
}
},
"webpack-dev-server": {
options: {
@@ -295,7 +250,6 @@ module.exports = function (grunt) {
"build/prod/**/*",
"!build/prod/index.html",
"!build/prod/BundleAnalyzerReport.html",
"!build/prod/sitemap.js"
],
dest: `build/prod/CyberChef_v${pkg.version}.zip`
}
@@ -333,12 +287,7 @@ module.exports = function (grunt) {
{
src: "build/prod/index.html",
dest: "build/prod/index.html"
},
{
expand: true,
src: "docs/**",
dest: "build/prod/"
},
}
]
},
standalone: {
@@ -370,12 +319,6 @@ module.exports = function (grunt) {
mode: "755",
},
src: ["build/**/*", "build/"]
},
docs: {
options: {
mode: "755",
},
src: ["docs/**/*", "docs/"]
}
},
watch: {
@@ -392,33 +335,33 @@ module.exports = function (grunt) {
},
exec: {
repoSize: {
command: [
command: chainCommands([
"git ls-files | wc -l | xargs printf '\n%b\ttracked files\n'",
"du -hs | egrep -o '^[^\t]*' | xargs printf '%b\trepository size\n'"
].join(";"),
]),
stderr: false
},
cleanGit: {
command: "git gc --prune=now --aggressive"
},
sitemap: {
command: "node build/prod/sitemap.js > build/prod/sitemap.xml"
command: "node --experimental-modules --no-warnings --no-deprecation src/web/static/sitemap.mjs > build/prod/sitemap.xml"
},
generateConfig: {
command: [
command: chainCommands([
"echo '\n--- Regenerating config files. ---'",
"echo [] > src/core/config/OperationConfig.json",
"node --experimental-modules --no-warnings --no-deprecation src/core/config/scripts/generateOpsIndex.mjs",
"node --experimental-modules --no-warnings --no-deprecation src/core/config/scripts/generateConfig.mjs",
"echo '--- Config scripts finished. ---\n'"
].join(";")
])
},
generateNodeIndex: {
command: [
command: chainCommands([
"echo '\n--- Regenerating node index ---'",
"node --experimental-modules --no-warnings --no-deprecation src/node/config/scripts/generateNodeIndex.mjs",
"echo '--- Node index generated. ---\n'"
].join(";"),
]),
},
opTests: {
command: "node --experimental-modules --no-warnings --no-deprecation tests/operations/index.mjs"
@@ -428,7 +371,44 @@ module.exports = function (grunt) {
},
nodeTests: {
command: "node --experimental-modules --no-warnings --no-deprecation tests/node/index.mjs"
}
},
setupNodeConsumers: {
command: chainCommands([
"echo '\n--- Testing node consumers ---'",
"npm link",
`mkdir ${nodeConsumerTestPath}`,
`cp tests/node/consumers/* ${nodeConsumerTestPath}`,
`cd ${nodeConsumerTestPath}`,
"npm link cyberchef"
]),
},
teardownNodeConsumers: {
command: chainCommands([
`rm -rf ${nodeConsumerTestPath}`,
"echo '\n--- Node consumer tests complete ---'"
]),
},
testCJSNodeConsumer: {
command: chainCommands([
`cd ${nodeConsumerTestPath}`,
"node --no-warnings cjs-consumer.js",
]),
stdout: false,
},
testESMNodeConsumer: {
command: chainCommands([
`cd ${nodeConsumerTestPath}`,
"node --no-warnings --experimental-modules esm-consumer.mjs",
]),
stdout: false,
},
testESMDeepImportNodeConsumer: {
command: chainCommands([
`cd ${nodeConsumerTestPath}`,
"node --no-warnings --experimental-modules esm-deep-import-consumer.mjs",
]),
stdout: false,
},
},
});
};

View File

@@ -3,7 +3,6 @@
[![Build Status](https://travis-ci.org/gchq/CyberChef.svg?branch=master)](https://travis-ci.org/gchq/CyberChef)
[![dependencies Status](https://david-dm.org/gchq/CyberChef/status.svg)](https://david-dm.org/gchq/CyberChef)
[![npm](https://img.shields.io/npm/v/cyberchef.svg)](https://www.npmjs.com/package/cyberchef)
![](https://reposs.herokuapp.com/?path=gchq/CyberChef&color=blue)
[![](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/gchq/CyberChef/blob/master/LICENSE)
[![Gitter](https://badges.gitter.im/gchq/CyberChef.svg)](https://gitter.im/gchq/CyberChef?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
@@ -70,16 +69,28 @@ You can use as many operations as you like in simple or complex ways. Some examp
- You can save the output to a file at any time or load a file by dragging and dropping it into the input field. Files up to around 2GB are supported (depending on your browser), however some operations may take a very long time to run over this much data.
- CyberChef is entirely client-side
- It should be noted that none of your recipe configuration or input (either text or files) is ever sent to the CyberChef web server - all processing is carried out within your browser, on your own computer.
- Due to this feature, CyberChef can be compiled into a single HTML file. You can download this file and drop it into a virtual machine, share it with other people, or use it independently on your local machine.
- Due to this feature, CyberChef can be downloaded and run locally. You can use the link in the top left corner of the app to download a full copy of CyberChef and drop it into a virtual machine, share it with other people, or host it in a closed network.
## Deep linking
By manipulation of CyberChef's URL hash, you can change the initial settings with which the page opens.
The format is `https://gchq.github.io/CyberChef/#recipe=Operation()&input=...`
Supported arguments are `recipe`, `input` (encoded in Base64), and `theme`.
## Browser support
CyberChef is built to support
- Google Chrome 40+
- Mozilla Firefox 35+
- Microsoft Edge 14+
- Google Chrome 50+
- Mozilla Firefox 38+
## Node.js support
CyberChef is built to fully support Node.js `v10` and partially supports `v12`. Named imports using a deep import specifier does not work in `v12`. For more information, see the Node API page in the project [wiki pages](https://github.com/gchq/CyberChef/wiki)
## Contributing

26
SECURITY.md Normal file
View File

@@ -0,0 +1,26 @@
# Security Policy
## Supported Versions
CyberChef is supported on a best endeavours basis. Patches will be applied to
the latest version rather than retroactively to older versions. To ensure you
are using the most secure version of CyberChef, please make sure you have the
[latest release](https://github.com/gchq/CyberChef/releases/latest). The
official [live demo](https://gchq.github.io/CyberChef/) is always up to date.
## Reporting a Vulnerability
In most scenarios, the most appropriate way to report a vulnerability is to
[raise a new issue](https://github.com/gchq/CyberChef/issues/new/choose)
describing the problem in as much detail as possible, ideally with examples.
This will obviously be public. If you feel that the vulnerability is
significant enough to warrant a private disclosure, please email
[oss@gchq.gov.uk](mailto:oss@gchq.gov.uk) and
[n1474335@gmail.com](mailto:n1474335@gmail.com).
Disclosures of vulnerabilities in CyberChef are always welcomed. Whilst we aim
to write clean and secure code free from bugs, we recognise that this is an open
source project written by analysts in their spare time, relying on dozens of
open source libraries that are modified and updated on a regular basis. We hope
that the community will continue to support us as we endeavour to maintain and
develop this tool together.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,32 +0,0 @@
{
"tags": {
"allowUnknownTags": true
},
"plugins": [
"plugins/markdown",
"node_modules/jsdoc-babel"
],
"templates": {
"systemName": "CyberChef",
"footer": "",
"copyright": "&copy; Crown Copyright 2017",
"navType": "inline",
"theme": "cerulean",
"linenums": true,
"collapseSymbols": false,
"inverseNav": true,
"outputSourceFiles": true,
"outputSourcePath": true,
"dateFormat": "ddd MMM Do YYYY",
"sort": false,
"logoFile": "cyberchef-32x32.png",
"cleverLinks": false,
"monospaceLinks": false,
"protocol": "html://",
"methodHeadingReturns": false
},
"markdown": {
"parser": "gfm",
"hardwrap": true
}
}

2992
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "cyberchef",
"version": "9.0.4",
"version": "9.7.19",
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
"author": "n1474335 <n1474335@gmail.com>",
"homepage": "https://gchq.github.io/CyberChef",
@@ -27,29 +27,29 @@
"type": "git",
"url": "https://github.com/gchq/CyberChef/"
},
"main": "build/node/CyberChef.js",
"main": "src/node/cjs.js",
"module": "src/node/index.mjs",
"bugs": "https://github.com/gchq/CyberChef/issues",
"browserslist": [
"Chrome >= 40",
"Firefox >= 35",
"Edge >= 14",
"node >= 6.5"
"Chrome >= 50",
"Firefox >= 38",
"node >= 10"
],
"devDependencies": {
"@babel/core": "^7.5.0",
"@babel/plugin-transform-runtime": "^7.5.0",
"@babel/preset-env": "^7.5.0",
"autoprefixer": "^9.6.0",
"babel-eslint": "^10.0.2",
"@babel/core": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"autoprefixer": "^9.6.1",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"babel-plugin-dynamic-import-node": "^2.2.0",
"chromedriver": "^75.0.1",
"babel-plugin-dynamic-import-node": "^2.3.0",
"chromedriver": "^77.0.0",
"colors": "^1.3.3",
"css-loader": "^3.0.0",
"eslint": "^6.0.1",
"copy-webpack-plugin": "^5.0.4",
"css-loader": "^3.2.0",
"eslint": "^6.2.2",
"exports-loader": "^0.7.0",
"file-loader": "^4.0.0",
"file-loader": "^4.2.0",
"grunt": "^1.0.4",
"grunt-accessibility": "~6.0.0",
"grunt-chmod": "~1.1.1",
@@ -60,34 +60,31 @@
"grunt-contrib-watch": "^1.1.0",
"grunt-eslint": "^22.0.0",
"grunt-exec": "~3.0.0",
"grunt-jsdoc": "^2.4.0",
"grunt-webpack": "^3.1.3",
"grunt-zip": "^0.18.2",
"html-webpack-plugin": "^3.2.0",
"imports-loader": "^0.8.0",
"ink-docstrap": "^1.3.2",
"jsdoc-babel": "^0.5.0",
"mini-css-extract-plugin": "^0.7.0",
"nightwatch": "^1.1.13",
"mini-css-extract-plugin": "^0.8.0",
"nightwatch": "^1.2.1",
"node-sass": "^4.12.0",
"postcss-css-variables": "^0.13.0",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"prompt": "^1.0.0",
"sass-loader": "^7.1.0",
"sitemap": "^3.2.0",
"style-loader": "^0.23.1",
"svg-url-loader": "^3.0.0",
"url-loader": "^2.0.1",
"webpack": "^4.35.2",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-dev-server": "^3.7.2",
"sass-loader": "^8.0.0",
"sitemap": "^4.1.1",
"style-loader": "^1.0.0",
"svg-url-loader": "^3.0.1",
"url-loader": "^2.1.0",
"webpack": "^4.39.3",
"webpack-bundle-analyzer": "^3.4.1",
"webpack-dev-server": "^3.8.0",
"webpack-node-externals": "^1.7.2",
"worker-loader": "^2.0.0"
},
"dependencies": {
"@babel/polyfill": "^7.4.4",
"@babel/runtime": "^7.5.0",
"@babel/runtime": "^7.5.5",
"arrive": "^2.4.1",
"babel-plugin-transform-builtin-extend": "1.1.2",
"bcryptjs": "^2.4.3",
@@ -98,22 +95,22 @@
"bootstrap-material-design": "^4.1.2",
"bson": "^4.0.2",
"chi-squared": "^1.1.0",
"clippyjs": "0.0.3",
"core-js": "^3.1.4",
"crypto-api": "^0.8.3",
"core-js": "^3.2.1",
"crypto-api": "^0.8.5",
"crypto-js": "^3.1.9-1",
"ctph.js": "0.0.5",
"d3": "^5.9.7",
"d3": "^5.11.0",
"d3-hexbin": "^0.2.2",
"diff": "^4.0.1",
"es6-promisify": "^6.0.1",
"escodegen": "^1.11.1",
"es6-promisify": "^6.0.2",
"escodegen": "^1.12.0",
"esm": "^3.2.25",
"esmangle": "^1.0.1",
"esprima": "^4.0.1",
"exif-parser": "^0.1.12",
"file-saver": "^2.0.2",
"geodesy": "^1.1.3",
"highlight.js": "^9.15.8",
"highlight.js": "^9.15.10",
"jimp": "^0.6.4",
"jquery": "3.4.1",
"js-crc": "^0.2.0",
@@ -123,16 +120,17 @@
"jsonwebtoken": "^8.5.1",
"jsqr": "^1.2.0",
"jsrsasign": "8.0.12",
"kbpgp": "2.1.2",
"kbpgp": "2.1.3",
"libbzip2-wasm": "0.0.4",
"libyara-wasm": "0.0.12",
"lodash": "^4.17.11",
"libyara-wasm": "^1.0.1",
"lodash": "^4.17.15",
"loglevel": "^1.6.3",
"loglevel-message-prefix": "^3.0.0",
"markdown-it": "^9.1.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.25",
"moment-timezone": "^0.5.26",
"ngeohash": "^0.6.3",
"node-forge": "^0.8.5",
"node-forge": "^0.9.1",
"node-md6": "^0.1.0",
"nodom": "^2.2.0",
"notepack.io": "^2.2.0",
@@ -145,6 +143,7 @@
"sortablejs": "^1.9.0",
"split.js": "^1.5.11",
"ssdeep.js": "0.0.2",
"tesseract.js": "^2.0.0-alpha.15",
"ua-parser-js": "^0.7.20",
"utf8": "^3.0.0",
"vkbeautify": "^0.99.3",
@@ -156,13 +155,11 @@
"scripts": {
"start": "grunt dev",
"build": "grunt prod",
"node": "NODE_ENV=development grunt node",
"node-prod": "NODE_ENV=production grunt node",
"repl": "grunt node && node build/node/CyberChef-repl.js",
"repl": "node src/node/repl.js",
"test": "grunt test",
"test-node": "grunt test-node",
"test-node-consumer": "grunt testnodeconsumer",
"testui": "grunt testui",
"docs": "grunt docs",
"testuidev": "npx nightwatch --env=dev",
"lint": "grunt lint",
"newop": "node --experimental-modules src/core/config/scripts/newOperation.mjs"
}

View File

@@ -129,7 +129,7 @@ class Dish {
*
* @param {number} type - The data type of value, see Dish enums.
* @param {boolean} [notUTF8=false] - Do not treat strings as UTF8.
* @returns {* | Promise} - (Broswer) A promise | (Node) value of dish in given type
* @returns {* | Promise} - (Browser) A promise | (Node) value of dish in given type
*/
get(type, notUTF8=false) {
if (typeof type === "string") {
@@ -177,7 +177,7 @@ class Dish {
this.type = type;
if (!this.valid()) {
const sample = Utils.truncate(JSON.stringify(this.value), 13);
const sample = Utils.truncate(JSON.stringify(this.value), 25);
throw new DishError(`Data is not a valid ${Dish.enumLookup(type)}: ${sample}`);
}
}
@@ -191,7 +191,7 @@ class Dish {
*
* @param {number} type - The data type of value, see Dish enums.
* @param {boolean} [notUTF8=false] - Do not treat strings as UTF8.
* @returns {Dish | Promise} - (Broswer) A promise | (Node) value of dish in given type
* @returns {Dish | Promise} - (Browser) A promise | (Node) value of dish in given type
*/
presentAs(type, notUTF8=false) {
const clone = this.clone();

View File

@@ -201,9 +201,8 @@ class Utils {
* Utils.parseEscapedChars("\\n");
*/
static parseEscapedChars(str) {
return str.replace(/(\\)?\\([bfnrtv'"]|[0-3][0-7]{2}|[0-7]{1,2}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]{1,6}\}|\\)/g, function(m, a, b) {
if (a === "\\") return "\\"+b;
switch (b[0]) {
return str.replace(/\\([bfnrtv'"]|[0-3][0-7]{2}|[0-7]{1,2}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]{1,6}\}|\\)/g, function(m, a) {
switch (a[0]) {
case "\\":
return "\\";
case "0":
@@ -214,7 +213,7 @@ class Utils {
case "5":
case "6":
case "7":
return String.fromCharCode(parseInt(b, 8));
return String.fromCharCode(parseInt(a, 8));
case "b":
return "\b";
case "t":
@@ -232,12 +231,12 @@ class Utils {
case "'":
return "'";
case "x":
return String.fromCharCode(parseInt(b.substr(1), 16));
return String.fromCharCode(parseInt(a.substr(1), 16));
case "u":
if (b[1] === "{")
return String.fromCodePoint(parseInt(b.slice(2, -1), 16));
if (a[1] === "{")
return String.fromCodePoint(parseInt(a.slice(2, -1), 16));
else
return String.fromCharCode(parseInt(b.substr(1), 16));
return String.fromCharCode(parseInt(a.substr(1), 16));
}
});
}
@@ -1303,6 +1302,30 @@ export function sendStatusMessage(msg) {
console.debug(msg);
}
const debounceTimeouts = {};
/**
* Debouncer to stop functions from being executed multiple times in a
* short space of time
* https://davidwalsh.name/javascript-debounce-function
*
* @param {function} func - The function to be executed after the debounce time
* @param {number} wait - The time (ms) to wait before executing the function
* @param {string} id - Unique ID to reference the timeout for the function
* @param {object} scope - The object to bind to the debounced function
* @param {array} args - Array of arguments to be passed to func
* @returns {function}
*/
export function debounce(func, wait, id, scope, args) {
return function() {
const later = function() {
func.apply(scope, args);
};
clearTimeout(debounceTimeouts[id]);
debounceTimeouts[id] = setTimeout(later, wait);
};
}
/*
* Polyfills

View File

@@ -85,6 +85,8 @@
"Vigenère Decode",
"To Morse Code",
"From Morse Code",
"Bacon Cipher Encode",
"Bacon Cipher Decode",
"Bifid Cipher Encode",
"Bifid Cipher Decode",
"Affine Cipher Encode",
@@ -121,8 +123,10 @@
"Generate PGP Key Pair",
"PGP Encrypt",
"PGP Decrypt",
"PGP Verify",
"PGP Encrypt and Sign",
"PGP Decrypt and Verify"
"PGP Decrypt and Verify",
"Parse SSH Host Key"
]
},
{
@@ -166,6 +170,8 @@
"Parse IP range",
"Parse IPv6 address",
"Parse IPv4 header",
"Parse UDP",
"Parse SSH Host Key",
"Parse URI",
"URL Encode",
"URL Decode",
@@ -177,7 +183,8 @@
"Group IP addresses",
"Encode NetBIOS Name",
"Decode NetBIOS Name",
"Defang URL"
"Defang URL",
"Defang IP Addresses"
]
},
{
@@ -224,6 +231,7 @@
"Convert speed",
"Convert data units",
"Convert co-ordinate format",
"Show on map",
"Parse UNIX file permissions",
"Swap endianness",
"Parse colour code",
@@ -277,6 +285,7 @@
"Zip",
"Unzip",
"Bzip2 Decompress",
"Bzip2 Compress",
"Tar",
"Untar"
]
@@ -353,7 +362,8 @@
"BSON serialise",
"BSON deserialise",
"To MessagePack",
"From MessagePack"
"From MessagePack",
"Render Markdown"
]
},
{
@@ -362,8 +372,13 @@
"Detect File Type",
"Scan for Embedded Files",
"Extract Files",
"YARA Rules",
"Remove EXIF",
"Extract EXIF"
"Extract EXIF",
"Extract RGBA",
"View Bit Plane",
"Randomize Colour Palette",
"Extract LSB"
]
},
{
@@ -371,6 +386,7 @@
"ops": [
"Render Image",
"Play Media",
"Optical Character Recognition",
"Remove EXIF",
"Extract EXIF",
"Split Colour Channels",
@@ -388,6 +404,7 @@
"Cover Image",
"Image Hue/Saturation/Lightness",
"Sharpen Image",
"Normalise Image",
"Convert Image Format",
"Add Text To Image",
"Hex Density chart",

View File

@@ -0,0 +1,9 @@
import OperationError from "./OperationError.mjs";
import DishError from "./DishError.mjs";
import ExcludedOperationError from "./ExcludedOperationError";
export {
OperationError,
DishError,
ExcludedOperationError,
};

View File

@@ -109,7 +109,7 @@ export function mean(data) {
*/
export function median(data) {
if ((data.length % 2) === 0 && data.length > 0) {
data.sort(function(a, b){
data.sort(function(a, b) {
return a.minus(b);
});
const first = data[Math.floor(data.length / 2)];

View File

@@ -22,7 +22,7 @@ export const ENCODING_SCHEME = [
/**
* Lookup table for the binary value of each digit representation.
*
* I wrote a very nice algorithm to generate 8 4 2 1 encoding programatically,
* I wrote a very nice algorithm to generate 8 4 2 1 encoding programmatically,
* but unfortunately it's much easier (if less elegant) to use lookup tables
* when supporting multiple encoding schemes.
*

66
src/core/lib/Bacon.mjs Normal file
View File

@@ -0,0 +1,66 @@
/**
* Bacon Cipher resources.
*
* @author Karsten Silkenbäumer [github.com/kassi]
* @copyright Karsten Silkenbäumer 2019
* @license Apache-2.0
*/
/**
* Bacon definitions.
*/
export const BACON_ALPHABETS = {
"Standard (I=J and U=V)": {
alphabet: "ABCDEFGHIKLMNOPQRSTUWXYZ",
codes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23]
},
"Complete": {
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
}
};
export const BACON_TRANSLATION_01 = "0/1";
export const BACON_TRANSLATION_AB = "A/B";
export const BACON_TRANSLATION_CASE = "Case";
export const BACON_TRANSLATION_AMNZ = "A-M/N-Z first letter";
export const BACON_TRANSLATIONS = [
BACON_TRANSLATION_01,
BACON_TRANSLATION_AB,
BACON_TRANSLATION_CASE,
BACON_TRANSLATION_AMNZ,
];
export const BACON_TRANSLATIONS_FOR_ENCODING = [
BACON_TRANSLATION_01,
BACON_TRANSLATION_AB
];
export const BACON_CLEARER_MAP = {
[BACON_TRANSLATION_01]: /[^01]/g,
[BACON_TRANSLATION_AB]: /[^ABab]/g,
[BACON_TRANSLATION_CASE]: /[^A-Za-z]/g,
};
export const BACON_NORMALIZE_MAP = {
[BACON_TRANSLATION_AB]: {
"A": "0",
"B": "1",
"a": "0",
"b": "1"
},
};
/**
* Swaps zeros to ones and ones to zeros.
*
* @param {string} data
* @returns {string}
*
* @example
* // returns "11001 01010"
* swapZeroAndOne("00110 10101");
*/
export function swapZeroAndOne(string) {
return string.replace(/[01]/g, function (c) {
return {
"0": "1",
"1": "0"
}[c];
});
}

View File

@@ -7,12 +7,12 @@
*/
import Utils from "../Utils.mjs";
import OperationError from "../errors/OperationError.mjs";
/**
* Base64's the input byte array using the given alphabet, returning a string.
*
* @param {byteArray|Uint8Array|string} data
* @param {byteArray|Uint8Array|ArrayBuffer|string} data
* @param {string} [alphabet="A-Za-z0-9+/="]
* @returns {string}
*
@@ -25,11 +25,17 @@ import Utils from "../Utils.mjs";
*/
export function toBase64(data, alphabet="A-Za-z0-9+/=") {
if (!data) return "";
if (data instanceof ArrayBuffer) {
data = new Uint8Array(data);
}
if (typeof data == "string") {
data = Utils.strToByteArray(data);
}
alphabet = Utils.expandAlphRange(alphabet).join("");
if (alphabet.length !== 64 && alphabet.length !== 65) { // Allow for padding
throw new OperationError(`Invalid Base64 alphabet length (${alphabet.length}): ${alphabet}`);
}
let output = "",
chr1, chr2, chr3,
@@ -83,6 +89,9 @@ export function fromBase64(data, alphabet="A-Za-z0-9+/=", returnType="string", r
alphabet = alphabet || "A-Za-z0-9+/=";
alphabet = Utils.expandAlphRange(alphabet).join("");
if (alphabet.length !== 64 && alphabet.length !== 65) { // Allow for padding
throw new OperationError(`Invalid Base64 alphabet length (${alphabet.length}): ${alphabet}`);
}
const output = [];
let chr1, chr2, chr3,

View File

@@ -6,9 +6,22 @@
* @license Apache-2.0
*/
import geohash from "ngeohash";
import geodesy from "geodesy";
import OperationError from "../errors/OperationError.mjs";
import geohash from "ngeohash";
/*
Currently unable to update to geodesy v2 as we cannot load .js modules into a .mjs file.
When we do update, imports will look like this:
import LatLonEllipsoidal from "geodesy/latlon-ellipsoidal.js";
import Mgrs from "geodesy/mgrs.js";
import OsGridRef from "geodesy/osgridref.js";
import Utm from "geodesy/utm.js";
*/
import geodesy from "geodesy";
const LatLonEllipsoidal = geodesy.LatLonEllipsoidal,
Mgrs = geodesy.Mgrs,
OsGridRef = geodesy.OsGridRef,
Utm = geodesy.Utm;
/**
* Co-ordinate formats
@@ -116,22 +129,22 @@ export function convertCoordinates (input, inFormat, inDelim, outFormat, outDeli
switch (inFormat) {
case "Geohash":
hash = geohash.decode(input.replace(/[^A-Za-z0-9]/g, ""));
latlon = new geodesy.LatLonEllipsoidal(hash.latitude, hash.longitude);
latlon = new LatLonEllipsoidal(hash.latitude, hash.longitude);
break;
case "Military Grid Reference System":
utm = geodesy.Mgrs.parse(input.replace(/[^A-Za-z0-9]/g, "")).toUtm();
utm = Mgrs.parse(input.replace(/[^A-Za-z0-9]/g, "")).toUtm();
latlon = utm.toLatLonE();
break;
case "Ordnance Survey National Grid":
osng = geodesy.OsGridRef.parse(input.replace(/[^A-Za-z0-9]/g, ""));
latlon = geodesy.OsGridRef.osGridToLatLon(osng);
osng = OsGridRef.parse(input.replace(/[^A-Za-z0-9]/g, ""));
latlon = OsGridRef.osGridToLatLon(osng);
break;
case "Universal Transverse Mercator":
// Geodesy needs a space between the first 2 digits and the next letter
if (/^[\d]{2}[A-Za-z]/.test(input)) {
input = input.slice(0, 2) + " " + input.slice(2);
}
utm = geodesy.Utm.parse(input);
utm = Utm.parse(input);
latlon = utm.toLatLonE();
break;
case "Degrees Minutes Seconds":
@@ -143,7 +156,7 @@ export function convertCoordinates (input, inFormat, inDelim, outFormat, outDeli
if (splitLat.length >= 3 && splitLong.length >= 3) {
lat = convDMSToDD(splitLat[0], splitLat[1], splitLat[2], 10);
lon = convDMSToDD(splitLong[0], splitLong[1], splitLong[2], 10);
latlon = new geodesy.LatLonEllipsoidal(lat.degrees, lon.degrees);
latlon = new LatLonEllipsoidal(lat.degrees, lon.degrees);
} else {
throw new OperationError("Invalid co-ordinate format for Degrees Minutes Seconds");
}
@@ -152,7 +165,7 @@ export function convertCoordinates (input, inFormat, inDelim, outFormat, outDeli
splitLat = splitInput(split[0]);
if (splitLat.length >= 3) {
lat = convDMSToDD(splitLat[0], splitLat[1], splitLat[2]);
latlon = new geodesy.LatLonEllipsoidal(lat.degrees, lat.degrees);
latlon = new LatLonEllipsoidal(lat.degrees, lat.degrees);
} else {
throw new OperationError("Invalid co-ordinate format for Degrees Minutes Seconds");
}
@@ -168,7 +181,7 @@ export function convertCoordinates (input, inFormat, inDelim, outFormat, outDeli
// Convert to decimal degrees, and then convert to a geodesy object
lat = convDDMToDD(splitLat[0], splitLat[1], 10);
lon = convDDMToDD(splitLong[0], splitLong[1], 10);
latlon = new geodesy.LatLonEllipsoidal(lat.degrees, lon.degrees);
latlon = new LatLonEllipsoidal(lat.degrees, lon.degrees);
} else {
// Not a pair, so only try to convert one set of co-ordinates
splitLat = splitInput(input);
@@ -176,7 +189,7 @@ export function convertCoordinates (input, inFormat, inDelim, outFormat, outDeli
throw new OperationError("Invalid co-ordinate format for Degrees Decimal Minutes.");
}
lat = convDDMToDD(splitLat[0], splitLat[1], 10);
latlon = new geodesy.LatLonEllipsoidal(lat.degrees, lat.degrees);
latlon = new LatLonEllipsoidal(lat.degrees, lat.degrees);
}
break;
case "Decimal Degrees":
@@ -186,14 +199,14 @@ export function convertCoordinates (input, inFormat, inDelim, outFormat, outDeli
if (splitLat.length !== 1 || splitLong.length !== 1) {
throw new OperationError("Invalid co-ordinate format for Decimal Degrees.");
}
latlon = new geodesy.LatLonEllipsoidal(splitLat[0], splitLong[0]);
latlon = new LatLonEllipsoidal(splitLat[0], splitLong[0]);
} else {
// Not a pair, so only try to convert one set of co-ordinates
splitLat = splitInput(split[0]);
if (splitLat.length !== 1) {
throw new OperationError("Invalid co-ordinate format for Decimal Degrees.");
}
latlon = new geodesy.LatLonEllipsoidal(splitLat[0], splitLat[0]);
latlon = new LatLonEllipsoidal(splitLat[0], splitLat[0]);
}
break;
default:
@@ -260,7 +273,7 @@ export function convertCoordinates (input, inFormat, inDelim, outFormat, outDeli
convLat = mgrs.toString(precision);
break;
case "Ordnance Survey National Grid":
osng = geodesy.OsGridRef.latLonToOsGrid(latlon);
osng = OsGridRef.latLonToOsGrid(latlon);
if (osng.toString() === "") {
throw new OperationError("Could not convert co-ordinates to OS National Grid. Are the co-ordinates in range?");
}
@@ -327,13 +340,13 @@ export function convertCoordinates (input, inFormat, inDelim, outFormat, outDeli
* @param {string} input - The input data to be split
* @returns {number[]} An array of the different items in the string, stored as floats
*/
function splitInput (input){
function splitInput (input) {
const split = [];
input.split(/\s+/).forEach(item => {
// Remove any character that isn't a digit, decimal point or negative sign
item = item.replace(/[^0-9.-]/g, "");
if (item.length > 0){
if (item.length > 0) {
// Turn the item into a float
split.push(parseFloat(item));
}
@@ -350,7 +363,7 @@ function splitInput (input){
* @param {number} precision - The precision the result should be rounded to
* @returns {{string: string, degrees: number}} An object containing the raw converted value (obj.degrees), and a formatted string version (obj.string)
*/
function convDMSToDD (degrees, minutes, seconds, precision){
function convDMSToDD (degrees, minutes, seconds, precision) {
const absDegrees = Math.abs(degrees);
let conv = absDegrees + (minutes / 60) + (seconds / 3600);
let outString = round(conv, precision) + "°";
@@ -566,7 +579,7 @@ export function findFormat (input, delim) {
// Test DMS/DDM/DD formats
if (testData !== undefined) {
const split = splitInput(testData);
switch (split.length){
switch (split.length) {
case 3:
return "Degrees Minutes Seconds";
case 2:

View File

@@ -32,7 +32,7 @@ export const WORD_DELIM_OPTIONS = ["Line feed", "CRLF", "Forward slash", "Backsl
export const INPUT_DELIM_OPTIONS = ["Line feed", "CRLF", "Space", "Comma", "Semi-colon", "Colon", "Nothing (separate chars)"];
/**
* Armithmetic sequence delimiters
* Arithmetic sequence delimiters
*/
export const ARITHMETIC_DELIM_OPTIONS = ["Line feed", "Space", "Comma", "Semi-colon", "Colon", "CRLF"];
@@ -72,3 +72,12 @@ export const JOIN_DELIM_OPTIONS = [
{name: "Nothing (join chars)", value: ""}
];
/**
* RGBA list delimiters.
*/
export const RGBA_DELIM_OPTIONS = [
{name: "Comma", value: ","},
{name: "Space", value: " "},
{name: "CRLF", value: "\\r\\n"},
{name: "Line Feed", value: "\n"}
];

File diff suppressed because it is too large Load Diff

View File

@@ -75,7 +75,7 @@ function bytesMatch(sig, buf, offset=0) {
* Given a buffer, detects magic byte sequences at specific positions and returns the
* extension and mime type.
*
* @param {Uint8Array} buf
* @param {Uint8Array|ArrayBuffer} buf
* @param {string[]} [categories=All] - Which categories of file to look for
* @returns {Object[]} types
* @returns {string} type.name - Name of file type
@@ -84,6 +84,10 @@ function bytesMatch(sig, buf, offset=0) {
* @returns {string} [type.desc] - Description
*/
export function detectFileType(buf, categories=Object.keys(FILE_SIGNATURES)) {
if (buf instanceof ArrayBuffer) {
buf = new Uint8Array(buf);
}
if (!(buf && buf.length > 1)) {
return [];
}
@@ -174,7 +178,7 @@ export function scanForFileTypes(buf, categories=Object.keys(FILE_SIGNATURES)) {
* @param {Uint8Array} buf - The buffer to search
* @param {Object} sig - A single signature object (Not an array of signatures)
* @param {number} offset - Where to start search from
* @returs {number} The position of the match or -1 if one cannot be found.
* @returns {number} The position of the match or -1 if one cannot be found.
*/
function locatePotentialSig(buf, sig, offset) {
// Find values for first key and value in sig
@@ -203,7 +207,7 @@ function locatePotentialSig(buf, sig, offset) {
* Detects whether the given buffer is a file of the type specified.
*
* @param {string|RegExp} type
* @param {Uint8Array} buf
* @param {Uint8Array|ArrayBuffer} buf
* @returns {string|false} The mime type or false if the type does not match
*/
export function isType(type, buf) {
@@ -230,7 +234,7 @@ export function isType(type, buf) {
/**
* Detects whether the given buffer contains an image file.
*
* @param {Uint8Array} buf
* @param {Uint8Array|ArrayBuffer} buf
* @returns {string|false} The mime type or false if the type does not match
*/
export function isImage(buf) {

View File

@@ -241,7 +241,7 @@ export function ipv6ListedRange(match, includeNetworkInfo) {
ipv6List = ipv6List.filter(function(str) {
return str.trim();
});
for (let i =0; i < ipv6List.length; i++){
for (let i =0; i < ipv6List.length; i++) {
ipv6List[i] = ipv6List[i].trim();
}
const ipv6CidrList = ipv6List.filter(function(a) {
@@ -502,8 +502,8 @@ export function ipv6Compare(a, b) {
const a_ = strToIpv6(a),
b_ = strToIpv6(b);
for (let i = 0; i < a_.length; i++){
if (a_[i] !== b_[i]){
for (let i = 0; i < a_.length; i++) {
if (a_[i] !== b_[i]) {
return a_[i] - b_[i];
}
}

View File

@@ -85,7 +85,7 @@ function getWords(length=3) {
const words = [];
let word;
let previousWord;
while (words.length < length){
while (words.length < length) {
do {
word = wordList[Math.floor(Math.random() * wordList.length)];
} while (previousWord === word);

View File

@@ -97,6 +97,7 @@ class Magic {
if (!fileType.length) return null;
return {
name: fileType[0].name,
ext: fileType[0].extension,
mime: fileType[0].mime,
desc: fileType[0].description

View File

@@ -205,7 +205,7 @@ class Protobuf {
(this.data[this.offset] & this.VALUE) << shift :
(this.data[this.offset] & this.VALUE) * Math.pow(2, shift);
shift += 7;
} while ((this.data[this.offset++] & this.MSD) === this.MSB);
} while ((this.data[this.offset++] & this.MSB) === this.MSB);
return fieldNumber;
}

View File

@@ -37,7 +37,7 @@ export async function parseQrCode(input, normalise) {
image = await jimp.read(image);
}
} catch (err) {
throw new OperationError(`Error normalising iamge. (${err})`);
throw new OperationError(`Error normalising image. (${err})`);
}
const qrData = jsQR(image.bitmap.data, image.getWidth(), image.getHeight());

View File

@@ -71,8 +71,8 @@ class AESDecrypt extends Operation {
* @throws {OperationError} if cannot decrypt input or invalid key length
*/
run(input, args) {
const key = Utils.convertToByteArray(args[0].string, args[0].option),
iv = Utils.convertToByteArray(args[1].string, args[1].option),
const key = Utils.convertToByteString(args[0].string, args[0].option),
iv = Utils.convertToByteString(args[1].string, args[1].option),
mode = args[2],
inputType = args[3],
outputType = args[4],
@@ -91,7 +91,7 @@ The following algorithms will be used based on the size of the key:
const decipher = forge.cipher.createDecipher("AES-" + mode, key);
decipher.start({
iv: iv,
iv: iv.length === 0 ? "" : iv,
tag: gcmTag
});
decipher.update(forge.util.createBuffer(input));

View File

@@ -121,7 +121,7 @@ class AddTextToImage extends Operation {
let xPos = args[3],
yPos = args[4];
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -50,7 +50,7 @@ class BLAKE2b extends Operation {
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {string} The input having been hashed with BLAKE2b in the encoding format speicifed.
* @returns {string} The input having been hashed with BLAKE2b in the encoding format specified.
*/
run(input, args) {
const [outSize, outFormat] = args;

View File

@@ -51,7 +51,7 @@ class BLAKE2s extends Operation {
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {string} The input having been hashed with BLAKE2s in the encoding format speicifed.
* @returns {string} The input having been hashed with BLAKE2s in the encoding format specified.
*/
run(input, args) {
const [outSize, outFormat] = args;

View File

@@ -0,0 +1,107 @@
/**
* @author Karsten Silkenbäumer [github.com/kassi]
* @copyright Karsten Silkenbäumer 2019
* @license Apache-2.0
*/
import Operation from "../Operation";
import {
BACON_ALPHABETS,
BACON_TRANSLATION_CASE, BACON_TRANSLATION_AMNZ, BACON_TRANSLATIONS, BACON_CLEARER_MAP, BACON_NORMALIZE_MAP,
swapZeroAndOne
} from "../lib/Bacon";
/**
* Bacon Cipher Decode operation
*/
class BaconCipherDecode extends Operation {
/**
* BaconCipherDecode constructor
*/
constructor() {
super();
this.name = "Bacon Cipher Decode";
this.module = "Default";
this.description = "Bacon's cipher or the Baconian cipher is a method of steganography devised by Francis Bacon in 1605. A message is concealed in the presentation of text, rather than its content.";
this.infoURL = "https://wikipedia.org/wiki/Bacon%27s_cipher";
this.inputType = "string";
this.outputType = "string";
this.args = [
{
"name": "Alphabet",
"type": "option",
"value": Object.keys(BACON_ALPHABETS)
},
{
"name": "Translation",
"type": "option",
"value": BACON_TRANSLATIONS
},
{
"name": "Invert Translation",
"type": "boolean",
"value": false
}
];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
const [alphabet, translation, invert] = args;
const alphabetObject = BACON_ALPHABETS[alphabet];
// remove invalid characters
input = input.replace(BACON_CLEARER_MAP[translation], "");
// normalize to unique alphabet
if (BACON_NORMALIZE_MAP[translation] !== undefined) {
input = input.replace(/./g, function (c) {
return BACON_NORMALIZE_MAP[translation][c];
});
} else if (translation === BACON_TRANSLATION_CASE) {
const codeA = "A".charCodeAt(0);
const codeZ = "Z".charCodeAt(0);
input = input.replace(/./g, function (c) {
const code = c.charCodeAt(0);
if (code >= codeA && code <= codeZ) {
return "1";
} else {
return "0";
}
});
} else if (translation === BACON_TRANSLATION_AMNZ) {
const words = input.split(/\s+/);
const letters = words.map(function (e) {
if (e) {
const code = e[0].toUpperCase().charCodeAt(0);
return code >= "N".charCodeAt(0) ? "1" : "0";
} else {
return "";
}
});
input = letters.join("");
}
if (invert) {
input = swapZeroAndOne(input);
}
// group into 5
const inputArray = input.match(/(.{5})/g) || [];
let output = "";
for (let i = 0; i < inputArray.length; i++) {
const code = inputArray[i];
const number = parseInt(code, 2);
output += number < alphabetObject.alphabet.length ? alphabetObject.alphabet[number] : "?";
}
return output;
}
}
export default BaconCipherDecode;

View File

@@ -0,0 +1,101 @@
/**
* @author Karsten Silkenbäumer [github.com/kassi]
* @copyright Karsten Silkenbäumer 2019
* @license Apache-2.0
*/
import Operation from "../Operation";
import {
BACON_ALPHABETS,
BACON_TRANSLATIONS_FOR_ENCODING, BACON_TRANSLATION_AB,
swapZeroAndOne
} from "../lib/Bacon";
/**
* Bacon Cipher Encode operation
*/
class BaconCipherEncode extends Operation {
/**
* BaconCipherEncode constructor
*/
constructor() {
super();
this.name = "Bacon Cipher Encode";
this.module = "Default";
this.description = "Bacon's cipher or the Baconian cipher is a method of steganography devised by Francis Bacon in 1605. A message is concealed in the presentation of text, rather than its content.";
this.infoURL = "https://wikipedia.org/wiki/Bacon%27s_cipher";
this.inputType = "string";
this.outputType = "string";
this.args = [
{
"name": "Alphabet",
"type": "option",
"value": Object.keys(BACON_ALPHABETS)
},
{
"name": "Translation",
"type": "option",
"value": BACON_TRANSLATIONS_FOR_ENCODING
},
{
"name": "Keep extra characters",
"type": "boolean",
"value": false
},
{
"name": "Invert Translation",
"type": "boolean",
"value": false
}
];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
const [alphabet, translation, keep, invert] = args;
const alphabetObject = BACON_ALPHABETS[alphabet];
const charCodeA = "A".charCodeAt(0);
const charCodeZ = "Z".charCodeAt(0);
let output = input.replace(/./g, function (c) {
const charCode = c.toUpperCase().charCodeAt(0);
if (charCode >= charCodeA && charCode <= charCodeZ) {
let code = charCode - charCodeA;
if (alphabetObject.codes !== undefined) {
code = alphabetObject.codes[code];
}
const bacon = ("00000" + code.toString(2)).substr(-5, 5);
return bacon;
} else {
return c;
}
});
if (invert) {
output = swapZeroAndOne(output);
}
if (!keep) {
output = output.replace(/[^01]/g, "");
const outputArray = output.match(/(.{5})/g) || [];
output = outputArray.join(" ");
}
if (translation === BACON_TRANSLATION_AB) {
output = output.replace(/[01]/g, function (c) {
return {
"0": "A",
"1": "B"
}[c];
});
}
return output;
}
}
export default BaconCipherEncode;

View File

@@ -53,7 +53,7 @@ class BlurImage extends Operation {
async run(input, args) {
const [blurAmount, blurType] = args;
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}
@@ -64,7 +64,7 @@ class BlurImage extends Operation {
throw new OperationError(`Error loading image. (${err})`);
}
try {
switch (blurType){
switch (blurType) {
case "Fast":
if (isWorkerEnvironment())
self.sendStatusMessage("Fast blurring image...");

View File

@@ -47,7 +47,7 @@ class Bzip2Decompress extends Operation {
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
async run(input, args) {
const [small] = args;
if (input.byteLength <= 0) {
throw new OperationError("Please provide an input.");

View File

@@ -29,12 +29,12 @@ class ChangeIPFormat extends Operation {
{
"name": "Input format",
"type": "option",
"value": ["Dotted Decimal", "Decimal", "Hex"]
"value": ["Dotted Decimal", "Decimal", "Octal", "Hex"]
},
{
"name": "Output format",
"type": "option",
"value": ["Dotted Decimal", "Decimal", "Hex"]
"value": ["Dotted Decimal", "Decimal", "Octal", "Hex"]
}
];
}
@@ -54,7 +54,6 @@ class ChangeIPFormat extends Operation {
if (lines[i] === "") continue;
let baIp = [];
let octets;
let decimal;
if (inFormat === outFormat) {
output += lines[i] + "\n";
@@ -70,11 +69,10 @@ class ChangeIPFormat extends Operation {
}
break;
case "Decimal":
decimal = lines[i].toString();
baIp.push(decimal >> 24 & 255);
baIp.push(decimal >> 16 & 255);
baIp.push(decimal >> 8 & 255);
baIp.push(decimal & 255);
baIp = this.fromNumber(lines[i].toString(), 10);
break;
case "Octal":
baIp = this.fromNumber(lines[i].toString(), 8);
break;
case "Hex":
baIp = fromHex(lines[i]);
@@ -100,6 +98,10 @@ class ChangeIPFormat extends Operation {
decIp = ((baIp[0] << 24) | (baIp[1] << 16) | (baIp[2] << 8) | baIp[3]) >>> 0;
output += decIp.toString() + "\n";
break;
case "Octal":
decIp = ((baIp[0] << 24) | (baIp[1] << 16) | (baIp[2] << 8) | baIp[3]) >>> 0;
output += "0" + decIp.toString(8) + "\n";
break;
case "Hex":
hexIp = "";
for (j = 0; j < baIp.length; j++) {
@@ -115,6 +117,22 @@ class ChangeIPFormat extends Operation {
return output.slice(0, output.length-1);
}
/**
* Constructs an array of IP address octets from a numerical value.
* @param {string} value The value of the IP address
* @param {number} radix The numeral system to be used
* @returns {number[]}
*/
fromNumber(value, radix) {
const decimal = parseInt(value, radix);
const baIp = [];
baIp.push(decimal >> 24 & 255);
baIp.push(decimal >> 16 & 255);
baIp.push(decimal >> 8 & 255);
baIp.push(decimal & 255);
return baIp;
}
}
export default ChangeIPFormat;

View File

@@ -107,7 +107,7 @@ class ContainImage extends Operation {
"Bottom": jimp.VERTICAL_ALIGN_BOTTOM
};
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -54,7 +54,7 @@ class ConvertDataUnits extends Operation {
const DATA_UNITS = [
"Bits (b)", "Nibbles", "Octets", "Bytes (B)",
"[Binary bits (2^n)]", "Kibibits (Kib)", "Mebibits (Mib)", "Gibibits (Gib)", "Tebibits (Tib)", "Pebibits (Pib)", "Exbibits (Eib)", "Zebibits (Zib)", "Yobibits (Yib)", "[/Binary bits (2^n)]",
"[Decimal bits (10^n)]", "Decabits", "Hectobits", "Kilobits (kb)", "Megabits (Mb)", "Gigabits (Gb)", "Terabits (Tb)", "Petabits (Pb)", "Exabits (Eb)", "Zettabits (Zb)", "Yottabits (Yb)", "[/Decimal bits (10^n)]",
"[Decimal bits (10^n)]", "Decabits", "Hectobits", "Kilobits (Kb)", "Megabits (Mb)", "Gigabits (Gb)", "Terabits (Tb)", "Petabits (Pb)", "Exabits (Eb)", "Zettabits (Zb)", "Yottabits (Yb)", "[/Decimal bits (10^n)]",
"[Binary bytes (8 x 2^n)]", "Kibibytes (KiB)", "Mebibytes (MiB)", "Gibibytes (GiB)", "Tebibytes (TiB)", "Pebibytes (PiB)", "Exbibytes (EiB)", "Zebibytes (ZiB)", "Yobibytes (YiB)", "[/Binary bytes (8 x 2^n)]",
"[Decimal bytes (8 x 10^n)]", "Kilobytes (KB)", "Megabytes (MB)", "Gigabytes (GB)", "Terabytes (TB)", "Petabytes (PB)", "Exabytes (EB)", "Zettabytes (ZB)", "Yottabytes (YB)", "[/Decimal bytes (8 x 10^n)]"
];

View File

@@ -93,7 +93,7 @@ class ConvertImageFormat extends Operation {
const mime = formatMap[format];
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file format.");
}
let image;

View File

@@ -102,7 +102,7 @@ class CoverImage extends Operation {
"Bottom": jimp.VERTICAL_ALIGN_BOTTOM
};
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -93,7 +93,7 @@ class CropImage extends Operation {
*/
async run(input, args) {
const [xPos, yPos, width, height, autocrop, autoTolerance, autoFrames, autoSymmetric, autoBorder] = args;
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -73,6 +73,12 @@ class DESDecrypt extends Operation {
DES uses a key length of 8 bytes (64 bits).
Triple DES uses a key length of 24 bytes (192 bits).`);
}
if (iv.length !== 8 && mode !== "ECB") {
throw new OperationError(`Invalid IV length: ${iv.length} bytes
DES uses an IV length of 8 bytes (64 bits).
Make sure you have specified the type correctly (e.g. Hex vs UTF8).`);
}
input = Utils.convertToByteString(input, inputType);

View File

@@ -73,6 +73,12 @@ class DESEncrypt extends Operation {
DES uses a key length of 8 bytes (64 bits).
Triple DES uses a key length of 24 bytes (192 bits).`);
}
if (iv.length !== 8 && mode !== "ECB") {
throw new OperationError(`Invalid IV length: ${iv.length} bytes
DES uses an IV length of 8 bytes (64 bits).
Make sure you have specified the type correctly (e.g. Hex vs UTF8).`);
}
input = Utils.convertToByteString(input, inputType);

View File

@@ -111,7 +111,7 @@ class DNSOverHTTPS extends Operation {
* @returns {JSON}
*/
function extractData(data) {
if (typeof(data) == "undefined"){
if (typeof(data) == "undefined") {
return [];
} else {
const dataValues = [];

View File

@@ -0,0 +1,61 @@
/**
* @author h345983745
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import Operation from "../Operation";
/**
* Defang IP Addresses operation
*/
class DefangIPAddresses extends Operation {
/**
* DefangIPAddresses constructor
*/
constructor() {
super();
this.name = "Defang IP Addresses";
this.module = "Default";
this.description = "Takes a IPv4 or IPv6 address and 'Defangs' it, meaning the IP becomes invalid, removing the risk of accidentally utilising it as an IP address.";
this.infoURL = "https://isc.sans.edu/forums/diary/Defang+all+the+things/22744/";
this.inputType = "string";
this.outputType = "string";
this.args = [];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
input = input.replace(IPV4_REGEX, x => {
return x.replace(/\./g, "[.]");
});
input = input.replace(IPV6_REGEX, x => {
return x.replace(/:/g, "[:]");
});
return input;
}
}
export default DefangIPAddresses;
/**
* IPV4 regular expression
*/
const IPV4_REGEX = new RegExp("(?:(?:\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d|\\d)(?:\\/\\d{1,2})?", "g");
/**
* IPV6 regular expression
*/
const IPV6_REGEX = new RegExp("((?=.*::)(?!.*::.+::)(::)?([\\dA-Fa-f]{1,4}:(:|\\b)|){5}|([\\dA-Fa-f]{1,4}:){6})((([\\dA-Fa-f]{1,4}((?!\\3)::|:\\b|(?![\\dA-Fa-f])))|(?!\\2\\3)){2}|(((2[0-4]|1\\d|[1-9])?\\d|25[0-5])\\.?\\b){4})", "g");

View File

@@ -8,6 +8,13 @@ import Operation from "../Operation.mjs";
import {detectFileType} from "../lib/FileType.mjs";
import {FILE_SIGNATURES} from "../lib/FileSignatures.mjs";
// Concat all supported extensions into a single flat list
const exts = [].concat.apply([], Object.keys(FILE_SIGNATURES).map(cat =>
[].concat.apply([], FILE_SIGNATURES[cat].map(sig =>
sig.extension.split(",")
))
)).unique().sort().join(", ");
/**
* Detect File Type operation
*/
@@ -22,11 +29,7 @@ class DetectFileType extends Operation {
this.name = "Detect File Type";
this.module = "Default";
this.description = "Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.<br><br>Currently supports the following file types: " +
Object.keys(FILE_SIGNATURES).map(cat =>
FILE_SIGNATURES[cat].map(sig =>
sig.extension.split(",")[0]
).join(", ")
).join(", ") + ".";
exts + ".";
this.infoURL = "https://wikipedia.org/wiki/List_of_file_signatures";
this.inputType = "ArrayBuffer";
this.outputType = "string";

View File

@@ -38,7 +38,7 @@ class DitherImage extends Operation {
* @returns {byteArray}
*/
async run(input, args) {
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -20,7 +20,7 @@ class ExtractDomains extends Operation {
this.name = "Extract domains";
this.module = "Regex";
this.description = "Extracts domain names.<br>Note that this will not include paths. Use <strong>Extract URLs</strong> to find entire URLs.";
this.description = "Extracts fully qualified domain names.<br>Note that this will not include paths. Use <strong>Extract URLs</strong> to find entire URLs.";
this.inputType = "string";
this.outputType = "string";
this.args = [

View File

@@ -0,0 +1,114 @@
/**
* @author Ge0rg3 [georgeomnet+cyberchef@gmail.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
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";
/**
* Extract LSB operation
*/
class ExtractLSB extends Operation {
/**
* ExtractLSB constructor
*/
constructor() {
super();
this.name = "Extract LSB";
this.module = "Image";
this.description = "Extracts the Least Significant Bit data from each pixel in an image. This is a common way to hide data in Steganography.";
this.infoURL = "https://wikipedia.org/wiki/Bit_numbering#Least_significant_bit_in_digital_steganography";
this.inputType = "ArrayBuffer";
this.outputType = "byteArray";
this.args = [
{
name: "Colour Pattern #1",
type: "option",
value: COLOUR_OPTIONS,
},
{
name: "Colour Pattern #2",
type: "option",
value: ["", ...COLOUR_OPTIONS],
},
{
name: "Colour Pattern #3",
type: "option",
value: ["", ...COLOUR_OPTIONS],
},
{
name: "Colour Pattern #4",
type: "option",
value: ["", ...COLOUR_OPTIONS],
},
{
name: "Pixel Order",
type: "option",
value: ["Row", "Column"],
},
{
name: "Bit",
type: "number",
value: 0
}
];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {byteArray}
*/
async run(input, args) {
if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
const bit = 7 - args.pop(),
pixelOrder = args.pop(),
colours = args.filter(option => option !== "").map(option => COLOUR_OPTIONS.indexOf(option)),
parsedImage = await jimp.read(input),
width = parsedImage.bitmap.width,
height = parsedImage.bitmap.height,
rgba = parsedImage.bitmap.data;
if (bit < 0 || bit > 7) {
throw new OperationError("Error: Bit argument must be between 0 and 7");
}
let i, combinedBinary = "";
if (pixelOrder === "Row") {
for (i = 0; i < rgba.length; i += 4) {
for (const colour of colours) {
combinedBinary += Utils.bin(rgba[i + colour])[bit];
}
}
} else {
let rowWidth;
const pixelWidth = width * 4;
for (let col = 0; col < width; col++) {
for (let row = 0; row < height; row++) {
rowWidth = row * pixelWidth;
for (const colour of colours) {
i = rowWidth + (col + colour * 4);
combinedBinary += Utils.bin(rgba[i])[bit];
}
}
}
}
return fromBinary(combinedBinary);
}
}
const COLOUR_OPTIONS = ["R", "G", "B", "A"];
export default ExtractLSB;

View File

@@ -0,0 +1,65 @@
/**
* @author Ge0rg3 [georgeomnet+cyberchef@gmail.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs";
import jimp from "jimp";
import {RGBA_DELIM_OPTIONS} from "../lib/Delim.mjs";
/**
* Extract RGBA operation
*/
class ExtractRGBA extends Operation {
/**
* ExtractRGBA constructor
*/
constructor() {
super();
this.name = "Extract RGBA";
this.module = "Image";
this.description = "Extracts each pixel's RGBA value in an image. These are sometimes used in Steganography to hide text or data.";
this.infoURL = "https://wikipedia.org/wiki/RGBA_color_space";
this.inputType = "ArrayBuffer";
this.outputType = "string";
this.args = [
{
name: "Delimiter",
type: "editableOption",
value: RGBA_DELIM_OPTIONS
},
{
name: "Include Alpha",
type: "boolean",
value: true
}
];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {string}
*/
async run(input, args) {
if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
const delimiter = args[0],
includeAlpha = args[1],
parsedImage = await jimp.read(input);
let bitmap = parsedImage.bitmap.data;
bitmap = includeAlpha ? bitmap : bitmap.filter((val, idx) => idx % 4 !== 3);
return bitmap.join(delimiter);
}
}
export default ExtractRGBA;

View File

@@ -45,7 +45,7 @@ class FlipImage extends Operation {
*/
async run(input, args) {
const [flipAxis] = args;
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid input file type.");
}
@@ -58,7 +58,7 @@ class FlipImage extends Operation {
try {
if (isWorkerEnvironment())
self.sendStatusMessage("Flipping image...");
switch (flipAxis){
switch (flipAxis) {
case "Horizontal":
image.flip(true, false);
break;

View File

@@ -76,8 +76,8 @@ class Fork extends Operation {
}
const recipe = new Recipe();
let output = "",
progress = 0;
const outputs = [];
let progress = 0;
state.forkOffset += state.progress + 1;
@@ -104,10 +104,10 @@ class Fork extends Operation {
}
progress = err.progress + 1;
}
output += await dish.get(outputType) + mergeDelim;
outputs.push(await dish.get(outputType));
}
state.dish.set(output, outputType);
state.dish.set(outputs.join(mergeDelim), outputType);
state.progress += progress;
return state;
}

View File

@@ -23,7 +23,7 @@ class FromQuotedPrintable extends Operation {
this.name = "From Quoted Printable";
this.module = "Default";
this.description = "Converts QP-encoded text back to standard text.";
this.description = "Converts QP-encoded text back to standard text.<br><br>e.g. The quoted-printable encoded string <code>hello=20world</code> becomes <code>hello world</code>";
this.infoURL = "https://wikipedia.org/wiki/Quoted-printable";
this.inputType = "string";
this.outputType = "byteArray";

View File

@@ -47,7 +47,7 @@ class GenerateLoremIpsum extends Operation {
*/
run(input, args) {
const [length, lengthType] = args;
if (length < 1){
if (length < 1) {
throw new OperationError("Length must be greater than 0");
}
switch (lengthType) {

View File

@@ -58,7 +58,7 @@ class GeneratePGPKeyPair extends Operation {
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
async run(input, args) {
const [keyType, keySize] = args[0].split("-"),
password = args[1],
name = args[2],

View File

@@ -57,7 +57,7 @@ class HammingDistance extends Operation {
samples = input.split(delim);
if (samples.length !== 2) {
throw new OperationError("Error: You can only calculae the edit distance between 2 strings. Please ensure exactly two inputs are provided, separated by the specified delimiter.");
throw new OperationError("Error: You can only calculate the edit distance between 2 strings. Please ensure exactly two inputs are provided, separated by the specified delimiter.");
}
if (samples[0].length !== samples[1].length) {

View File

@@ -54,7 +54,7 @@ class ImageBrightnessContrast extends Operation {
*/
async run(input, args) {
const [brightness, contrast] = args;
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -48,7 +48,7 @@ class ImageFilter extends Operation {
*/
async run(input, args) {
const [filterType] = args;
if (!isImage(new Uint8Array(input))){
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -62,7 +62,7 @@ class ImageHueSaturationLightness extends Operation {
async run(input, args) {
const [hue, saturation, lightness] = args;
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -47,7 +47,7 @@ class ImageOpacity extends Operation {
*/
async run(input, args) {
const [opacity] = args;
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -38,7 +38,7 @@ class InvertImage extends Operation {
* @returns {byteArray}
*/
async run(input, args) {
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid input file format.");
}

View File

@@ -34,7 +34,7 @@ class MicrosoftScriptDecoder extends Operation {
run(input, args) {
const matcher = /#@~\^.{6}==(.+).{6}==\^#~@/;
const encodedData = matcher.exec(input);
if (encodedData){
if (encodedData) {
return MicrosoftScriptDecoder._decode(encodedData[1]);
} else {
return "";

View File

@@ -37,7 +37,7 @@ class NormaliseImage extends Operation {
* @returns {byteArray}
*/
async run(input, args) {
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -0,0 +1,87 @@
/**
* @author n1474335 [n1474335@gmail.com]
* @author mshwed [m@ttshwed.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs";
import Tesseract from "tesseract.js";
const { TesseractWorker } = Tesseract;
import process from "process";
/**
* Optical Character Recognition operation
*/
class OpticalCharacterRecognition extends Operation {
/**
* OpticalCharacterRecognition constructor
*/
constructor() {
super();
this.name = "Optical Character Recognition";
this.module = "OCR";
this.description = "Optical character recognition or optical character reader (OCR) is the mechanical or electronic conversion of images of typed, handwritten or printed text into machine-encoded text.<br><br>Supported image formats: png, jpg, bmp, pbm.";
this.infoURL = "https://wikipedia.org/wiki/Optical_character_recognition";
this.inputType = "ArrayBuffer";
this.outputType = "string";
this.args = [
{
name: "Show confidence",
type: "boolean",
value: true
}
];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {string}
*/
async run(input, args) {
const [showConfidence] = args;
if (!isWorkerEnvironment()) throw OperationError("This operation only works in a browser");
const type = isImage(input);
if (!type) {
throw new OperationError("Invalid File Type");
}
const assetDir = isWorkerEnvironment() ? `${self.docURL}/assets/` : `${process.cwd()}/src/core/vendor/`;
try {
const image = `data:${type};base64,${toBase64(input)}`;
const worker = new TesseractWorker({
workerPath: `${assetDir}tesseract/worker.min.js`,
langPath: `${assetDir}tesseract/lang-data`,
corePath: `${assetDir}tesseract/tesseract-core.wasm.js`,
});
const result = await worker.recognize(image)
.progress(progress => {
if (isWorkerEnvironment()) {
self.sendStatusMessage(`Status: ${progress.status} - ${(parseFloat(progress.progress)*100).toFixed(2)}%`);
}
});
if (showConfidence) {
return `Confidence: ${result.confidence}%\n\n${result.text}`;
} else {
return result.text;
}
} catch (err) {
throw new OperationError(`Error performing OCR on image. (${err})`);
}
}
}
export default OpticalCharacterRecognition;

View File

@@ -128,8 +128,7 @@ class PHPDeserialize extends Operation {
switch (kind) {
case "n":
expect(";");
return "";
return "null";
case "i":
case "d":
case "b": {

View File

@@ -113,7 +113,7 @@ CMYK: ${cmyk}
}).on('colorpickerChange', function(e) {
var color = e.color.string('rgba');
document.getElementById('input-text').value = color;
window.app.autoBake();
window.app.manager.input.debounceInputChange(new Event("keyup"));
});
</script>`;
}
@@ -134,7 +134,7 @@ CMYK: ${cmyk}
static _hslToRgb(h, s, l) {
let r, g, b;
if (s === 0){
if (s === 0) {
r = g = b = l; // achromatic
} else {
const hue2rgb = function hue2rgb(p, q, t) {

View File

@@ -51,7 +51,7 @@ class ParseQRCode extends Operation {
async run(input, args) {
const [normalise] = args;
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}
return await parseQrCode(input, normalise);

View File

@@ -0,0 +1,150 @@
/**
* @author j433866 [j433866@gmail.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import Operation from "../Operation";
import OperationError from "../errors/OperationError";
import Utils from "../Utils";
import { fromBase64 } from "../lib/Base64";
import { fromHex, toHexFast } from "../lib/Hex";
/**
* Parse SSH Host Key operation
*/
class ParseSSHHostKey extends Operation {
/**
* ParseSSHHostKey constructor
*/
constructor() {
super();
this.name = "Parse SSH Host Key";
this.module = "Default";
this.description = "Parses a SSH host key and extracts fields from it.<br>The key type can be:<ul><li>ssh-rsa</li><li>ssh-dss</li><li>ecdsa-sha2</li></ul>The key format can be either Hex or Base64.";
this.infoURL = "https://wikipedia.org/wiki/Secure_Shell";
this.inputType = "string";
this.outputType = "string";
this.args = [
{
name: "Input Format",
type: "option",
value: [
"Auto",
"Base64",
"Hex"
]
}
];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
const [inputFormat] = args,
inputKey = this.convertKeyToBinary(input.trim(), inputFormat),
fields = this.parseKey(inputKey),
keyType = Utils.byteArrayToChars(fromHex(fields[0]), "");
let output = `Key type: ${keyType}`;
if (keyType === "ssh-rsa") {
output += `\nExponent: 0x${fields[1]}`;
output += `\nModulus: 0x${fields[2]}`;
} else if (keyType === "ssh-dss") {
output += `\np: 0x${fields[1]}`;
output += `\nq: 0x${fields[2]}`;
output += `\ng: 0x${fields[3]}`;
output += `\ny: 0x${fields[4]}`;
} else if (keyType.startsWith("ecdsa-sha2")) {
output += `\nCurve: ${Utils.byteArrayToChars(fromHex(fields[1]))}`;
output += `\nPoint: 0x${fields.slice(2)}`;
} else {
output += "\nUnsupported key type.";
output += `\nParameters: ${fields.slice(1)}`;
}
return output;
}
/**
* Converts the key to binary format from either hex or base64
*
* @param {string} inputKey
* @param {string} inputFormat
* @returns {byteArray}
*/
convertKeyToBinary(inputKey, inputFormat) {
const keyPattern = new RegExp(/^(?:[ssh]|[ecdsa-sha2])\S+\s+(\S*)/),
keyMatch = inputKey.match(keyPattern);
if (keyMatch) {
inputKey = keyMatch[1];
}
if (inputFormat === "Auto") {
inputFormat = this.detectKeyFormat(inputKey);
}
if (inputFormat === "Hex") {
return fromHex(inputKey);
} else if (inputFormat === "Base64") {
return fromBase64(inputKey, null, "byteArray");
} else {
throw new OperationError("Invalid input format.");
}
}
/**
* Detects if the key is base64 or hex encoded
*
* @param {string} inputKey
* @returns {string}
*/
detectKeyFormat(inputKey) {
const hexPattern = new RegExp(/^(?:[\dA-Fa-f]{2}[ ,;:]?)+$/);
const b64Pattern = new RegExp(/^\s*(?:[A-Za-z\d+/]{4})+(?:[A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?\s*$/);
if (hexPattern.test(inputKey)) {
return "Hex";
} else if (b64Pattern.test(inputKey)) {
return "Base64";
} else {
throw new OperationError("Unable to detect input key format.");
}
}
/**
* Parses fields from the key
*
* @param {byteArray} key
*/
parseKey(key) {
const fields = [];
while (key.length > 0) {
const lengthField = key.slice(0, 4);
let decodedLength = 0;
for (let i = 0; i < lengthField.length; i++) {
decodedLength += lengthField[i];
decodedLength = decodedLength << 8;
}
decodedLength = decodedLength >> 8;
// Break if length wasn't decoded correctly
if (decodedLength <= 0) break;
fields.push(toHexFast(key.slice(4, 4 + decodedLength)));
key = key.slice(4 + decodedLength);
}
return fields;
}
}
export default ParseSSHHostKey;

View File

@@ -0,0 +1,84 @@
/**
* @author h345983745 []
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
import Stream from "../lib/Stream.mjs";
import {toHex} from "../lib/Hex.mjs";
import OperationError from "../errors/OperationError.mjs";
/**
* Parse UDP operation
*/
class ParseUDP extends Operation {
/**
* ParseUDP constructor
*/
constructor() {
super();
this.name = "Parse UDP";
this.module = "Default";
this.description = "Parses a UDP header and payload (if present).";
this.infoURL = "https://wikipedia.org/wiki/User_Datagram_Protocol";
this.inputType = "ArrayBuffer";
this.outputType = "json";
this.presentType = "html";
this.args = [];
}
/**
* @param {ArrayBuffer} input
* @returns {Object}
*/
run(input, args) {
if (input.byteLength < 8) {
throw new OperationError("Need 8 bytes for a UDP Header");
}
const s = new Stream(new Uint8Array(input));
// Parse Header
const UDPPacket = {
"Source port": s.readInt(2),
"Destination port": s.readInt(2),
"Length": s.readInt(2),
"Checksum": toHex(s.getBytes(2), "")
};
// Parse data if present
if (s.hasMore()) {
UDPPacket.Data = toHex(s.getBytes(UDPPacket.Length - 8), "");
}
return UDPPacket;
}
/**
* Displays the UDP Packet in a table style
* @param {Object} data
* @returns {html}
*/
present(data) {
const html = [];
html.push("<table class='table table-hover table-sm table-bordered table-nonfluid' style='table-layout: fixed'>");
html.push("<tr>");
html.push("<th>Field</th>");
html.push("<th>Value</th>");
html.push("</tr>");
for (const key in data) {
html.push("<tr>");
html.push("<td style=\"word-wrap:break-word\">" + key + "</td>");
html.push("<td>" + data[key] + "</td>");
html.push("</tr>");
}
html.push("</table>");
return html.join("");
}
}
export default ParseUDP;

View File

@@ -0,0 +1,83 @@
/**
* @author Ge0rg3 [georgeomnet+cyberchef@gmail.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
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";
/**
* Randomize Colour Palette operation
*/
class RandomizeColourPalette extends Operation {
/**
* RandomizeColourPalette constructor
*/
constructor() {
super();
this.name = "Randomize Colour Palette";
this.module = "Image";
this.description = "Randomizes each colour in an image's colour palette. This can often reveal text or symbols that were previously a very similar colour to their surroundings, a technique sometimes used in Steganography.";
this.infoURL = "https://wikipedia.org/wiki/Indexed_color";
this.inputType = "ArrayBuffer";
this.outputType = "ArrayBuffer";
this.presentType = "html";
this.args = [
{
name: "Seed",
type: "string",
value: ""
}
];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {ArrayBuffer}
*/
async run(input, args) {
if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
const seed = args[0] || (Math.random().toString().substr(2)),
parsedImage = await jimp.read(input),
width = parsedImage.bitmap.width,
height = parsedImage.bitmap.height;
let rgbString, rgbHash, rgbHex;
parsedImage.scan(0, 0, width, height, function(x, y, idx) {
rgbString = this.bitmap.data.slice(idx, idx+3).join(".");
rgbHash = runHash("md5", Utils.strToArrayBuffer(seed + rgbString));
rgbHex = rgbHash.substr(0, 6) + "ff";
parsedImage.setPixelColor(parseInt(rgbHex, 16), x, y);
});
const imageBuffer = await parsedImage.getBufferAsync(jimp.AUTO);
return new Uint8Array(imageBuffer).buffer;
}
/**
* Displays the extracted data as an image for web apps.
* @param {ArrayBuffer} data
* @returns {html}
*/
present(data) {
if (!data.byteLength) return "";
const type = isImage(data);
return `<img src="data:${type};base64,${toBase64(data)}">`;
}
}
export default RandomizeColourPalette;

View File

@@ -77,7 +77,7 @@ class RawInflate extends Operation {
}),
result = new Uint8Array(inflate.decompress());
// Raw Inflate somethimes messes up and returns nonsense like this:
// Raw Inflate sometimes messes up and returns nonsense like this:
// ]....]....]....]....]....]....]....]....]....]....]....]....]....]...
// e.g. Input data of [8b, 1d, dc, 44]
// Look for the first two square brackets:

View File

@@ -64,7 +64,7 @@ class RemoveWhitespace extends Operation {
run(input, args) {
const [
removeSpaces,
removeCariageReturns,
removeCarriageReturns,
removeLineFeeds,
removeTabs,
removeFormFeeds,
@@ -73,7 +73,7 @@ class RemoveWhitespace extends Operation {
let data = input;
if (removeSpaces) data = data.replace(/ /g, "");
if (removeCariageReturns) data = data.replace(/\r/g, "");
if (removeCarriageReturns) data = data.replace(/\r/g, "");
if (removeLineFeeds) data = data.replace(/\n/g, "");
if (removeTabs) data = data.replace(/\t/g, "");
if (removeFormFeeds) data = data.replace(/\f/g, "");

View File

@@ -0,0 +1,69 @@
/**
* @author j433866 [j433866@gmail.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
import MarkdownIt from "markdown-it";
import hljs from "highlight.js";
/**
* Render Markdown operation
*/
class RenderMarkdown extends Operation {
/**
* RenderMarkdown constructor
*/
constructor() {
super();
this.name = "Render Markdown";
this.module = "Code";
this.description = "Renders input Markdown as HTML. HTML rendering is disabled to avoid XSS.";
this.infoURL = "https://wikipedia.org/wiki/Markdown";
this.inputType = "string";
this.outputType = "html";
this.args = [
{
name: "Autoconvert URLs to links",
type: "boolean",
value: false
},
{
name: "Enable syntax highlighting",
type: "boolean",
value: true
}
];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {html}
*/
run(input, args) {
const [convertLinks, enableHighlighting] = args,
md = new MarkdownIt({
linkify: convertLinks,
html: false, // Explicitly disable HTML rendering
highlight: function(str, lang) {
if (lang && hljs.getLanguage(lang) && enableHighlighting) {
try {
return hljs.highlight(lang, str).value;
} catch (__) {}
}
return "";
}
}),
rendered = md.render(input);
return `<div style="font-family: var(--primary-font-family)">${rendered}</div>`;
}
}
export default RenderMarkdown;

View File

@@ -87,7 +87,7 @@ class ResizeImage extends Operation {
"Bezier": jimp.RESIZE_BEZIER
};
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -46,7 +46,7 @@ class RotateImage extends Operation {
async run(input, args) {
const [degrees] = args;
if (!isImage(new Uint8Array(input))) {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -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 suffiently 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 treat as reliable. Any sufficiently long file is likely to contain these magic bytes coincidentally.\n",
numFound = 0;
const categories = [],
data = new Uint8Array(input);

View File

@@ -62,7 +62,7 @@ class SharpenImage extends Operation {
async run(input, args) {
const [radius, amount, threshold] = args;
if (!isImage(new Uint8Array(input))){
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}

View File

@@ -0,0 +1,113 @@
/**
* @author j433866 [j433866@gmail.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
import {FORMATS, convertCoordinates} from "../lib/ConvertCoordinates.mjs";
import OperationError from "../errors/OperationError.mjs";
/**
* Show on map operation
*/
class ShowOnMap extends Operation {
/**
* ShowOnMap constructor
*/
constructor() {
super();
this.name = "Show on map";
this.module = "Hashing";
this.description = "Displays co-ordinates on a slippy map.<br><br>Co-ordinates will be converted to decimal degrees before being shown on the map.<br><br>Supported formats:<ul><li>Degrees Minutes Seconds (DMS)</li><li>Degrees Decimal Minutes (DDM)</li><li>Decimal Degrees (DD)</li><li>Geohash</li><li>Military Grid Reference System (MGRS)</li><li>Ordnance Survey National Grid (OSNG)</li><li>Universal Transverse Mercator (UTM)</li></ul><br>This operation will not work offline.";
this.infoURL = "https://foundation.wikimedia.org/wiki/Maps_Terms_of_Use";
this.inputType = "string";
this.outputType = "string";
this.presentType = "html";
this.args = [
{
name: "Zoom Level",
type: "number",
value: 13
},
{
name: "Input Format",
type: "option",
value: ["Auto"].concat(FORMATS)
},
{
name: "Input Delimiter",
type: "option",
value: [
"Auto",
"Direction Preceding",
"Direction Following",
"\\n",
"Comma",
"Semi-colon",
"Colon"
]
}
];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
if (input.replace(/\s+/g, "") !== "") {
const inFormat = args[1],
inDelim = args[2];
let latLong;
try {
latLong = convertCoordinates(input, inFormat, inDelim, "Decimal Degrees", "Comma", "None", 5);
} catch (error) {
throw new OperationError(error);
}
latLong = latLong.replace(/[,]$/, "");
latLong = latLong.replace(/°/g, "");
return latLong;
}
return input;
}
/**
* @param {string} data
* @param {Object[]} args
* @returns {string}
*/
async present(data, args) {
if (data.replace(/\s+/g, "") === "") {
data = "0, 0";
}
const zoomLevel = args[0];
const tileUrl = "https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",
tileAttribution = "<a href=\"https://wikimediafoundation.org/wiki/Maps_Terms_of_Use\">Wikimedia maps</a> | &copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors",
leafletUrl = "https://unpkg.com/leaflet@1.5.0/dist/leaflet.js",
leafletCssUrl = "https://unpkg.com/leaflet@1.5.0/dist/leaflet.css";
return `<link rel="stylesheet" href="${leafletCssUrl}" crossorigin=""/>
<style>#output-html { white-space: normal; padding: 0; }</style>
<div id="presentedMap" style="width: 100%; height: 100%;"></div>
<script type="text/javascript">
var mapscript = document.createElement('script');
document.body.appendChild(mapscript);
mapscript.onload = function() {
var presentMap = L.map('presentedMap').setView([${data}], ${zoomLevel});
L.tileLayer('${tileUrl}', {
attribution: '${tileAttribution}'
}).addTo(presentMap);
L.marker([${data}]).addTo(presentMap)
.bindPopup('${data}')
.openPopup();
};
mapscript.src = "${leafletUrl}";
</script>`;
}
}
export default ShowOnMap;

View File

@@ -79,7 +79,7 @@ class SwapEndianness extends Operation {
const word = data.slice(i, i + wordLength);
// Pad word if too short
if (padIncompleteWords && word.length < wordLength){
if (padIncompleteWords && word.length < wordLength) {
for (j = word.length; j < wordLength; j++) {
word.push(0);
}

View File

@@ -40,7 +40,7 @@ class ToBase64 extends Operation {
*/
run(input, args) {
const alphabet = args[0];
return toBase64(new Uint8Array(input), alphabet);
return toBase64(input, alphabet);
}
/**

View File

@@ -108,7 +108,7 @@ class ToQuotedPrintable extends Operation {
* @private
* @param {number} nr
* @param {byteArray[]} ranges
* @returns {bolean}
* @returns {boolean}
*/
_checkRanges(nr, ranges) {
for (let i = ranges.length - 1; i >= 0; i--) {

View File

@@ -75,6 +75,12 @@ class TripleDESDecrypt extends Operation {
Triple DES uses a key length of 24 bytes (192 bits).
DES uses a key length of 8 bytes (64 bits).`);
}
if (iv.length !== 8 && mode !== "ECB") {
throw new OperationError(`Invalid IV length: ${iv.length} bytes
Triple DES uses an IV length of 8 bytes (64 bits).
Make sure you have specified the type correctly (e.g. Hex vs UTF8).`);
}
input = Utils.convertToByteString(input, inputType);

View File

@@ -75,6 +75,12 @@ class TripleDESEncrypt extends Operation {
Triple DES uses a key length of 24 bytes (192 bits).
DES uses a key length of 8 bytes (64 bits).`);
}
if (iv.length !== 8 && mode !== "ECB") {
throw new OperationError(`Invalid IV length: ${iv.length} bytes
Triple DES uses an IV length of 8 bytes (64 bits).
Make sure you have specified the type correctly (e.g. Hex vs UTF8).`);
}
input = Utils.convertToByteString(input, inputType);

View File

@@ -23,7 +23,7 @@ class Typex extends Operation {
this.name = "Typex";
this.module = "Default";
this.description = "Encipher/decipher with the WW2 Typex machine.<br><br>Typex was originally built by the British Royal Air Force prior to WW2, and is based on the Enigma machine with some improvements made, including using five rotors with more stepping points and interchangeable wiring cores. It was used across the British and Commonewealth militaries. A number of later variants were produced; here we simulate a WW2 era Mark 22 Typex with plugboards for the reflector and input. Typex rotors were changed regularly and none are public: a random example set are provided.<br><br>To configure the reflector plugboard, enter a string of connected pairs of letters in the reflector box, e.g. <code>AB CD EF</code> connects A to B, C to D, and E to F (you'll need to connect every letter). There is also an input plugboard: unlike Enigma's plugboard, it's not restricted to pairs, so it's entered like a rotor (without stepping). To create your own rotor, enter the letters that the rotor maps A to Z to, in order, optionally followed by <code>&lt;</code> then a list of stepping points.<br><br>More detailed descriptions of the Enigma, Typex and Bombe operations <a href='https://github.com/gchq/CyberChef/wiki/Enigma,-the-Bombe,-and-Typex'>can be found here</a>.";
this.description = "Encipher/decipher with the WW2 Typex machine.<br><br>Typex was originally built by the British Royal Air Force prior to WW2, and is based on the Enigma machine with some improvements made, including using five rotors with more stepping points and interchangeable wiring cores. It was used across the British and Commonwealth militaries. A number of later variants were produced; here we simulate a WW2 era Mark 22 Typex with plugboards for the reflector and input. Typex rotors were changed regularly and none are public: a random example set are provided.<br><br>To configure the reflector plugboard, enter a string of connected pairs of letters in the reflector box, e.g. <code>AB CD EF</code> connects A to B, C to D, and E to F (you'll need to connect every letter). There is also an input plugboard: unlike Enigma's plugboard, it's not restricted to pairs, so it's entered like a rotor (without stepping). To create your own rotor, enter the letters that the rotor maps A to Z to, in order, optionally followed by <code>&lt;</code> then a list of stepping points.<br><br>More detailed descriptions of the Enigma, Typex and Bombe operations <a href='https://github.com/gchq/CyberChef/wiki/Enigma,-the-Bombe,-and-Typex'>can be found here</a>.";
this.infoURL = "https://wikipedia.org/wiki/Typex";
this.inputType = "string";
this.outputType = "string";

View File

@@ -51,12 +51,12 @@ class UNIXTimestampToWindowsFiletime extends Operation {
input = new BigNumber(input);
if (units === "Seconds (s)"){
if (units === "Seconds (s)") {
input = input.multipliedBy(new BigNumber("10000000"));
} else if (units === "Milliseconds (ms)") {
input = input.multipliedBy(new BigNumber("10000"));
} else if (units === "Microseconds (μs)") {
input = input.multiplyiedBy(new BigNumber("10"));
input = input.multipliedBy(new BigNumber("10"));
} else if (units === "Nanoseconds (ns)") {
input = input.dividedBy(new BigNumber("100"));
} else {
@@ -65,7 +65,7 @@ class UNIXTimestampToWindowsFiletime extends Operation {
input = input.plus(new BigNumber("116444736000000000"));
if (format === "Hex"){
if (format === "Hex") {
return input.toString(16);
} else {
return input.toFixed();

View File

@@ -49,7 +49,7 @@ class URLEncode extends Operation {
* @returns {string}
*/
encodeAllChars (str) {
// TODO Do this programatically
// TODO Do this programmatically
return encodeURIComponent(str)
.replace(/!/g, "%21")
.replace(/#/g, "%23")

View File

@@ -0,0 +1,107 @@
/**
* @author Ge0rg3 [georgeomnet+cyberchef@gmail.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
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";
/**
* View Bit Plane operation
*/
class ViewBitPlane extends Operation {
/**
* ViewBitPlane constructor
*/
constructor() {
super();
this.name = "View Bit Plane";
this.module = "Image";
this.description = "Extracts and displays a bit plane of any given image. These show only a single bit from each pixel, and can be used to hide messages in Steganography.";
this.infoURL = "https://wikipedia.org/wiki/Bit_plane";
this.inputType = "ArrayBuffer";
this.outputType = "ArrayBuffer";
this.presentType = "html";
this.args = [
{
name: "Colour",
type: "option",
value: COLOUR_OPTIONS
},
{
name: "Bit",
type: "number",
value: 0
}
];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {ArrayBuffer}
*/
async run(input, args) {
if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
const [colour, bit] = args,
parsedImage = await jimp.read(input),
width = parsedImage.bitmap.width,
height = parsedImage.bitmap.height,
colourIndex = COLOUR_OPTIONS.indexOf(colour),
bitIndex = 7-bit;
if (bit < 0 || bit > 7) {
throw new OperationError("Error: Bit argument must be between 0 and 7");
}
let pixel, bin, newPixelValue;
parsedImage.scan(0, 0, width, height, function(x, y, idx) {
pixel = this.bitmap.data[idx + colourIndex];
bin = Utils.bin(pixel);
newPixelValue = 255;
if (bin.charAt(bitIndex) === "1") newPixelValue = 0;
for (let i=0; i < 3; i++) {
this.bitmap.data[idx + i] = newPixelValue;
}
this.bitmap.data[idx + 3] = 255;
});
const imageBuffer = await parsedImage.getBufferAsync(jimp.AUTO);
return new Uint8Array(imageBuffer).buffer;
}
/**
* Displays the extracted data as an image for web apps.
* @param {ArrayBuffer} data
* @returns {html}
*/
present(data) {
if (!data.length) return "";
const type = isImage(data);
return `<img src="data:${type};base64,${toBase64(data)}">`;
}
}
const COLOUR_OPTIONS = [
"Red",
"Green",
"Blue",
"Alpha"
];
export default ViewBitPlane;

View File

@@ -55,7 +55,7 @@ class VigenèreDecode extends Operation {
keyIndex = alphabet.indexOf(chr);
msgIndex = alphabet.indexOf(input[i]);
// Subtract indexes from each other, add 26 just in case the value is negative,
// modulo to remove if neccessary
// modulo to remove if necessary
output += alphabet[(msgIndex - keyIndex + alphabet.length) % 26];
} else if (alphabet.indexOf(input[i].toLowerCase()) >= 0) {
chr = key[(i - fail) % key.length].toLowerCase();

View File

@@ -20,7 +20,7 @@ class Whirlpool extends Operation {
this.name = "Whirlpool";
this.module = "Crypto";
this.description = "Whirlpool is a cryptographic hash function designed by Vincent Rijmen (co-creator of AES) and Paulo S. L. M. Barreto, who first described it in 2000.<br><br>Several variants exist:<ul><li>Whirlpool-0 is the original version released in 2000.</li><li>Whirlpool-T is the first revision, released in 2001, improving the generation of the s-box.</li><li>Whirlpool is the latest revision, released in 2003, fixing a flaw in the difusion matrix.</li></ul>";
this.description = "Whirlpool is a cryptographic hash function designed by Vincent Rijmen (co-creator of AES) and Paulo S. L. M. Barreto, who first described it in 2000.<br><br>Several variants exist:<ul><li>Whirlpool-0 is the original version released in 2000.</li><li>Whirlpool-T is the first revision, released in 2001, improving the generation of the s-box.</li><li>Whirlpool is the latest revision, released in 2003, fixing a flaw in the diffusion matrix.</li></ul>";
this.infoURL = "https://wikipedia.org/wiki/Whirlpool_(cryptography)";
this.inputType = "ArrayBuffer";
this.outputType = "string";

View File

@@ -57,7 +57,7 @@ class WindowsFiletimeToUNIXTimestamp extends Operation {
input = input.minus(new BigNumber("116444736000000000"));
if (units === "Seconds (s)"){
if (units === "Seconds (s)") {
input = input.dividedBy(new BigNumber("10000000"));
} else if (units === "Milliseconds (ms)") {
input = input.dividedBy(new BigNumber("10000"));

View File

@@ -61,7 +61,7 @@ class YARARules extends Operation {
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
async run(input, args) {
if (isWorkerEnvironment())
self.sendStatusMessage("Instantiating YARA...");
const [rules, showStrings, showLengths, showMeta, showCounts] = args;

Binary file not shown.

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More