Merge remote-tracking branch 'upstream/master' into features/keybindings

This commit is contained in:
Matt C 2017-10-17 19:37:14 +01:00
commit d924ede9cf
30 changed files with 6936 additions and 899 deletions

View file

@ -28,11 +28,7 @@
// modify rules from base configurations // modify rules from base configurations
"no-unused-vars": ["error", { "no-unused-vars": ["error", {
"args": "none", "args": "none",
"vars": "local", "vars": "all"
// Allow vars that start with a capital letter to be unused.
// This is mainly for exported module names which are useful to indicate
// the name of the module and may be used to refer to itself in future.
"varsIgnorePattern": "^[A-Z]"
}], }],
"no-empty": ["error", { "no-empty": ["error", {
"allowEmptyCatch": true "allowEmptyCatch": true

View file

@ -5,21 +5,10 @@
<!-- Misc: --> <!-- Misc: -->
### Summary ### Summary
<!-- If you're describing a bug, tell us what's wrong -->
<!-- If you're suggesting a change/improvement, tell us what it is and how it should work -->
### Example ### Example
<!-- If describing a bug, tell us what happens instead of the expected behavior --> <!-- If describing a bug, tell us what happens instead of the expected behavior -->
<!-- Include a link that triggers the bug if possible --> <!-- Include a link that triggers the bug if possible -->
<!-- If you are requesting a new operation, include example input and output --> <!-- If you are requesting a new operation, include example input and output -->
### Possible solutions
<!-- Not obligatory, but suggest a fix/reason for the bug, or ideas for how to -->
<!-- implement the addition or change, including links to relevant resources -->
### Environment
<!-- Include any relevant details about the environment you experienced the bug in -->
<!-- This information is displayed in the About/Support pane -->
* CyberChef compile time:
* User-Agent:
* [Link to reproduce]()

View file

@ -39,4 +39,10 @@ deploy:
on: on:
tags: true tags: true
branch: master branch: master
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/83c143a6822e218d5b34
on_success: change
on_failure: always
on_start: never

View file

@ -1,8 +1,12 @@
# CyberChef # CyberChef
[![Build Status](https://travis-ci.org/gchq/CyberChef.svg?branch=master)](https://travis-ci.org/gchq/CyberChef) [![Build Status](https://travis-ci.org/gchq/CyberChef.svg?branch=master)](https://travis-ci.org/gchq/CyberChef)
[![npm](https://badge.fury.io/js/cyberchef.svg)](https://www.npmjs.com/package/cyberchef) [![dependencies Status](https://david-dm.org/gchq/CyberChef/status.svg)](https://david-dm.org/gchq/CyberChef)
![](https://reposs.herokuapp.com/?path=gchq/CyberChef&color=brightgreen) [![npm](http://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)
#### *The Cyber Swiss Army Knife* #### *The Cyber Swiss Army Knife*
@ -34,8 +38,10 @@ You can use as many operations as you like in simple or complex ways. Some examp
- [Convert a date and time to a different time zone][3] - [Convert a date and time to a different time zone][3]
- [Parse a Teredo IPv6 address][4] - [Parse a Teredo IPv6 address][4]
- [Convert data from a hexdump, then decompress][5] - [Convert data from a hexdump, then decompress][5]
- [Display multiple timestamps as full dates][6] - [Decrypt and disassemble shellcode][6]
- [Carry out different operations on data of different types][7] - [Display multiple timestamps as full dates][7]
- [Carry out different operations on data of different types][8]
- [Use parts of the input as arguments to operations][9]
## Features ## Features
@ -56,7 +62,7 @@ You can use as many operations as you like in simple or complex ways. Some examp
- Search - Search
- If you know the name of the operation you want or a word associated with it, start typing it into the search field and any matching operations will immediately be shown. - If you know the name of the operation you want or a word associated with it, start typing it into the search field and any matching operations will immediately be shown.
- Highlighting - Highlighting
- When you highlight text in the input or output, the offset and length values will be displayed and, if possible, the corresponding data will be highlighted in the output or input respectively (example: [highlight the word 'question' in the input to see where it appears in the output][8]). - When you highlight text in the input or output, the offset and length values will be displayed and, if possible, the corresponding data will be highlighted in the output or input respectively (example: [highlight the word 'question' in the input to see where it appears in the output][10]).
- Save to file and load from file - Save to file and load from file
- You can save the output to a file at any time or load a file by dragging and dropping it into the input field (note that files larger than about 500kb may cause your browser to hang or even crash due to the way that browsers handle large amounts of textual data). - You can save the output to a file at any time or load a file by dragging and dropping it into the input field (note that files larger than about 500kb may cause your browser to hang or even crash due to the way that browsers handle large amounts of textual data).
- CyberChef is entirely client-side - CyberChef is entirely client-side
@ -92,6 +98,8 @@ CyberChef is released under the [Apache 2.0 Licence](https://www.apache.org/lice
[3]: https://gchq.github.io/CyberChef/#recipe=Translate_DateTime_Format('Standard%20date%20and%20time','DD/MM/YYYY%20HH:mm:ss','UTC','dddd%20Do%20MMMM%20YYYY%20HH:mm:ss%20Z%20z','Australia/Queensland')&input=MTUvMDYvMjAxNSAyMDo0NTowMA [3]: https://gchq.github.io/CyberChef/#recipe=Translate_DateTime_Format('Standard%20date%20and%20time','DD/MM/YYYY%20HH:mm:ss','UTC','dddd%20Do%20MMMM%20YYYY%20HH:mm:ss%20Z%20z','Australia/Queensland')&input=MTUvMDYvMjAxNSAyMDo0NTowMA
[4]: https://gchq.github.io/CyberChef/#recipe=Parse_IPv6_address()&input=MjAwMTowMDAwOjQxMzY6ZTM3ODo4MDAwOjYzYmY6M2ZmZjpmZGQy [4]: https://gchq.github.io/CyberChef/#recipe=Parse_IPv6_address()&input=MjAwMTowMDAwOjQxMzY6ZTM3ODo4MDAwOjYzYmY6M2ZmZjpmZGQy
[5]: https://gchq.github.io/CyberChef/#recipe=From_Hexdump()Gunzip()&input=MDAwMDAwMDAgIDFmIDhiIDA4IDAwIDEyIGJjIGYzIDU3IDAwIGZmIDBkIGM3IGMxIDA5IDAwIDIwICB8Li4uLi6881cu/y7HwS4uIHwKMDAwMDAwMTAgIDA4IDA1IGQwIDU1IGZlIDA0IDJkIGQzIDA0IDFmIGNhIDhjIDQ0IDIxIDViIGZmICB8Li7QVf4uLdMuLsouRCFb/3wKMDAwMDAwMjAgIDYwIGM3IGQ3IDAzIDE2IGJlIDQwIDFmIDc4IDRhIDNmIDA5IDg5IDBiIDlhIDdkICB8YMfXLi6%2BQC54Sj8uLi4ufXwKMDAwMDAwMzAgIDRlIGM4IDRlIDZkIDA1IDFlIDAxIDhiIDRjIDI0IDAwIDAwIDAwICAgICAgICAgICB8TshObS4uLi5MJC4uLnw [5]: https://gchq.github.io/CyberChef/#recipe=From_Hexdump()Gunzip()&input=MDAwMDAwMDAgIDFmIDhiIDA4IDAwIDEyIGJjIGYzIDU3IDAwIGZmIDBkIGM3IGMxIDA5IDAwIDIwICB8Li4uLi6881cu/y7HwS4uIHwKMDAwMDAwMTAgIDA4IDA1IGQwIDU1IGZlIDA0IDJkIGQzIDA0IDFmIGNhIDhjIDQ0IDIxIDViIGZmICB8Li7QVf4uLdMuLsouRCFb/3wKMDAwMDAwMjAgIDYwIGM3IGQ3IDAzIDE2IGJlIDQwIDFmIDc4IDRhIDNmIDA5IDg5IDBiIDlhIDdkICB8YMfXLi6%2BQC54Sj8uLi4ufXwKMDAwMDAwMzAgIDRlIGM4IDRlIDZkIDA1IDFlIDAxIDhiIDRjIDI0IDAwIDAwIDAwICAgICAgICAgICB8TshObS4uLi5MJC4uLnw
[6]: https://gchq.github.io/CyberChef/#recipe=Fork('%5C%5Cn','%5C%5Cn',false)From_UNIX_Timestamp('Seconds%20(s)')&input=OTc4MzQ2ODAwCjEwMTI2NTEyMDAKMTA0NjY5NjQwMAoxMDgxMDg3MjAwCjExMTUzMDUyMDAKMTE0OTYwOTYwMA [6]: https://gchq.github.io/CyberChef/#recipe=RC4(%7B'option':'UTF8','string':'secret'%7D,'Hex','Hex')Disassemble_x86('64','Full%20x86%20architecture',16,0,true,true)&input=MjFkZGQyNTQwMTYwZWU2NWZlMDc3NzEwM2YyYTM5ZmJlNWJjYjZhYTBhYWJkNDE0ZjkwYzZjYWY1MzEyNzU0YWY3NzRiNzZiM2JiY2QxOTNjYjNkZGZkYmM1YTI2NTMzYTY4NmI1OWI4ZmVkNGQzODBkNDc0NDIwMWFlYzIwNDA1MDcxMzhlMmZlMmIzOTUwNDQ2ZGIzMWQyYmM2MjliZTRkM2YyZWIwMDQzYzI5M2Q3YTVkMjk2MmMwMGZlNmRhMzAwNzJkOGM1YTZiNGZlN2Q4NTlhMDQwZWVhZjI5OTczMzYzMDJmNWEwZWMxOQ
[7]: https://gchq.github.io/CyberChef/#recipe=Fork('%5C%5Cn','%5C%5Cn',false)Conditional_Jump('1',2,10)To_Hex('Space')Return()To_Base64('A-Za-z0-9%2B/%3D')&input=U29tZSBkYXRhIHdpdGggYSAxIGluIGl0ClNvbWUgZGF0YSB3aXRoIGEgMiBpbiBpdA [7]: https://gchq.github.io/CyberChef/#recipe=Fork('%5C%5Cn','%5C%5Cn',false)From_UNIX_Timestamp('Seconds%20(s)')&input=OTc4MzQ2ODAwCjEwMTI2NTEyMDAKMTA0NjY5NjQwMAoxMDgxMDg3MjAwCjExMTUzMDUyMDAKMTE0OTYwOTYwMA
[8]: https://gchq.github.io/CyberChef/#recipe=XOR(%7B'option':'Hex','string':'3a'%7D,'',false)To_Hexdump(16,false,false)&input=VGhlIGFuc3dlciB0byB0aGUgdWx0aW1hdGUgcXVlc3Rpb24gb2YgbGlmZSwgdGhlIFVuaXZlcnNlLCBhbmQgZXZlcnl0aGluZyBpcyA0Mi4 [8]: https://gchq.github.io/CyberChef/#recipe=Fork('%5C%5Cn','%5C%5Cn',false)Conditional_Jump('1',2,10)To_Hex('Space')Return()To_Base64('A-Za-z0-9%2B/%3D')&input=U29tZSBkYXRhIHdpdGggYSAxIGluIGl0ClNvbWUgZGF0YSB3aXRoIGEgMiBpbiBpdA
[9]: https://gchq.github.io/CyberChef/#recipe=Register('key%3D(%5B%5C%5Cda-f%5D*)',true,false)Find_/_Replace(%7B'option':'Regex','string':'.*data%3D(.*)'%7D,'$1',true,false,true)RC4(%7B'option':'Hex','string':'$R0'%7D,'Hex','Latin1')&input=aHR0cDovL21hbHdhcmV6LmJpei9iZWFjb24ucGhwP2tleT0wZTkzMmE1YyZkYXRhPThkYjdkNWViZTM4NjYzYTU0ZWNiYjMzNGUzZGIxMQ
[10]: https://gchq.github.io/CyberChef/#recipe=XOR(%7B'option':'Hex','string':'3a'%7D,'',false)To_Hexdump(16,false,false)&input=VGhlIGFuc3dlciB0byB0aGUgdWx0aW1hdGUgcXVlc3Rpb24gb2YgbGlmZSwgdGhlIFVuaXZlcnNlLCBhbmQgZXZlcnl0aGluZyBpcyA0Mi4

1130
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "cyberchef", "name": "cyberchef",
"version": "6.3.1", "version": "6.4.4",
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
"author": "n1474335 <n1474335@gmail.com>", "author": "n1474335 <n1474335@gmail.com>",
"homepage": "https://gchq.github.io/CyberChef", "homepage": "https://gchq.github.io/CyberChef",
@ -35,8 +35,8 @@
"babel-preset-env": "^1.6.0", "babel-preset-env": "^1.6.0",
"css-loader": "^0.28.7", "css-loader": "^0.28.7",
"exports-loader": "^0.6.4", "exports-loader": "^0.6.4",
"extract-text-webpack-plugin": "^3.0.0", "extract-text-webpack-plugin": "^3.0.1",
"file-loader": "^0.11.2", "file-loader": "^1.1.4",
"grunt": ">=1.0.1", "grunt": ">=1.0.1",
"grunt-accessibility": "~5.0.0", "grunt-accessibility": "~5.0.0",
"grunt-chmod": "~1.1.1", "grunt-chmod": "~1.1.1",
@ -46,7 +46,7 @@
"grunt-eslint": "^20.1.0", "grunt-eslint": "^20.1.0",
"grunt-exec": "~3.0.0", "grunt-exec": "~3.0.0",
"grunt-execute": "^0.2.2", "grunt-execute": "^0.2.2",
"grunt-jsdoc": "^2.1.1", "grunt-jsdoc": "^2.2.0",
"grunt-webpack": "^3.0.2", "grunt-webpack": "^3.0.2",
"html-webpack-plugin": "^2.30.1", "html-webpack-plugin": "^2.30.1",
"imports-loader": "^0.7.1", "imports-loader": "^0.7.1",
@ -55,21 +55,21 @@
"less": "^2.7.2", "less": "^2.7.2",
"less-loader": "^4.0.5", "less-loader": "^4.0.5",
"postcss-css-variables": "^0.8.0", "postcss-css-variables": "^0.8.0",
"postcss-import": "^10.0.0", "postcss-import": "^11.0.0",
"postcss-loader": "^2.0.6", "postcss-loader": "^2.0.6",
"style-loader": "^0.18.2", "style-loader": "^0.19.0",
"url-loader": "^0.5.9", "url-loader": "^0.6.2",
"val-loader": "^1.0.2", "val-loader": "^1.0.2",
"web-resource-inliner": "^4.1.1", "web-resource-inliner": "^4.2.0",
"webpack": "^3.6.0", "webpack": "^3.6.0",
"webpack-dev-server": "^2.8.2", "webpack-dev-server": "^2.9.1",
"webpack-node-externals": "^1.6.0", "webpack-node-externals": "^1.6.0",
"worker-loader": "^0.8.0" "worker-loader": "^1.0.0"
}, },
"dependencies": { "dependencies": {
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"bootstrap": "^3.3.7", "bootstrap": "^3.3.7",
"bootstrap-colorpicker": "^2.5.1", "bootstrap-colorpicker": "^2.5.2",
"bootstrap-switch": "^3.3.4", "bootstrap-switch": "^3.3.4",
"crypto-api": "^0.7.5", "crypto-api": "^0.7.5",
"crypto-js": "^3.1.9-1", "crypto-js": "^3.1.9-1",
@ -84,7 +84,7 @@
"js-sha3": "^0.6.1", "js-sha3": "^0.6.1",
"jsbn": "^1.1.0", "jsbn": "^1.1.0",
"jsonpath": "^0.2.12", "jsonpath": "^0.2.12",
"jsrsasign": "8.0.3", "jsrsasign": "8.0.4",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"moment": "^2.18.1", "moment": "^2.18.1",
"moment-timezone": "^0.5.13", "moment-timezone": "^0.5.13",

View file

@ -68,9 +68,10 @@ Chef.prototype.bake = async function(inputText, recipeConfig, options, progress,
try { try {
progress = await recipe.execute(this.dish, progress); progress = await recipe.execute(this.dish, progress);
} catch (err) { } catch (err) {
// Return the error in the result so that everything else gets correctly updated console.log(err);
// rather than throwing it here and losing state info. error = {
error = err; displayStr: err.displayStr,
};
progress = err.progress; progress = err.progress;
} }

View file

@ -92,7 +92,7 @@ async function bake(data) {
} catch (err) { } catch (err) {
self.postMessage({ self.postMessage({
action: "bakeError", action: "bakeError",
data: err.message.split(":").slice(1).join(":").slice(1) // Cut off worker blurb data: err
}); });
} }
} }

View file

@ -409,7 +409,7 @@ const Utils = {
* Utils.strToCharcode("你好"); * Utils.strToCharcode("你好");
*/ */
strToCharcode: function(str) { strToCharcode: function(str) {
const charcode = new Array(); const charcode = [];
for (let i = 0; i < str.length; i++) { for (let i = 0; i < str.length; i++) {
let ord = str.charCodeAt(i); let ord = str.charCodeAt(i);

View file

@ -303,6 +303,7 @@ const Categories = [
"Frequency distribution", "Frequency distribution",
"Detect File Type", "Detect File Type",
"Scan for Embedded Files", "Scan for Embedded Files",
"Disassemble x86",
"Generate UUID", "Generate UUID",
"Generate TOTP", "Generate TOTP",
"Generate HOTP", "Generate HOTP",

View file

@ -5,7 +5,6 @@ import BCD from "../operations/BCD.js";
import BitwiseOp from "../operations/BitwiseOp.js"; import BitwiseOp from "../operations/BitwiseOp.js";
import ByteRepr from "../operations/ByteRepr.js"; import ByteRepr from "../operations/ByteRepr.js";
import CharEnc from "../operations/CharEnc.js"; import CharEnc from "../operations/CharEnc.js";
import Checksum from "../operations/Checksum.js";
import Cipher from "../operations/Cipher.js"; import Cipher from "../operations/Cipher.js";
import Code from "../operations/Code.js"; import Code from "../operations/Code.js";
import Compress from "../operations/Compress.js"; import Compress from "../operations/Compress.js";
@ -26,21 +25,16 @@ import IP from "../operations/IP.js";
import JS from "../operations/JS.js"; import JS from "../operations/JS.js";
import MAC from "../operations/MAC.js"; import MAC from "../operations/MAC.js";
import MorseCode from "../operations/MorseCode.js"; import MorseCode from "../operations/MorseCode.js";
import MS from "../operations/MS.js";
import NetBIOS from "../operations/NetBIOS.js"; import NetBIOS from "../operations/NetBIOS.js";
import Numberwang from "../operations/Numberwang.js";
import OS from "../operations/OS.js";
import OTP from "../operations/OTP.js";
import PublicKey from "../operations/PublicKey.js"; import PublicKey from "../operations/PublicKey.js";
import Punycode from "../operations/Punycode.js"; import Punycode from "../operations/Punycode.js";
import QuotedPrintable from "../operations/QuotedPrintable.js";
import Rotate from "../operations/Rotate.js"; import Rotate from "../operations/Rotate.js";
import SeqUtils from "../operations/SeqUtils.js"; import SeqUtils from "../operations/SeqUtils.js";
import Shellcode from "../operations/Shellcode.js";
import StrUtils from "../operations/StrUtils.js"; import StrUtils from "../operations/StrUtils.js";
import Tidy from "../operations/Tidy.js"; import Tidy from "../operations/Tidy.js";
import Unicode from "../operations/Unicode.js"; import Unicode from "../operations/Unicode.js";
import URL_ from "../operations/URL.js"; import URL_ from "../operations/URL.js";
import UUID from "../operations/UUID.js";
/** /**
@ -320,6 +314,44 @@ const OperationConfig = {
} }
] ]
}, },
"Disassemble x86": {
module: "Shellcode",
description: "Disassembly is the process of translating machine language into assembly language.<br><br>This operation supports 64-bit, 32-bit and 16-bit code written for Intel or AMD x86 processors. It is particularly useful for reverse engineering shellcode.<br><br>Input should be in hexadecimal.",
inputType: "string",
outputType: "string",
args: [
{
name: "Bit mode",
type: "option",
value: Shellcode.MODE
},
{
name: "Compatibility",
type: "option",
value: Shellcode.COMPATIBILITY
},
{
name: "Code Segment (CS)",
type: "number",
value: 16
},
{
name: "Offset (IP)",
type: "number",
value: 0
},
{
name: "Show instruction hex",
type: "boolean",
value: true
},
{
name: "Show instruction position",
type: "boolean",
value: true
}
]
},
"XOR": { "XOR": {
module: "Default", module: "Default",
description: "XOR the input with the given key.<br>e.g. <code>fe023da5</code><br><br><strong>Options</strong><br><u>Null preserving:</u> If the current byte is 0x00 or the same as the key, skip it.<br><br><u>Scheme:</u><ul><li>Standard - key is unchanged after each round</li><li>Input differential - key is set to the value of the previous unprocessed byte</li><li>Output differential - key is set to the value of the previous processed byte</li></ul>", description: "XOR the input with the given key.<br>e.g. <code>fe023da5</code><br><br><strong>Options</strong><br><u>Null preserving:</u> If the current byte is 0x00 or the same as the key, skip it.<br><br><u>Scheme:</u><ul><li>Standard - key is unchanged after each round</li><li>Input differential - key is set to the value of the previous unprocessed byte</li><li>Output differential - key is set to the value of the previous processed byte</li></ul>",
@ -728,14 +760,14 @@ const OperationConfig = {
] ]
}, },
"URL Decode": { "URL Decode": {
module: "Default", module: "URL",
description: "Converts URI/URL percent-encoded characters back to their raw values.<br><br>e.g. <code>%3d</code> becomes <code>=</code>", description: "Converts URI/URL percent-encoded characters back to their raw values.<br><br>e.g. <code>%3d</code> becomes <code>=</code>",
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
args: [] args: []
}, },
"URL Encode": { "URL Encode": {
module: "Default", module: "URL",
description: "Encodes problematic characters into percent-encoding, a format supported by URIs/URLs.<br><br>e.g. <code>=</code> becomes <code>%3d</code>", description: "Encodes problematic characters into percent-encoding, a format supported by URIs/URLs.<br><br>e.g. <code>=</code> becomes <code>%3d</code>",
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
@ -748,7 +780,7 @@ const OperationConfig = {
] ]
}, },
"Parse URI": { "Parse URI": {
module: "Default", module: "URL",
description: "Pretty prints complicated Uniform Resource Identifier (URI) strings for ease of reading. Particularly useful for Uniform Resource Locators (URLs) with a lot of arguments.", description: "Pretty prints complicated Uniform Resource Identifier (URI) strings for ease of reading. Particularly useful for Uniform Resource Locators (URLs) with a lot of arguments.",
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
@ -3831,3 +3863,5 @@ function valExport() {
} }
export default valExport; export default valExport;
export { OperationConfig };

View file

@ -26,7 +26,6 @@ import SeqUtils from "../../operations/SeqUtils.js";
import StrUtils from "../../operations/StrUtils.js"; import StrUtils from "../../operations/StrUtils.js";
import Tidy from "../../operations/Tidy.js"; import Tidy from "../../operations/Tidy.js";
import Unicode from "../../operations/Unicode.js"; import Unicode from "../../operations/Unicode.js";
import URL_ from "../../operations/URL.js";
import UUID from "../../operations/UUID.js"; import UUID from "../../operations/UUID.js";
@ -77,9 +76,6 @@ OpModules.Default = {
"From HTML Entity": HTML.runFromEntity, "From HTML Entity": HTML.runFromEntity,
"Strip HTML tags": HTML.runStripTags, "Strip HTML tags": HTML.runStripTags,
"Parse colour code": HTML.runParseColourCode, "Parse colour code": HTML.runParseColourCode,
"URL Encode": URL_.runTo,
"URL Decode": URL_.runFrom,
"Parse URI": URL_.runParse,
"Unescape Unicode Characters": Unicode.runUnescape, "Unescape Unicode Characters": Unicode.runUnescape,
"To Quoted Printable": QuotedPrintable.runTo, "To Quoted Printable": QuotedPrintable.runTo,
"From Quoted Printable": QuotedPrintable.runFrom, "From Quoted Printable": QuotedPrintable.runFrom,

View file

@ -18,6 +18,8 @@ import HTTPModule from "./HTTP.js";
import ImageModule from "./Image.js"; import ImageModule from "./Image.js";
import JSBNModule from "./JSBN.js"; import JSBNModule from "./JSBN.js";
import PublicKeyModule from "./PublicKey.js"; import PublicKeyModule from "./PublicKey.js";
import ShellcodeModule from "./Shellcode.js";
import URLModule from "./URL.js";
Object.assign( Object.assign(
OpModules, OpModules,
@ -31,7 +33,9 @@ Object.assign(
HTTPModule, HTTPModule,
ImageModule, ImageModule,
JSBNModule, JSBNModule,
PublicKeyModule PublicKeyModule,
ShellcodeModule,
URLModule
); );
export default OpModules; export default OpModules;

View file

@ -0,0 +1,20 @@
import Shellcode from "../../operations/Shellcode.js";
/**
* Shellcode module.
*
* Libraries:
* - DisassembleX86-64.js
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
let OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
OpModules.Shellcode = {
"Disassemble x86": Shellcode.runDisassemble,
};
export default OpModules;

View file

@ -0,0 +1,23 @@
import URL_ from "../../operations/URL.js";
/**
* URL module.
*
* Libraries:
* - Utils.js
* - url
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
let OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
OpModules.URL = {
"URL Encode": URL_.runTo,
"URL Decode": URL_.runFrom,
"Parse URI": URL_.runParse,
};
export default OpModules;

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,3 @@
/* globals app */
import Utils from "../Utils.js"; import Utils from "../Utils.js";

View file

@ -1,6 +1,4 @@
import cptable from "../lib/js-codepage/cptable.js"; import cptable from "../lib/js-codepage/cptable.js";
import Utils from "../Utils.js";
import CryptoJS from "crypto-js";
/** /**

View file

@ -192,268 +192,270 @@ const DateTime = {
/** /**
* @constant * @constant
*/ */
FORMAT_EXAMPLES: "Format string tokens:\n\n\ FORMAT_EXAMPLES: `Format string tokens:
<table class='table table-striped table-hover table-condensed table-bordered' style='font-family: sans-serif'>\
<thead>\
<tr>\ <table class="table table-striped table-hover table-condensed table-bordered" style="font-family: sans-serif">
<th>Category</th>\ <thead>
<th>Token</th>\ <tr>
<th>Output</th>\ <th>Category</th>
</tr>\ <th>Token</th>
</thead>\ <th>Output</th>
<tbody>\ </tr>
<tr>\ </thead>
<td><b>Month</b></td>\ <tbody>
<td>M</td>\ <tr>
<td>1 2 ... 11 12</td>\ <td><b>Month</b></td>
</tr>\ <td>M</td>
<tr>\ <td>1 2 ... 11 12</td>
<td></td>\ </tr>
<td>Mo</td>\ <tr>
<td>1st 2nd ... 11th 12th</td>\ <td></td>
</tr>\ <td>Mo</td>
<tr>\ <td>1st 2nd ... 11th 12th</td>
<td></td>\ </tr>
<td>MM</td>\ <tr>
<td>01 02 ... 11 12</td>\ <td></td>
</tr>\ <td>MM</td>
<tr>\ <td>01 02 ... 11 12</td>
<td></td>\ </tr>
<td>MMM</td>\ <tr>
<td>Jan Feb ... Nov Dec</td>\ <td></td>
</tr>\ <td>MMM</td>
<tr>\ <td>Jan Feb ... Nov Dec</td>
<td></td>\ </tr>
<td>MMMM</td>\ <tr>
<td>January February ... November December</td>\ <td></td>
</tr>\ <td>MMMM</td>
<tr>\ <td>January February ... November December</td>
<td><b>Quarter</b></td>\ </tr>
<td>Q</td>\ <tr>
<td>1 2 3 4</td>\ <td><b>Quarter</b></td>
</tr>\ <td>Q</td>
<tr>\ <td>1 2 3 4</td>
<td><b>Day of Month</b></td>\ </tr>
<td>D</td>\ <tr>
<td>1 2 ... 30 31</td>\ <td><b>Day of Month</b></td>
</tr>\ <td>D</td>
<tr>\ <td>1 2 ... 30 31</td>
<td></td>\ </tr>
<td>Do</td>\ <tr>
<td>1st 2nd ... 30th 31st</td>\ <td></td>
</tr>\ <td>Do</td>
<tr>\ <td>1st 2nd ... 30th 31st</td>
<td></td>\ </tr>
<td>DD</td>\ <tr>
<td>01 02 ... 30 31</td>\ <td></td>
</tr>\ <td>DD</td>
<tr>\ <td>01 02 ... 30 31</td>
<td><b>Day of Year</b></td>\ </tr>
<td>DDD</td>\ <tr>
<td>1 2 ... 364 365</td>\ <td><b>Day of Year</b></td>
</tr>\ <td>DDD</td>
<tr>\ <td>1 2 ... 364 365</td>
<td></td>\ </tr>
<td>DDDo</td>\ <tr>
<td>1st 2nd ... 364th 365th</td>\ <td></td>
</tr>\ <td>DDDo</td>
<tr>\ <td>1st 2nd ... 364th 365th</td>
<td></td>\ </tr>
<td>DDDD</td>\ <tr>
<td>001 002 ... 364 365</td>\ <td></td>
</tr>\ <td>DDDD</td>
<tr>\ <td>001 002 ... 364 365</td>
<td><b>Day of Week</b></td>\ </tr>
<td>d</td>\ <tr>
<td>0 1 ... 5 6</td>\ <td><b>Day of Week</b></td>
</tr>\ <td>d</td>
<tr>\ <td>0 1 ... 5 6</td>
<td></td>\ </tr>
<td>do</td>\ <tr>
<td>0th 1st ... 5th 6th</td>\ <td></td>
</tr>\ <td>do</td>
<tr>\ <td>0th 1st ... 5th 6th</td>
<td></td>\ </tr>
<td>dd</td>\ <tr>
<td>Su Mo ... Fr Sa</td>\ <td></td>
</tr>\ <td>dd</td>
<tr>\ <td>Su Mo ... Fr Sa</td>
<td></td>\ </tr>
<td>ddd</td>\ <tr>
<td>Sun Mon ... Fri Sat</td>\ <td></td>
</tr>\ <td>ddd</td>
<tr>\ <td>Sun Mon ... Fri Sat</td>
<td></td>\ </tr>
<td>dddd</td>\ <tr>
<td>Sunday Monday ... Friday Saturday</td>\ <td></td>
</tr>\ <td>dddd</td>
<tr>\ <td>Sunday Monday ... Friday Saturday</td>
<td><b>Day of Week (Locale)</b></td>\ </tr>
<td>e</td>\ <tr>
<td>0 1 ... 5 6</td>\ <td><b>Day of Week (Locale)</b></td>
</tr>\ <td>e</td>
<tr>\ <td>0 1 ... 5 6</td>
<td><b>Day of Week (ISO)</b></td>\ </tr>
<td>E</td>\ <tr>
<td>1 2 ... 6 7</td>\ <td><b>Day of Week (ISO)</b></td>
</tr>\ <td>E</td>
<tr>\ <td>1 2 ... 6 7</td>
<td><b>Week of Year</b></td>\ </tr>
<td>w</td>\ <tr>
<td>1 2 ... 52 53</td>\ <td><b>Week of Year</b></td>
</tr>\ <td>w</td>
<tr>\ <td>1 2 ... 52 53</td>
<td></td>\ </tr>
<td>wo</td>\ <tr>
<td>1st 2nd ... 52nd 53rd</td>\ <td></td>
</tr>\ <td>wo</td>
<tr>\ <td>1st 2nd ... 52nd 53rd</td>
<td></td>\ </tr>
<td>ww</td>\ <tr>
<td>01 02 ... 52 53</td>\ <td></td>
</tr>\ <td>ww</td>
<tr>\ <td>01 02 ... 52 53</td>
<td><b>Week of Year (ISO)</b></td>\ </tr>
<td>W</td>\ <tr>
<td>1 2 ... 52 53</td>\ <td><b>Week of Year (ISO)</b></td>
</tr>\ <td>W</td>
<tr>\ <td>1 2 ... 52 53</td>
<td></td>\ </tr>
<td>Wo</td>\ <tr>
<td>1st 2nd ... 52nd 53rd</td>\ <td></td>
</tr>\ <td>Wo</td>
<tr>\ <td>1st 2nd ... 52nd 53rd</td>
<td></td>\ </tr>
<td>WW</td>\ <tr>
<td>01 02 ... 52 53</td>\ <td></td>
</tr>\ <td>WW</td>
<tr>\ <td>01 02 ... 52 53</td>
<td><b>Year</b></td>\ </tr>
<td>YY</td>\ <tr>
<td>70 71 ... 29 30</td>\ <td><b>Year</b></td>
</tr>\ <td>YY</td>
<tr>\ <td>70 71 ... 29 30</td>
<td></td>\ </tr>
<td>YYYY</td>\ <tr>
<td>1970 1971 ... 2029 2030</td>\ <td></td>
</tr>\ <td>YYYY</td>
<tr>\ <td>1970 1971 ... 2029 2030</td>
<td><b>Week Year</b></td>\ </tr>
<td>gg</td>\ <tr>
<td>70 71 ... 29 30</td>\ <td><b>Week Year</b></td>
</tr>\ <td>gg</td>
<tr>\ <td>70 71 ... 29 30</td>
<td></td>\ </tr>
<td>gggg</td>\ <tr>
<td>1970 1971 ... 2029 2030</td>\ <td></td>
</tr>\ <td>gggg</td>
<tr>\ <td>1970 1971 ... 2029 2030</td>
<td><b>Week Year (ISO)</b></td>\ </tr>
<td>GG</td>\ <tr>
<td>70 71 ... 29 30</td>\ <td><b>Week Year (ISO)</b></td>
</tr>\ <td>GG</td>
<tr>\ <td>70 71 ... 29 30</td>
<td></td>\ </tr>
<td>GGGG</td>\ <tr>
<td>1970 1971 ... 2029 2030</td>\ <td></td>
</tr>\ <td>GGGG</td>
<tr>\ <td>1970 1971 ... 2029 2030</td>
<td><b>AM/PM</b></td>\ </tr>
<td>A</td>\ <tr>
<td>AM PM</td>\ <td><b>AM/PM</b></td>
</tr>\ <td>A</td>
<tr>\ <td>AM PM</td>
<td></td>\ </tr>
<td>a</td>\ <tr>
<td>am pm</td>\ <td></td>
</tr>\ <td>a</td>
<tr>\ <td>am pm</td>
<td><b>Hour</b></td>\ </tr>
<td>H</td>\ <tr>
<td>0 1 ... 22 23</td>\ <td><b>Hour</b></td>
</tr>\ <td>H</td>
<tr>\ <td>0 1 ... 22 23</td>
<td></td>\ </tr>
<td>HH</td>\ <tr>
<td>00 01 ... 22 23</td>\ <td></td>
</tr>\ <td>HH</td>
<tr>\ <td>00 01 ... 22 23</td>
<td></td>\ </tr>
<td>h</td>\ <tr>
<td>1 2 ... 11 12</td>\ <td></td>
</tr>\ <td>h</td>
<tr>\ <td>1 2 ... 11 12</td>
<td></td>\ </tr>
<td>hh</td>\ <tr>
<td>01 02 ... 11 12</td>\ <td></td>
</tr>\ <td>hh</td>
<tr>\ <td>01 02 ... 11 12</td>
<td><b>Minute</b></td>\ </tr>
<td>m</td>\ <tr>
<td>0 1 ... 58 59</td>\ <td><b>Minute</b></td>
</tr>\ <td>m</td>
<tr>\ <td>0 1 ... 58 59</td>
<td></td>\ </tr>
<td>mm</td>\ <tr>
<td>00 01 ... 58 59</td>\ <td></td>
</tr>\ <td>mm</td>
<tr>\ <td>00 01 ... 58 59</td>
<td><b>Second</b></td>\ </tr>
<td>s</td>\ <tr>
<td>0 1 ... 58 59</td>\ <td><b>Second</b></td>
</tr>\ <td>s</td>
<tr>\ <td>0 1 ... 58 59</td>
<td></td>\ </tr>
<td>ss</td>\ <tr>
<td>00 01 ... 58 59</td>\ <td></td>
</tr>\ <td>ss</td>
<tr>\ <td>00 01 ... 58 59</td>
<td><b>Fractional Second</b></td>\ </tr>
<td>S</td>\ <tr>
<td>0 1 ... 8 9</td>\ <td><b>Fractional Second</b></td>
</tr>\ <td>S</td>
<tr>\ <td>0 1 ... 8 9</td>
<td></td>\ </tr>
<td>SS</td>\ <tr>
<td>00 01 ... 98 99</td>\ <td></td>
</tr>\ <td>SS</td>
<tr>\ <td>00 01 ... 98 99</td>
<td></td>\ </tr>
<td>SSS</td>\ <tr>
<td>000 001 ... 998 999</td>\ <td></td>
</tr>\ <td>SSS</td>
<tr>\ <td>000 001 ... 998 999</td>
<td></td>\ </tr>
<td>SSSS ... SSSSSSSSS</td>\ <tr>
<td>000[0..] 001[0..] ... 998[0..] 999[0..]</td>\ <td></td>
</tr>\ <td>SSSS ... SSSSSSSSS</td>
<tr>\ <td>000[0..] 001[0..] ... 998[0..] 999[0..]</td>
<td><b>Timezone</b></td>\ </tr>
<td>z or zz</td>\ <tr>
<td>EST CST ... MST PST</td>\ <td><b>Timezone</b></td>
</tr>\ <td>z or zz</td>
<tr>\ <td>EST CST ... MST PST</td>
<td></td>\ </tr>
<td>Z</td>\ <tr>
<td>-07:00 -06:00 ... +06:00 +07:00</td>\ <td></td>
</tr>\ <td>Z</td>
<tr>\ <td>-07:00 -06:00 ... +06:00 +07:00</td>
<td></td>\ </tr>
<td>ZZ</td>\ <tr>
<td>-0700 -0600 ... +0600 +0700</td>\ <td></td>
</tr>\ <td>ZZ</td>
<tr>\ <td>-0700 -0600 ... +0600 +0700</td>
<td><b>Unix Timestamp</b></td>\ </tr>
<td>X</td>\ <tr>
<td>1360013296</td>\ <td><b>Unix Timestamp</b></td>
</tr>\ <td>X</td>
<tr>\ <td>1360013296</td>
<td><b>Unix Millisecond Timestamp</b></td>\ </tr>
<td>x</td>\ <tr>
<td>1360013296123</td>\ <td><b>Unix Millisecond Timestamp</b></td>
</tr>\ <td>x</td>
</tbody>\ <td>1360013296123</td>
</table>", </tr>
</tbody>
</table>`,
}; };

View file

@ -225,26 +225,26 @@ const HTML = {
cmyk = "cmyk(" + c + ", " + m + ", " + y + ", " + k + ")"; cmyk = "cmyk(" + c + ", " + m + ", " + y + ", " + k + ")";
// Generate output // Generate output
return "<div id='colorpicker' style='display: inline-block'></div>" + return `<div id="colorpicker" style="display: inline-block"></div>
"Hex: " + hex + "\n" + Hex: ${hex}
"RGB: " + rgb + "\n" + RGB: ${rgb}
"RGBA: " + rgba + "\n" + RGBA: ${rgba}
"HSL: " + hsl + "\n" + HSL: ${hsl}
"HSLA: " + hsla + "\n" + HSLA: ${hsla}
"CMYK: " + cmyk + CMYK: ${cmyk}
"<script>\ <script>
$('#colorpicker').colorpicker({\ $('#colorpicker').colorpicker({
format: 'rgba',\ format: 'rgba',
color: '" + rgba + "',\ color: '${rgba}',
container: true,\ container: true,
inline: true,\ inline: true,
}).on('changeColor', function(e) {\ }).on('changeColor', function(e) {
var color = e.color.toRGB();\ var color = e.color.toRGB();
document.getElementById('input-text').value = 'rgba(' +\ document.getElementById('input-text').value = 'rgba(' +
color.r + ', ' + color.g + ', ' + color.b + ', ' + color.a + ')';\ color.r + ', ' + color.g + ', ' + color.b + ', ' + color.a + ')';
window.app.autoBake();\ window.app.autoBake();
});\ });
</script>"; </script>`;
}, },

View file

@ -16,6 +16,22 @@ import Checksum from "./Checksum.js";
*/ */
const Hash = { const Hash = {
/**
* Generic hash function.
*
* @param {string} name
* @param {string} input
* @returns {string}
*/
runHash: function(name, input) {
const hasher = CryptoApi.hasher(name);
hasher.state.message = input;
hasher.state.length += input.length;
hasher.process();
return hasher.finalize().stringify("hex");
},
/** /**
* MD2 operation. * MD2 operation.
* *
@ -24,7 +40,7 @@ const Hash = {
* @returns {string} * @returns {string}
*/ */
runMD2: function (input, args) { runMD2: function (input, args) {
return CryptoApi.hash("md2", input, {}).stringify("hex"); return Hash.runHash("md2", input);
}, },
@ -36,7 +52,7 @@ const Hash = {
* @returns {string} * @returns {string}
*/ */
runMD4: function (input, args) { runMD4: function (input, args) {
return CryptoApi.hash("md4", input, {}).stringify("hex"); return Hash.runHash("md4", input);
}, },
@ -48,7 +64,7 @@ const Hash = {
* @returns {string} * @returns {string}
*/ */
runMD5: function (input, args) { runMD5: function (input, args) {
return CryptoApi.hash("md5", input, {}).stringify("hex"); return Hash.runHash("md5", input);
}, },
@ -92,7 +108,7 @@ const Hash = {
* @returns {string} * @returns {string}
*/ */
runSHA0: function (input, args) { runSHA0: function (input, args) {
return CryptoApi.hash("sha0", input, {}).stringify("hex"); return Hash.runHash("sha0", input);
}, },
@ -104,7 +120,7 @@ const Hash = {
* @returns {string} * @returns {string}
*/ */
runSHA1: function (input, args) { runSHA1: function (input, args) {
return CryptoApi.hash("sha1", input, {}).stringify("hex"); return Hash.runHash("sha1", input);
}, },
@ -123,7 +139,7 @@ const Hash = {
*/ */
runSHA2: function (input, args) { runSHA2: function (input, args) {
const size = args[0]; const size = args[0];
return CryptoApi.hash("sha" + size, input, {}).stringify("hex"); return Hash.runHash("sha" + size, input);
}, },
@ -259,7 +275,7 @@ const Hash = {
*/ */
runRIPEMD: function (input, args) { runRIPEMD: function (input, args) {
const size = args[0]; const size = args[0];
return CryptoApi.hash("ripemd" + size, input, {}).stringify("hex"); return Hash.runHash("ripemd" + size, input);
}, },
@ -271,7 +287,7 @@ const Hash = {
* @returns {string} * @returns {string}
*/ */
runHAS: function (input, args) { runHAS: function (input, args) {
return CryptoApi.hash("has160", input, {}).stringify("hex"); return Hash.runHash("has160", input);
}, },
@ -290,7 +306,7 @@ const Hash = {
*/ */
runWhirlpool: function (input, args) { runWhirlpool: function (input, args) {
const variant = args[0].toLowerCase(); const variant = args[0].toLowerCase();
return CryptoApi.hash(variant, input, {}).stringify("hex"); return Hash.runHash(variant, input);
}, },
@ -315,7 +331,7 @@ const Hash = {
runSnefru: function (input, args) { runSnefru: function (input, args) {
const rounds = args[0], const rounds = args[0],
size = args[1]; size = args[1];
return CryptoApi.hash(`snefru-${rounds}-${size}`, input, {}).stringify("hex"); return Hash.runHash(`snefru-${rounds}-${size}`, input);
}, },

View file

@ -1,4 +1,3 @@
/* globals app */
import Utils from "../Utils.js"; import Utils from "../Utils.js";

View file

@ -249,7 +249,7 @@ const SeqUtils = {
} }
} }
return 0; return a.localeCompare(b);
}, },
}; };

View file

@ -0,0 +1,96 @@
import disassemble from "../lib/DisassembleX86-64.js";
/**
* Shellcode operations.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2017
* @license Apache-2.0
*
* @namespace
*/
const Shellcode = {
/**
* @constant
* @default
*/
MODE: ["64", "32", "16"],
/**
* @constant
* @default
*/
COMPATIBILITY: [
"Full x86 architecture",
"Knights Corner",
"Larrabee",
"Cyrix",
"Geode",
"Centaur",
"X86/486"
],
/**
* Disassemble x86 operation.
*
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
runDisassemble: function(input, args) {
const mode = args[0],
compatibility = args[1],
codeSegment = args[2],
offset = args[3],
showInstructionHex = args[4],
showInstructionPos = args[5];
switch (mode) {
case "64":
disassemble.setBitMode(2);
break;
case "32":
disassemble.setBitMode(1);
break;
case "16":
disassemble.setBitMode(0);
break;
default:
throw "Invalid mode value";
}
switch (compatibility) {
case "Full x86 architecture":
disassemble.CompatibilityMode(0);
break;
case "Knights Corner":
disassemble.CompatibilityMode(1);
break;
case "Larrabee":
disassemble.CompatibilityMode(2);
break;
case "Cyrix":
disassemble.CompatibilityMode(3);
break;
case "Geode":
disassemble.CompatibilityMode(4);
break;
case "Centaur":
disassemble.CompatibilityMode(5);
break;
case "X86/486":
disassemble.CompatibilityMode(6);
break;
}
disassemble.SetBasePosition(codeSegment + ":" + offset);
disassemble.setShowInstructionHex(showInstructionHex);
disassemble.setShowInstructionPos(showInstructionPos);
disassemble.LoadBinCode(input.replace(/\s/g, ""));
return disassemble.LDisassemble();
},
};
export default Shellcode;

View file

@ -1,5 +1,6 @@
/* globals unescape */ /* globals unescape */
import Utils from "../Utils.js"; import Utils from "../Utils.js";
import url from "url";
/** /**
@ -58,56 +59,36 @@ const URL_ = {
* @returns {string} * @returns {string}
*/ */
runParse: function(input, args) { runParse: function(input, args) {
if (!document) { const uri = url.parse(input, true);
throw "This operation only works in a browser.";
}
const a = document.createElement("a");
// Overwrite base href which will be the current CyberChef URL to reduce confusion.
a.href = "http://example.com/";
a.href = input;
if (a.protocol) {
let output = ""; let output = "";
if (a.hostname !== window.location.hostname) {
output = "Protocol:\t" + a.protocol + "\n";
if (a.hostname) output += "Hostname:\t" + a.hostname + "\n";
if (a.port) output += "Port:\t\t" + a.port + "\n";
}
if (a.pathname && a.pathname !== window.location.pathname) { if (uri.protocol) output += "Protocol:\t" + uri.protocol + "\n";
let pathname = a.pathname; if (uri.auth) output += "Auth:\t\t" + uri.auth + "\n";
if (pathname.indexOf(window.location.pathname) === 0) if (uri.hostname) output += "Hostname:\t" + uri.hostname + "\n";
pathname = pathname.replace(window.location.pathname, ""); if (uri.port) output += "Port:\t\t" + uri.port + "\n";
if (pathname) if (uri.pathname) output += "Path name:\t" + uri.pathname + "\n";
output += "Path name:\t" + pathname + "\n"; if (uri.query) {
} let keys = Object.keys(uri.query),
padding = 0;
if (a.hash && a.hash !== window.location.hash) { keys.forEach(k => {
output += "Hash:\t\t" + a.hash + "\n"; padding = (k.length > padding) ? k.length : padding;
} });
if (a.search && a.search !== window.location.search) {
output += "Arguments:\n"; output += "Arguments:\n";
const args_ = (a.search.slice(1, a.search.length)).split("&"); for (let key in uri.query) {
let splitArgs = [], padding = 0, i; output += "\t" + Utils.padRight(key, padding);
for (i = 0; i < args_.length; i++) { if (uri.query[key].length) {
splitArgs.push(args_[i].split("=")); output += " = " + uri.query[key] + "\n";
padding = (splitArgs[i][0].length > padding) ? splitArgs[i][0].length : padding; } else {
} output += "\n";
for (i = 0; i < splitArgs.length; i++) {
output += "\t" + Utils.padRight(splitArgs[i][0], padding);
if (splitArgs[i].length > 1 && splitArgs[i][1].length)
output += " = " + splitArgs[i][1] + "\n";
else output += "\n";
} }
} }
}
if (uri.hash) output += "Hash:\t\t" + uri.hash + "\n";
return output; return output;
}
return "Invalid URI";
}, },

View file

@ -9,7 +9,7 @@ require("babel-polyfill");
const Chef = require("../core/Chef.js").default; const Chef = require("../core/Chef.js").default;
const CyberChef = module.exports = { const CyberChef = {
bake: function(input, recipeConfig) { bake: function(input, recipeConfig) {
this.chef = new Chef(); this.chef = new Chef();
@ -23,3 +23,5 @@ const CyberChef = module.exports = {
} }
}; };
module.exports = CyberChef;

View file

@ -88,9 +88,10 @@ App.prototype.loaded = function() {
* An error handler for displaying the error to the user. * An error handler for displaying the error to the user.
* *
* @param {Error} err * @param {Error} err
* @param {boolean} [logToConsole=false]
*/ */
App.prototype.handleError = function(err) { App.prototype.handleError = function(err, logToConsole) {
console.error(err); if (logToConsole) console.error(err);
const msg = err.displayStr || err.toString(); const msg = err.displayStr || err.toString();
this.alert(msg, "danger", this.options.errorTimeout, !this.options.showErrors); this.alert(msg, "danger", this.options.errorTimeout, !this.options.showErrors);
}; };

View file

@ -380,6 +380,11 @@
</p> </p>
<p>&copy; Crown Copyright 2016.</p> <p>&copy; Crown Copyright 2016.</p>
<p>Released under the Apache Licence, Version 2.0.</p> <p>Released under the Apache Licence, Version 2.0.</p>
<p>
<a href="https://gitter.im/gchq/CyberChef">
<img src="<%- require('../static/images/gitter-badge.svg') %>">
</a>
</p>
<br> <br>
<br> <br>
<div> <div>
@ -417,6 +422,7 @@
<li><a href="#recipe=Translate_DateTime_Format('Standard%20date%20and%20time','DD/MM/YYYY%20HH:mm:ss','UTC','dddd%20Do%20MMMM%20YYYY%20HH:mm:ss%20Z%20z','Australia/Queensland')&input=MTUvMDYvMjAxNSAyMDo0NTowMA">Convert a date and time to a different time zone</a></li> <li><a href="#recipe=Translate_DateTime_Format('Standard%20date%20and%20time','DD/MM/YYYY%20HH:mm:ss','UTC','dddd%20Do%20MMMM%20YYYY%20HH:mm:ss%20Z%20z','Australia/Queensland')&input=MTUvMDYvMjAxNSAyMDo0NTowMA">Convert a date and time to a different time zone</a></li>
<li><a href="#recipe=Parse_IPv6_address()&input=MjAwMTowMDAwOjQxMzY6ZTM3ODo4MDAwOjYzYmY6M2ZmZjpmZGQy">Parse a Teredo IPv6 address</a></li> <li><a href="#recipe=Parse_IPv6_address()&input=MjAwMTowMDAwOjQxMzY6ZTM3ODo4MDAwOjYzYmY6M2ZmZjpmZGQy">Parse a Teredo IPv6 address</a></li>
<li><a href="#recipe=From_Hexdump()Gunzip()&input=MDAwMDAwMDAgIDFmIDhiIDA4IDAwIDEyIGJjIGYzIDU3IDAwIGZmIDBkIGM3IGMxIDA5IDAwIDIwICB8Li4uLi6881cu/y7HwS4uIHwKMDAwMDAwMTAgIDA4IDA1IGQwIDU1IGZlIDA0IDJkIGQzIDA0IDFmIGNhIDhjIDQ0IDIxIDViIGZmICB8Li7QVf4uLdMuLsouRCFb/3wKMDAwMDAwMjAgIDYwIGM3IGQ3IDAzIDE2IGJlIDQwIDFmIDc4IDRhIDNmIDA5IDg5IDBiIDlhIDdkICB8YMfXLi6%2BQC54Sj8uLi4ufXwKMDAwMDAwMzAgIDRlIGM4IDRlIDZkIDA1IDFlIDAxIDhiIDRjIDI0IDAwIDAwIDAwICAgICAgICAgICB8TshObS4uLi5MJC4uLnw">Convert data from a hexdump, then decompress</a></li> <li><a href="#recipe=From_Hexdump()Gunzip()&input=MDAwMDAwMDAgIDFmIDhiIDA4IDAwIDEyIGJjIGYzIDU3IDAwIGZmIDBkIGM3IGMxIDA5IDAwIDIwICB8Li4uLi6881cu/y7HwS4uIHwKMDAwMDAwMTAgIDA4IDA1IGQwIDU1IGZlIDA0IDJkIGQzIDA0IDFmIGNhIDhjIDQ0IDIxIDViIGZmICB8Li7QVf4uLdMuLsouRCFb/3wKMDAwMDAwMjAgIDYwIGM3IGQ3IDAzIDE2IGJlIDQwIDFmIDc4IDRhIDNmIDA5IDg5IDBiIDlhIDdkICB8YMfXLi6%2BQC54Sj8uLi4ufXwKMDAwMDAwMzAgIDRlIGM4IDRlIDZkIDA1IDFlIDAxIDhiIDRjIDI0IDAwIDAwIDAwICAgICAgICAgICB8TshObS4uLi5MJC4uLnw">Convert data from a hexdump, then decompress</a></li>
<li><a href="#recipe=RC4(%7B'option':'UTF8','string':'secret'%7D,'Hex','Hex')Disassemble_x86('64','Full%20x86%20architecture',16,0,true,true)&input=MjFkZGQyNTQwMTYwZWU2NWZlMDc3NzEwM2YyYTM5ZmJlNWJjYjZhYTBhYWJkNDE0ZjkwYzZjYWY1MzEyNzU0YWY3NzRiNzZiM2JiY2QxOTNjYjNkZGZkYmM1YTI2NTMzYTY4NmI1OWI4ZmVkNGQzODBkNDc0NDIwMWFlYzIwNDA1MDcxMzhlMmZlMmIzOTUwNDQ2ZGIzMWQyYmM2MjliZTRkM2YyZWIwMDQzYzI5M2Q3YTVkMjk2MmMwMGZlNmRhMzAwNzJkOGM1YTZiNGZlN2Q4NTlhMDQwZWVhZjI5OTczMzYzMDJmNWEwZWMxOQ">Decrypt and disassemble shellcode</a></li>
<li><a href="#recipe=Fork('%5C%5Cn','%5C%5Cn',false)From_UNIX_Timestamp('Seconds%20(s)')&input=OTc4MzQ2ODAwCjEwMTI2NTEyMDAKMTA0NjY5NjQwMAoxMDgxMDg3MjAwCjExMTUzMDUyMDAKMTE0OTYwOTYwMA">Display multiple timestamps as full dates</a></li> <li><a href="#recipe=Fork('%5C%5Cn','%5C%5Cn',false)From_UNIX_Timestamp('Seconds%20(s)')&input=OTc4MzQ2ODAwCjEwMTI2NTEyMDAKMTA0NjY5NjQwMAoxMDgxMDg3MjAwCjExMTUzMDUyMDAKMTE0OTYwOTYwMA">Display multiple timestamps as full dates</a></li>
<li><a href="#recipe=Fork('%5C%5Cn','%5C%5Cn',false)Conditional_Jump('1',2,10)To_Hex('Space')Return()To_Base64('A-Za-z0-9%2B/%3D')&input=U29tZSBkYXRhIHdpdGggYSAxIGluIGl0ClNvbWUgZGF0YSB3aXRoIGEgMiBpbiBpdA">Carry out different operations on data of different types</a></li> <li><a href="#recipe=Fork('%5C%5Cn','%5C%5Cn',false)Conditional_Jump('1',2,10)To_Hex('Space')Return()To_Base64('A-Za-z0-9%2B/%3D')&input=U29tZSBkYXRhIHdpdGggYSAxIGluIGl0ClNvbWUgZGF0YSB3aXRoIGEgMiBpbiBpdA">Carry out different operations on data of different types</a></li>
<li><a href="#recipe=Register('key%3D(%5B%5C%5Cda-f%5D*)',true,false)Find_/_Replace(%7B'option':'Regex','string':'.*data%3D(.*)'%7D,'$1',true,false,true)RC4(%7B'option':'Hex','string':'$R0'%7D,'Hex','Latin1')&input=aHR0cDovL21hbHdhcmV6LmJpei9iZWFjb24ucGhwP2tleT0wZTkzMmE1YyZkYXRhPThkYjdkNWViZTM4NjYzYTU0ZWNiYjMzNGUzZGIxMQ">Use parts of the input as arguments to operations</a></li> <li><a href="#recipe=Register('key%3D(%5B%5C%5Cda-f%5D*)',true,false)Find_/_Replace(%7B'option':'Regex','string':'.*data%3D(.*)'%7D,'$1',true,false,true)RC4(%7B'option':'Hex','string':'$R0'%7D,'Hex','Latin1')&input=aHR0cDovL21hbHdhcmV6LmJpei9iZWFjb24ucGhwP2tleT0wZTkzMmE1YyZkYXRhPThkYjdkNWViZTM4NjYzYTU0ZWNiYjMzNGUzZGIxMQ">Use parts of the input as arguments to operations</a></li>

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="92" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="92" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h34v20H0z"/><path fill="#46BC99" d="M34 0h58v20H34z"/><path fill="url(#b)" d="M0 0h92v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="17" y="15" fill="#010101" fill-opacity=".3">chat</text><text x="17" y="14">chat</text><text x="62" y="15" fill="#010101" fill-opacity=".3">on gitter</text><text x="62" y="14">on gitter</text></g></svg>

After

Width:  |  Height:  |  Size: 733 B

View file

@ -10,8 +10,8 @@ import TestRegister from "../../TestRegister.js";
TestRegister.addTests([ TestRegister.addTests([
{ {
name: "SeqUtils - Numeric sort photos", name: "SeqUtils - Numeric sort photos",
input: "Photo-1.jpg\nPhoto-4.jpg\nPhoto-2.jpg\nPhoto-3.jpg\n", input: "Photo-1.jpg\nPhoto-4.jpg\nPhoto-2.jpg\nPhoto-3.jpg",
expectedOutput: "Photo-1.jpg\nPhoto-2.jpg\nPhoto-3.jpg\nPhoto-4.jpg\n", expectedOutput: "Photo-1.jpg\nPhoto-2.jpg\nPhoto-3.jpg\nPhoto-4.jpg",
recipeConfig: [ recipeConfig: [
{ {
"op": "Sort", "op": "Sort",