From c7f13ff67f4fd9c1dfb6b7ebeb6cd258403495a8 Mon Sep 17 00:00:00 2001 From: George J Date: Sat, 5 May 2018 00:43:42 +0100 Subject: [PATCH 01/78] Added 'More Info' links to the descriptions of many operations for #265 --- src/core/Operation.js | 2 + src/core/config/OperationConfig.js | 99 +++++++++++++++++++++++++++++- src/web/HTMLOperation.js | 9 ++- 3 files changed, 108 insertions(+), 2 deletions(-) diff --git a/src/core/Operation.js b/src/core/Operation.js index d4ee21d3..b2e9e1df 100755 --- a/src/core/Operation.js +++ b/src/core/Operation.js @@ -18,6 +18,7 @@ const Operation = function(operationName) { this.name = operationName; this.module = ""; this.description = ""; + this.infoURL = null; this.inputType = -1; this.outputType = -1; this.run = null; @@ -42,6 +43,7 @@ const Operation = function(operationName) { Operation.prototype._parseConfig = function(operationConfig) { this.module = operationConfig.module; this.description = operationConfig.description; + this.infoURL = operationConfig.infoURL; this.inputType = Dish.typeEnum(operationConfig.inputType); this.outputType = Dish.typeEnum(operationConfig.outputType); this.highlight = operationConfig.highlight; diff --git a/src/core/config/OperationConfig.js b/src/core/config/OperationConfig.js index 500a8803..30128d41 100644 --- a/src/core/config/OperationConfig.js +++ b/src/core/config/OperationConfig.js @@ -226,6 +226,7 @@ const OperationConfig = { "From Base64": { module: "Default", description: "Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

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

e.g. aGVsbG8= becomes hello", + infoURL: "https://wikipedia.org/wiki/Base64", highlight: "func", highlightReverse: "func", inputType: "string", @@ -246,6 +247,7 @@ const OperationConfig = { "To Base64": { module: "Default", description: "Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

This operation encodes data in an ASCII Base64 string.

e.g. hello becomes aGVsbG8=", + infoURL: "https://wikipedia.org/wiki/Base64", highlight: "func", highlightReverse: "func", inputType: "ArrayBuffer", @@ -261,6 +263,7 @@ const OperationConfig = { "From Base58": { module: "Default", description: "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It differs from Base64 by removing easily misread characters (i.e. l, I, 0 and O) to improve human readability.

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

e.g. StV1DL6CwTryKyV becomes hello world

Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc).", + infoURL: "https://wikipedia.org/wiki/Base58", inputType: "string", outputType: "byteArray", args: [ @@ -279,6 +282,7 @@ const OperationConfig = { "To Base58": { module: "Default", description: "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It differs from Base64 by removing easily misread characters (i.e. l, I, 0 and O) to improve human readability.

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

e.g. hello world becomes StV1DL6CwTryKyV

Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc).", + infoURL: "https://wikipedia.org/wiki/Base58", inputType: "byteArray", outputType: "string", args: [ @@ -292,6 +296,7 @@ const OperationConfig = { "From Base32": { module: "Default", description: "Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7.", + infoURL: "https://wikipedia.org/wiki/Base32", inputType: "string", outputType: "byteArray", args: [ @@ -310,6 +315,7 @@ const OperationConfig = { "To Base32": { module: "Default", description: "Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7.", + infoURL: "https://wikipedia.org/wiki/Base32", inputType: "byteArray", outputType: "string", args: [ @@ -341,6 +347,7 @@ const OperationConfig = { "Disassemble x86": { module: "Shellcode", description: "Disassembly is the process of translating machine language into assembly language.

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

Input should be in hexadecimal.", + infoURL: "https://wikipedia.org/wiki/X86", inputType: "string", outputType: "string", args: [ @@ -379,6 +386,7 @@ const OperationConfig = { "XOR": { module: "Default", description: "XOR the input with the given key.
e.g. fe023da5

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

Scheme:", + infoURL: "https://wikipedia.org/wiki/XOR", highlight: true, highlightReverse: true, inputType: "byteArray", @@ -604,6 +612,7 @@ const OperationConfig = { "Standard Deviation": { module: "Default", description: "Computes the standard deviation of a number list. If an item in the string is not a number it is excluded from the list.

e.g. 0x0a 8 .5 becomes 4.089281382128433", + infoURL: "https://wikipedia.org/wiki/Standard_deviation", inputType: "string", outputType: "BigNumber", args: [ @@ -645,6 +654,7 @@ const OperationConfig = { "From Hex": { module: "Default", description: "Converts a hexadecimal byte string back into its raw value.

e.g. ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a becomes the UTF-8 encoded string Γειά σου", + infoURL: "https://wikipedia.org/wiki/Hexadecimal", highlight: "func", highlightReverse: "func", inputType: "string", @@ -660,6 +670,7 @@ const OperationConfig = { "To Hex": { module: "Default", description: "Converts the input string to hexadecimal bytes separated by the specified delimiter.

e.g. The UTF-8 encoded string Γειά σου becomes ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a", + infoURL: "https://wikipedia.org/wiki/Hexadecimal", highlight: "func", highlightReverse: "func", inputType: "ArrayBuffer", @@ -675,6 +686,7 @@ const OperationConfig = { "From Octal": { module: "Default", description: "Converts an octal byte string back into its raw value.

e.g. 316 223 316 265 316 271 316 254 40 317 203 316 277 317 205 becomes the UTF-8 encoded string Γειά σου", + infoURL: "https://wikipedia.org/wiki/Octal", highlight: false, highlightReverse: false, inputType: "string", @@ -690,6 +702,7 @@ const OperationConfig = { "To Octal": { module: "Default", description: "Converts the input string to octal bytes separated by the specified delimiter.

e.g. The UTF-8 encoded string Γειά σου becomes 316 223 316 265 316 271 316 254 40 317 203 316 277 317 205", + infoURL: "https://wikipedia.org/wiki/Octal", highlight: false, highlightReverse: false, inputType: "byteArray", @@ -746,6 +759,7 @@ const OperationConfig = { "From Binary": { module: "Default", description: "Converts a binary string back into its raw form.

e.g. 01001000 01101001 becomes Hi", + infoURL: "https://wikipedia.org/wiki/Binary_code", highlight: "func", highlightReverse: "func", inputType: "string", @@ -761,6 +775,7 @@ const OperationConfig = { "To Binary": { module: "Default", description: "Displays the input data as a binary string.

e.g. Hi becomes 01001000 01101001", + infoURL: "https://wikipedia.org/wiki/Binary_code", highlight: "func", highlightReverse: "func", inputType: "byteArray", @@ -802,6 +817,7 @@ const OperationConfig = { "From Hexdump": { module: "Default", description: "Attempts to convert a hexdump back into raw data. This operation supports many different hexdump variations, but probably not all. Make sure you verify that the data it gives you is correct before continuing analysis.", + infoURL: "https://wikipedia.org/wiki/Hex_dump", highlight: "func", highlightReverse: "func", inputType: "string", @@ -811,6 +827,7 @@ const OperationConfig = { "To Hexdump": { module: "Default", description: "Creates a hexdump of the input data, displaying both the hexadecimal values of each byte and an ASCII representation alongside.", + infoURL: "https://wikipedia.org/wiki/Hex_dump", highlight: "func", highlightReverse: "func", inputType: "ArrayBuffer", @@ -836,6 +853,7 @@ const OperationConfig = { "From Base": { module: "Default", description: "Converts a number to decimal from a given numerical base.", + infoURL: "https://wikipedia.org/wiki/Radix", inputType: "string", outputType: "BigNumber", args: [ @@ -849,6 +867,7 @@ const OperationConfig = { "To Base": { module: "Default", description: "Converts a decimal number to a given numerical base.", + infoURL: "https://wikipedia.org/wiki/Radix", inputType: "BigNumber", outputType: "string", args: [ @@ -925,6 +944,7 @@ const OperationConfig = { "Parse URI": { 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.", + infoURL: "https://wikipedia.org/wiki/Uniform_Resource_Identifier", inputType: "string", outputType: "string", args: [] @@ -973,6 +993,7 @@ const OperationConfig = { "From Quoted Printable": { module: "Default", description: "Converts QP-encoded text back to standard text.", + infoURL: "https://wikipedia.org/wiki/Quoted-printable", inputType: "string", outputType: "byteArray", args: [] @@ -980,6 +1001,7 @@ const OperationConfig = { "To Quoted Printable": { module: "Default", description: "Quoted-Printable, or QP encoding, is an encoding using printable ASCII characters (alphanumeric and the equals sign '=') to transmit 8-bit data over a 7-bit data path or, generally, over a medium which is not 8-bit clean. It is defined as a MIME content transfer encoding for use in e-mail.

QP works by using the equals sign '=' as an escape character. It also limits line length to 76, as some software has limits on line length.", + infoURL: "https://wikipedia.org/wiki/Quoted-printable", inputType: "byteArray", outputType: "string", args: [] @@ -987,6 +1009,7 @@ const OperationConfig = { "From Punycode": { module: "Encodings", description: "Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

e.g. mnchen-3ya decodes to münchen", + infoURL: "https://wikipedia.org/wiki/Punycode", inputType: "string", outputType: "string", args: [ @@ -1000,6 +1023,7 @@ const OperationConfig = { "To Punycode": { module: "Encodings", description: "Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

e.g. münchen encodes to mnchen-3ya", + infoURL: "https://wikipedia.org/wiki/Punycode", inputType: "string", outputType: "string", args: [ @@ -1102,6 +1126,7 @@ const OperationConfig = { "Parse IPv6 address": { module: "JSBN", description: "Displays the longhand and shorthand versions of a valid IPv6 address.

Recognises all reserved ranges and parses encapsulated or tunnelled addresses including Teredo and 6to4.", + infoURL: "https://wikipedia.org/wiki/IPv6_address", inputType: "string", outputType: "string", args: [] @@ -1162,6 +1187,7 @@ const OperationConfig = { "AES Decrypt": { module: "Ciphers", description: "Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.

Key: The following algorithms will be used based on the size of the key:

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

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

GCM Tag: This field is ignored unless 'GCM' mode is used.", + infoURL: "https://wikipedia.org/wiki/Advanced_Encryption_Standard", inputType: "string", outputType: "string", args: [ @@ -1203,6 +1229,7 @@ const OperationConfig = { "AES Encrypt": { module: "Ciphers", description: "Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.

Key: The following algorithms will be used based on the size of the key:You can generate a password-based key using one of the KDF operations.

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

Padding: In CBC and ECB mode, PKCS#7 padding will be used.", + infoURL: "https://wikipedia.org/wiki/Advanced_Encryption_Standard", inputType: "string", outputType: "string", args: [ @@ -1238,6 +1265,7 @@ const OperationConfig = { "DES Decrypt": { module: "Ciphers", description: "DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.

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

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

Padding: In CBC and ECB mode, PKCS#7 padding will be used.", + infoURL: "https://wikipedia.org/wiki/Data_Encryption_Standard", inputType: "string", outputType: "string", args: [ @@ -1273,6 +1301,7 @@ const OperationConfig = { "DES Encrypt": { module: "Ciphers", description: "DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.

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

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

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

Padding: In CBC and ECB mode, PKCS#7 padding will be used.", + infoURL: "https://wikipedia.org/wiki/Data_Encryption_Standard", inputType: "string", outputType: "string", args: [ @@ -1308,6 +1337,7 @@ const OperationConfig = { "Triple DES Decrypt": { module: "Ciphers", description: "Triple DES applies DES three times to each block to increase key size.

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

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

Padding: In CBC and ECB mode, PKCS#7 padding will be used.", + infoURL: "https://wikipedia.org/wiki/Triple_DES", inputType: "string", outputType: "string", args: [ @@ -1343,6 +1373,7 @@ const OperationConfig = { "Triple DES Encrypt": { module: "Ciphers", description: "Triple DES applies DES three times to each block to increase key size.

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

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

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

Padding: In CBC and ECB mode, PKCS#7 padding will be used.", + infoURL: "https://wikipedia.org/wiki/Triple_DES", inputType: "string", outputType: "string", args: [ @@ -1378,6 +1409,7 @@ const OperationConfig = { "Blowfish Decrypt": { module: "Ciphers", description: "Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.", + infoURL: "https://wikipedia.org/wiki/Blowfish_(cipher)", inputType: "string", outputType: "string", args: [ @@ -1413,6 +1445,7 @@ const OperationConfig = { "Blowfish Encrypt": { module: "Ciphers", description: "Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.", + infoURL: "https://wikipedia.org/wiki/Blowfish_(cipher)", inputType: "string", outputType: "string", args: [ @@ -1448,6 +1481,7 @@ const OperationConfig = { "RC4": { module: "Ciphers", description: "RC4 (also known as ARC4) is a widely-used stream cipher designed by Ron Rivest. It is used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security.", + infoURL: "https://wikipedia.org/wiki/RC4", highlight: true, highlightReverse: true, inputType: "string", @@ -1474,6 +1508,7 @@ const OperationConfig = { "RC4 Drop": { module: "Ciphers", description: "It was discovered that the first few bytes of the RC4 keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-drop.", + infoURL: "https://wikipedia.org/wiki/RC4", highlight: true, highlightReverse: true, inputType: "string", @@ -1505,6 +1540,7 @@ const OperationConfig = { "RC2 Decrypt": { module: "Ciphers", description: "RC2 (also known as ARC2) is a symmetric-key block cipher designed by Ron Rivest in 1987. 'RC' stands for 'Rivest Cipher'.

Key: RC2 uses a variable size key.

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

Padding: In both CBC and ECB mode, PKCS#7 padding will be used.", + infoURL: "https://wikipedia.org/wiki/RC2", inputType: "string", outputType: "string", args: [ @@ -1535,6 +1571,7 @@ const OperationConfig = { "RC2 Encrypt": { module: "Ciphers", description: "RC2 (also known as ARC2) is a symmetric-key block cipher designed by Ron Rivest in 1987. 'RC' stands for 'Rivest Cipher'.

Key: RC2 uses a variable size key.

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

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

Padding: In both CBC and ECB mode, PKCS#7 padding will be used.", + infoURL: "https://wikipedia.org/wiki/RC2", inputType: "string", outputType: "string", args: [ @@ -1565,6 +1602,7 @@ const OperationConfig = { "Pseudo-Random Number Generator": { module: "Ciphers", description: "A cryptographically-secure pseudo-random number generator (PRNG).

This operation uses the browser's built-in crypto.getRandomValues() method if available. If this cannot be found, it falls back to a Fortuna-based PRNG algorithm.", + infoURL: "https://wikipedia.org/wiki/Pseudorandom_number_generator", inputType: "string", outputType: "string", args: [ @@ -1583,6 +1621,7 @@ const OperationConfig = { "Derive PBKDF2 key": { module: "Ciphers", description: "PBKDF2 is a password-based key derivation function. It is part of RSA Laboratories' Public-Key Cryptography Standards (PKCS) series, specifically PKCS #5 v2.0, also published as Internet Engineering Task Force's RFC 2898.

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

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

If you leave the salt argument empty, a random salt will be generated.", + infoURL: "https://wikipedia.org/wiki/PBKDF2", inputType: "string", outputType: "string", args: [ @@ -1653,6 +1692,7 @@ const OperationConfig = { "Vigenère Encode": { module: "Ciphers", description: "The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.", + infoURL: "https://wikipedia.org/wiki/Vigenère_cipher", highlight: true, highlightReverse: true, inputType: "string", @@ -1668,6 +1708,7 @@ const OperationConfig = { "Vigenère Decode": { module: "Ciphers", description: "The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.", + infoURL: "https://wikipedia.org/wiki/Vigenère_cipher", highlight: true, highlightReverse: true, inputType: "string", @@ -1683,6 +1724,7 @@ const OperationConfig = { "Bifid Cipher Encode": { module: "Ciphers", description: "The Bifid cipher is a cipher which uses a Polybius square in conjunction with transposition, which can be fairly difficult to decipher without knowing the alphabet keyword.", + infoURL: "https://wikipedia.org/wiki/Bifid_cipher", highlight: true, highlightReverse: true, inputType: "string", @@ -1698,6 +1740,7 @@ const OperationConfig = { "Bifid Cipher Decode": { module: "Ciphers", description: "The Bifid cipher is a cipher which uses a Polybius square in conjunction with transposition, which can be fairly difficult to decipher without knowing the alphabet keyword.", + infoURL: "https://wikipedia.org/wiki/Bifid_cipher", highlight: true, highlightReverse: true, inputType: "string", @@ -1713,6 +1756,7 @@ const OperationConfig = { "Affine Cipher Encode": { module: "Ciphers", description: "The Affine cipher is a type of monoalphabetic substitution cipher, wherein each letter in an alphabet is mapped to its numeric equivalent, encrypted using simple mathematical function, (ax + b) % 26, and converted back to a letter.", + infoURL: "https://wikipedia.org/wiki/Affine_cipher", highlight: true, highlightReverse: true, inputType: "string", @@ -1733,6 +1777,7 @@ const OperationConfig = { "Affine Cipher Decode": { module: "Ciphers", description: "The Affine cipher is a type of monoalphabetic substitution cipher. To decrypt, each letter in an alphabet is mapped to its numeric equivalent, decrypted by a mathematical function, and converted back to a letter.", + infoURL: "https://wikipedia.org/wiki/Affine_cipher", highlight: true, highlightReverse: true, inputType: "string", @@ -1753,6 +1798,7 @@ const OperationConfig = { "Atbash Cipher": { module: "Ciphers", description: "Atbash is a mono-alphabetic substitution cipher originally used to encode the Hebrew alphabet. It has been modified here for use with the Latin alphabet.", + infoURL: "https://wikipedia.org/wiki/Atbash", highlight: true, highlightReverse: true, inputType: "string", @@ -1802,6 +1848,7 @@ const OperationConfig = { "ROT13": { module: "Default", description: "A simple caesar substitution cipher which rotates alphabet characters by the specified amount (default 13).", + infoURL: "https://wikipedia.org/wiki/ROT13", highlight: true, highlightReverse: true, inputType: "byteArray", @@ -1827,6 +1874,7 @@ const OperationConfig = { "ROT47": { module: "Default", description: "A slightly more complex variation of a caesar cipher, which includes ASCII characters from 33 '!' to 126 '~'. Default rotation: 47.", + infoURL: "https://wikipedia.org/wiki/ROT13#Variants", highlight: true, highlightReverse: true, inputType: "byteArray", @@ -1849,6 +1897,7 @@ const OperationConfig = { "Parse User Agent": { module: "HTTP", description: "Attempts to identify and categorise information contained in a user-agent string.", + infoURL: "https://wikipedia.org/wiki/User_agent", inputType: "string", outputType: "string", args: [] @@ -1894,6 +1943,7 @@ const OperationConfig = { "Encode NetBIOS Name": { module: "Default", description: "NetBIOS names as seen across the client interface to NetBIOS are exactly 16 bytes long. Within the NetBIOS-over-TCP protocols, a longer representation is used.

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

This operation carries out the first level of encoding. See RFC 1001 for full details.", + infoURL: "https://wikipedia.org/wiki/NetBIOS", inputType: "byteArray", outputType: "byteArray", args: [ @@ -1907,6 +1957,7 @@ const OperationConfig = { "Decode NetBIOS Name": { module: "Default", description: "NetBIOS names as seen across the client interface to NetBIOS are exactly 16 bytes long. Within the NetBIOS-over-TCP protocols, a longer representation is used.

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

This operation decodes the first level of encoding. See RFC 1001 for full details.", + infoURL: "https://wikipedia.org/wiki/NetBIOS", inputType: "byteArray", outputType: "byteArray", args: [ @@ -2368,6 +2419,7 @@ const OperationConfig = { "Regular expression": { module: "Regex", description: "Define your own regular expression (regex) to search the input data with, optionally choosing from a list of pre-defined patterns.

Supports extended regex syntax including the 'dot matches all' flag, named capture groups, full unicode coverage (including \\p{} categories and scripts as well as astral codes) and recursive matching.", + infoURL: "https://wikipedia.org/wiki/Regular_expression", inputType: "string", outputType: "html", args: [ @@ -2422,6 +2474,7 @@ const OperationConfig = { "XPath expression": { module: "Code", description: "Extract information from an XML document with an XPath query", + infoURL: "https://wikipedia.org/wiki/XPath", inputType: "string", outputType: "string", args: [ @@ -2476,6 +2529,7 @@ const OperationConfig = { "From UNIX Timestamp": { module: "Default", description: "Converts a UNIX timestamp to a datetime string.

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

A UNIX timestamp is a 32-bit value representing the number of seconds since January 1, 1970 UTC (the UNIX epoch).", + infoURL: "https://wikipedia.org/wiki/Unix_time", inputType: "number", outputType: "string", args: [ @@ -2489,6 +2543,7 @@ const OperationConfig = { "To UNIX Timestamp": { module: "Default", description: "Parses a datetime string in UTC and returns the corresponding UNIX timestamp.

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

A UNIX timestamp is a 32-bit value representing the number of seconds since January 1, 1970 UTC (the UNIX epoch).", + infoURL: "https://wikipedia.org/wiki/Unix_time", inputType: "string", outputType: "string", args: [ @@ -3073,6 +3128,7 @@ const OperationConfig = { "MD2": { module: "Hashing", description: "The MD2 (Message-Digest 2) algorithm is a cryptographic hash function developed by Ronald Rivest in 1989. The algorithm is optimized for 8-bit computers.

Although MD2 is no longer considered secure, even as of 2014, it remains in use in public key infrastructures as part of certificates generated with MD2 and RSA.", + infoURL: "https://wikipedia.org/wiki/MD2_(cryptography)", inputType: "ArrayBuffer", outputType: "string", args: [] @@ -3080,6 +3136,7 @@ const OperationConfig = { "MD4": { module: "Hashing", description: "The MD4 (Message-Digest 4) algorithm is a cryptographic hash function developed by Ronald Rivest in 1990. The digest length is 128 bits. The algorithm has influenced later designs, such as the MD5, SHA-1 and RIPEMD algorithms.

The security of MD4 has been severely compromised.", + infoURL: "https://wikipedia.org/wiki/MD4", inputType: "ArrayBuffer", outputType: "string", args: [] @@ -3087,13 +3144,15 @@ const OperationConfig = { "MD5": { module: "Hashing", description: "MD5 (Message-Digest 5) is a widely used hash function. It has been used in a variety of security applications and is also commonly used to check the integrity of files.

However, MD5 is not collision resistant and it isn't suitable for applications like SSL/TLS certificates or digital signatures that rely on this property.", - inputType: "ArrayBuffer", + infoURL: "https://wikipedia.org/wiki/MD5", + nputType: "ArrayBuffer", outputType: "string", args: [] }, "MD6": { module: "Hashing", description: "The MD6 (Message-Digest 6) algorithm is a cryptographic hash function. It uses a Merkle tree-like structure to allow for immense parallel computation of hashes for very long inputs.", + infoURL: "https://wikipedia.org/wiki/MD6", inputType: "string", outputType: "string", args: [ @@ -3124,6 +3183,7 @@ const OperationConfig = { "SHA1": { module: "Hashing", description: "The SHA (Secure Hash Algorithm) hash functions were designed by the NSA. SHA-1 is the most established of the existing SHA hash functions and it is used in a variety of security applications and protocols.

However, SHA-1's collision resistance has been weakening as new attacks are discovered or improved.", + infoURL: "https://wikipedia.org/wiki/SHA-1", inputType: "ArrayBuffer", outputType: "string", args: [] @@ -3131,6 +3191,7 @@ const OperationConfig = { "SHA2": { module: "Hashing", description: "The SHA-2 (Secure Hash Algorithm 2) hash functions were designed by the NSA. SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA224, SHA256, SHA384, SHA512.

", + infoURL: "https://wikipedia.org/wiki/SHA-2", inputType: "ArrayBuffer", outputType: "string", args: [ @@ -3144,6 +3205,7 @@ const OperationConfig = { "SHA3": { module: "Hashing", description: "The SHA-3 (Secure Hash Algorithm 3) hash functions were released by NIST on August 5, 2015. Although part of the same series of standards, SHA-3 is internally quite different from the MD5-like structure of SHA-1 and SHA-2.

SHA-3 is a subset of the broader cryptographic primitive family Keccak designed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche, building upon RadioGatún.", + infoURL: "https://wikipedia.org/wiki/SHA-3", inputType: "ArrayBuffer", outputType: "string", args: [ @@ -3189,6 +3251,7 @@ const OperationConfig = { "RIPEMD": { module: "Hashing", description: "RIPEMD (RACE Integrity Primitives Evaluation Message Digest) is a family of cryptographic hash functions developed in Leuven, Belgium, by Hans Dobbertin, Antoon Bosselaers and Bart Preneel at the COSIC research group at the Katholieke Universiteit Leuven, and first published in 1996.

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

", + infoURL: "https://wikipedia.org/wiki/RIPEMD", inputType: "ArrayBuffer", outputType: "string", args: [ @@ -3202,6 +3265,7 @@ const OperationConfig = { "HAS-160": { module: "Hashing", description: "HAS-160 is a cryptographic hash function designed for use with the Korean KCDSA digital signature algorithm. It is derived from SHA-1, with assorted changes intended to increase its security. It produces a 160-bit output.

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

The message digest algorithm consists of 80 rounds.", + infoURL: "https://wikipedia.org/wiki/HAS-160", inputType: "ArrayBuffer", outputType: "string", args: [] @@ -3209,6 +3273,7 @@ const OperationConfig = { "Whirlpool": { module: "Hashing", description: "Whirlpool is a cryptographic hash function designed by Vincent Rijmen (co-creator of AES) and Paulo S. L. M. Barreto, who first described it in 2000.

Several variants exist:", + infoURL: "https://wikipedia.org/wiki/Whirlpool_(cryptography)", inputType: "ArrayBuffer", outputType: "string", args: [ @@ -3222,6 +3287,7 @@ const OperationConfig = { "Snefru": { module: "Hashing", description: "Snefru is a cryptographic hash function invented by Ralph Merkle in 1990 while working at Xerox PARC. The function supports 128-bit and 256-bit output. It was named after the Egyptian Pharaoh Sneferu, continuing the tradition of the Khufu and Khafre block ciphers.

The original design of Snefru was shown to be insecure by Eli Biham and Adi Shamir who were able to use differential cryptanalysis to find hash collisions. The design was then modified by increasing the number of iterations of the main pass of the algorithm from two to eight.", + infoURL: "https://wikipedia.org/wiki/Snefru", inputType: "ArrayBuffer", outputType: "string", args: [ @@ -3280,6 +3346,7 @@ const OperationConfig = { "HMAC": { module: "Hashing", description: "Keyed-Hash Message Authentication Codes (HMAC) are a mechanism for message authentication using cryptographic hash functions.", + infoURL: "https://wikipedia.org/wiki/HMAC", inputType: "ArrayBuffer", outputType: "string", args: [ @@ -3305,6 +3372,7 @@ const OperationConfig = { "Fletcher-16 Checksum": { module: "Hashing", description: "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.", + infoURL: "https://wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-16", inputType: "byteArray", outputType: "string", args: [] @@ -3312,6 +3380,7 @@ const OperationConfig = { "Fletcher-32 Checksum": { module: "Hashing", description: "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.", + infoURL: "https://wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-32", inputType: "byteArray", outputType: "string", args: [] @@ -3319,6 +3388,7 @@ const OperationConfig = { "Fletcher-64 Checksum": { module: "Hashing", description: "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.", + infoURL: "https://wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-64", inputType: "byteArray", outputType: "string", args: [] @@ -3326,6 +3396,7 @@ const OperationConfig = { "Adler-32 Checksum": { module: "Hashing", description: "Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995, and is a modification of the Fletcher checksum. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter).

Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32.", + infoURL: "https://wikipedia.org/wiki/Adler-32", inputType: "byteArray", outputType: "string", args: [] @@ -3354,6 +3425,7 @@ const OperationConfig = { "Entropy": { module: "Default", description: "Calculates the Shannon entropy of the input data which gives an idea of its randomness. 8 is the maximum.", + infoURL: "https://wikipedia.org/wiki/Entropy_(information_theory)", inputType: "byteArray", outputType: "html", args: [ @@ -3380,6 +3452,7 @@ const OperationConfig = { "Chi Square": { module: "Default", description: "Calculates the Chi Square distribution of values.", + infoURL: "https://wikipedia.org/wiki/Chi-squared_distribution", inputType: "ArrayBuffer", outputType: "number", args: [] @@ -3394,6 +3467,7 @@ const OperationConfig = { "Parse X.509 certificate": { module: "PublicKey", description: "X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.

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

Tags: X509, server hello, handshake", + infoURL: "https://wikipedia.org/wiki/X.509", inputType: "string", outputType: "string", args: [ @@ -3441,6 +3515,7 @@ const OperationConfig = { "Parse ASN.1 hex string": { module: "PublicKey", description: "Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.

This operation parses arbitrary ASN.1 data and presents the resulting tree.", + infoURL: "https://wikipedia.org/wiki/Abstract_Syntax_Notation_One", inputType: "string", outputType: "string", args: [ @@ -3525,6 +3600,7 @@ const OperationConfig = { "Parse UNIX file permissions": { module: "Default", description: "Given a UNIX/Linux file permission string in octal or textual format, this operation explains which permissions are granted to which user groups.

Input should be in either octal (e.g. 755) or textual (e.g. drwxr-xr-x) format.", + infoURL: "https://wikipedia.org/wiki/File_system_permissions#Traditional_Unix_permissions", inputType: "string", outputType: "string", args: [] @@ -3532,6 +3608,7 @@ const OperationConfig = { "Swap endianness": { module: "Default", description: "Switches the data from big-endian to little-endian or vice-versa. Data can be read in as hexadecimal or raw bytes. It will be returned in the same format as it is entered.", + infoURL: "https://wikipedia.org/wiki/Endianness", highlight: true, highlightReverse: true, inputType: "string", @@ -3593,6 +3670,7 @@ const OperationConfig = { "Generate UUID": { module: "Default", description: "Generates an RFC 4122 version 4 compliant Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).

A version 4 UUID relies on random numbers, in this case generated using window.crypto if available and falling back to Math.random if not.", + infoURL: "https://wikipedia.org/wiki/Universally_unique_identifier", inputType: "string", outputType: "string", args: [] @@ -3600,6 +3678,7 @@ const OperationConfig = { "Substitute": { module: "Ciphers", description: "A substitution cipher allowing you to specify bytes to replace with other byte values. This can be used to create Caesar ciphers but is more powerful as any byte value can be substituted, not just letters, and the substitution values need not be in order.

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

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

Byte ranges can be specified using a hyphen. For example, the sequence 0123456789 can be written as 0-9.", + infoURL: "https://wikipedia.org/wiki/Substitution_cipher", inputType: "string", outputType: "string", args: [ @@ -3658,6 +3737,7 @@ const OperationConfig = { "To Morse Code": { module: "Default", description: "Translates alphanumeric characters into International Morse Code.

Ignores non-Morse characters.

e.g. SOS becomes ... --- ...", + infoURL: "https://wikipedia.org/wiki/Morse_code", inputType: "string", outputType: "string", args: [ @@ -3681,6 +3761,7 @@ const OperationConfig = { "From Morse Code": { module: "Default", description: "Translates Morse Code into (upper case) alphanumeric characters.", + infoURL: "https://wikipedia.org/wiki/Morse_code", inputType: "string", outputType: "string", args: [ @@ -3780,6 +3861,7 @@ const OperationConfig = { "

", "'Attempt to be context aware' will make the operation attempt to nicely transform variable and function names.", ].join("\n"), + infoURL: "https://wikipedia.org/wiki/Snake_case", inputType: "string", outputType: "string", args: [ @@ -3801,6 +3883,7 @@ const OperationConfig = { "

", "'Attempt to be context aware' will make the operation attempt to nicely transform variable and function names.", ].join("\n"), + infoURL: "https://wikipedia.org/wiki/Camel_case", inputType: "string", outputType: "string", args: [ @@ -3841,6 +3924,7 @@ const OperationConfig = { "

", "EXIF data from photos usually contains information about the image file itself as well as the device used to create it.", ].join("\n"), + infoURL: "https://wikipedia.org/wiki/Exif", inputType: "ArrayBuffer", outputType: "string", args: [], @@ -3865,6 +3949,7 @@ const OperationConfig = { "

", "EXIF data embedded in photos usually contains information about the image file itself as well as the device used to create it.", ].join("\n"), + infoURL: "https://wikipedia.org/wiki/Exif", inputType: "byteArray", outputType: "byteArray", args: [] @@ -3914,6 +3999,7 @@ const OperationConfig = { "From BCD": { module: "Default", description: "Binary-Coded Decimal (BCD) is a class of binary encodings of decimal numbers where each decimal digit is represented by a fixed number of bits, usually four or eight. Special bit patterns are sometimes used for a sign.", + infoURL: "https://wikipedia.org/wiki/Binary-coded_decimal", inputType: "string", outputType: "BigNumber", args: [ @@ -3943,6 +4029,7 @@ const OperationConfig = { "To BCD": { module: "Default", description: "Binary-Coded Decimal (BCD) is a class of binary encodings of decimal numbers where each decimal digit is represented by a fixed number of bits, usually four or eight. Special bit patterns are sometimes used for a sign", + infoURL: "https://wikipedia.org/wiki/Binary-coded_decimal", inputType: "BigNumber", outputType: "string", args: [ @@ -4007,6 +4094,7 @@ const OperationConfig = { "Generate TOTP": { module: "Default", description: "The Time-based One-Time Password algorithm (TOTP) is an algorithm that computes a one-time password from a shared secret key and the current time. It has been adopted as Internet Engineering Task Force standard RFC 6238, is the cornerstone of Initiative For Open Authentication (OATH), and is used in a number of two-factor authentication systems. A TOTP is an HOTP where the counter is the current time.

Enter the secret as the input or leave it blank for a random secret to be generated. T0 and T1 are in seconds.", + infoURL: "https://wikipedia.org/wiki/Time-based_One-time_Password_algorithm", inputType: "byteArray", outputType: "string", args: [ @@ -4040,6 +4128,7 @@ const OperationConfig = { "Generate HOTP": { module: "Default", description: "The HMAC-based One-Time Password algorithm (HOTP) is an algorithm that computes a one-time password from a shared secret key and an incrementing counter. It has been adopted as Internet Engineering Task Force standard RFC 4226, is the cornerstone of Initiative For Open Authentication (OATH), and is used in a number of two-factor authentication systems.

Enter the secret as the input or leave it blank for a random secret to be generated.", + infoURL: "https://wikipedia.org/wiki/HMAC-based_One-time_Password_algorithm", inputType: "byteArray", outputType: "string", args: [ @@ -4081,6 +4170,7 @@ const OperationConfig = { "Hamming Distance": { module: "Default", description: "In information theory, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of substitutions required to change one string into the other, or the minimum number of errors that could have transformed one string into the other. In a more general context, the Hamming distance is one of several string metrics for measuring the edit distance between two sequences.", + infoURL: "https://wikipedia.org/wiki/Hamming_distance", inputType: "string", outputType: "string", args: [ @@ -4178,6 +4268,7 @@ const OperationConfig = { "BSON serialise": { module: "BSON", description: "BSON is a computer data interchange format used mainly as a data storage and network transfer format in the MongoDB database. It is a binary form for representing simple data structures, associative arrays (called objects or documents in MongoDB), and various data types of specific interest to MongoDB. The name 'BSON' is based on the term JSON and stands for 'Binary JSON'.

Input data should be valid JSON.", + infoURL: "https://wikipedia.org/wiki/BSON", inputType: "string", outputType: "ArrayBuffer", args: [] @@ -4185,6 +4276,7 @@ const OperationConfig = { "BSON deserialise": { module: "BSON", description: "BSON is a computer data interchange format used mainly as a data storage and network transfer format in the MongoDB database. It is a binary form for representing simple data structures, associative arrays (called objects or documents in MongoDB), and various data types of specific interest to MongoDB. The name 'BSON' is based on the term JSON and stands for 'Binary JSON'.

Input data should be in a raw bytes format.", + infoURL: "https://wikipedia.org/wiki/BSON", inputType: "ArrayBuffer", outputType: "string", args: [] @@ -4192,6 +4284,7 @@ const OperationConfig = { "Generate PGP Key Pair": { module: "PGP", description: "Generates a new public/private PGP key pair. Supports RSA and Eliptic Curve (EC) keys.", + infoURL: "https://wikipedia.org/wiki/Pretty_Good_Privacy", inputType: "string", outputType: "string", args: [ @@ -4228,6 +4321,7 @@ const OperationConfig = { "

", "This function uses the Keybase implementation of PGP.", ].join("\n"), + infoURL: "https://wikipedia.org/wiki/Pretty_Good_Privacy", inputType: "string", outputType: "string", args: [ @@ -4250,6 +4344,7 @@ const OperationConfig = { "

", "This function uses the Keybase implementation of PGP.", ].join("\n"), + infoURL: "https://wikipedia.org/wiki/Pretty_Good_Privacy", inputType: "string", outputType: "string", args: [ @@ -4279,6 +4374,7 @@ const OperationConfig = { "

", "This function uses the Keybase implementation of PGP.", ].join("\n"), + infoURL: "https://wikipedia.org/wiki/Pretty_Good_Privacy", inputType: "string", outputType: "string", args: [ @@ -4313,6 +4409,7 @@ const OperationConfig = { "

", "This function uses the Keybase implementation of PGP.", ].join("\n"), + infoURL: "https://wikipedia.org/wiki/Pretty_Good_Privacy", inputType: "string", outputType: "string", args: [ diff --git a/src/web/HTMLOperation.js b/src/web/HTMLOperation.js index e709066f..77d7c898 100755 --- a/src/web/HTMLOperation.js +++ b/src/web/HTMLOperation.js @@ -20,6 +20,7 @@ const HTMLOperation = function(name, config, app, manager) { this.name = name; this.description = config.description; + this.infoURL = config.infoURL; this.manualBake = config.manualBake || false; this.config = config; this.ingList = []; @@ -50,8 +51,14 @@ HTMLOperation.prototype.toStubHtml = function(removeIcon) { let html = "
  • More Information"; + } + html += " data-container='body' data-toggle='popover' data-placement='auto right'\ - data-content=\"" + this.description + "\" data-html='true' data-trigger='hover'"; + data-content=\"" + popoverContent + "\" data-html='true' data-trigger='hover'"; } html += ">" + this.name; From 77a023840685b080d684c70acac9cb8a0182e304 Mon Sep 17 00:00:00 2001 From: George J Date: Sun, 13 May 2018 13:27:52 +0100 Subject: [PATCH 02/78] Fixes syntax error --- src/core/config/OperationConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/config/OperationConfig.js b/src/core/config/OperationConfig.js index 30128d41..68cfbf06 100644 --- a/src/core/config/OperationConfig.js +++ b/src/core/config/OperationConfig.js @@ -3145,7 +3145,7 @@ const OperationConfig = { module: "Hashing", description: "MD5 (Message-Digest 5) is a widely used hash function. It has been used in a variety of security applications and is also commonly used to check the integrity of files.

    However, MD5 is not collision resistant and it isn't suitable for applications like SSL/TLS certificates or digital signatures that rely on this property.", infoURL: "https://wikipedia.org/wiki/MD5", - nputType: "ArrayBuffer", + inputType: "ArrayBuffer", outputType: "string", args: [] }, From 53bf52c989639826d51edb11a14dd8d4c3e9430e Mon Sep 17 00:00:00 2001 From: sevzero Date: Thu, 24 May 2018 13:09:04 +0000 Subject: [PATCH 03/78] Added decoder for chunked HTTP encoding This decoder will join up a HTTP response sent using chunked transfer encoding, raised in issue #168. This is useful when attempting to extract files or gzipped responses sent using chunked transfer encoding, particularly when combined with the gunzip operation. --- src/core/config/Categories.json | 1 + src/core/config/scripts/portOperation.mjs | 7 ++++ src/core/operations/DechunkHTTP.mjs | 50 +++++++++++++++++++++++ src/core/operations/legacy/HTTP.js | 21 ++++++++++ 4 files changed, 79 insertions(+) create mode 100644 src/core/operations/DechunkHTTP.mjs diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index 9078e250..9bd2977f 100755 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -137,6 +137,7 @@ "ops": [ "HTTP request", "Strip HTTP headers", + "Dechunk HTTP response", "Parse User Agent", "Parse IP range", "Parse IPv6 address", diff --git a/src/core/config/scripts/portOperation.mjs b/src/core/config/scripts/portOperation.mjs index cac7b1eb..8ac322ec 100644 --- a/src/core/config/scripts/portOperation.mjs +++ b/src/core/config/scripts/portOperation.mjs @@ -2239,6 +2239,13 @@ const OP_CONFIG = { outputType: "string", args: [] }, + "Dechunk HTTP response": { + module: "HTTP", + description: "Parses a HTTP response transferred using transfer-encoding:chunked", + inputType: "string", + outputType: "string", + args: [] + }, "Parse User Agent": { module: "HTTP", description: "Attempts to identify and categorise information contained in a user-agent string.", diff --git a/src/core/operations/DechunkHTTP.mjs b/src/core/operations/DechunkHTTP.mjs new file mode 100644 index 00000000..1a428e3a --- /dev/null +++ b/src/core/operations/DechunkHTTP.mjs @@ -0,0 +1,50 @@ +/** + * @author sevzero [sevzero@protonmail.com] + * @copyright Crown Copyright 2016 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; + +/** + * Dechunk HTTP response operation + */ +class DechunkHTTP extends Operation { + + /** + * DechunkHTTP constructor + */ + constructor() { + super(); + + this.name = "Dechunk HTTP response"; + this.module = "Default"; + this.description = "Parses a HTTP response transferred using transfer-encoding:chunked"; + this.inputType = "string"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + var chunks = []; + var chunkSizeEnd = input.indexOf("\n") + 1; + var lineEndings = input.charAt(chunkSizeEnd - 2) == "\r" ? "\r\n" : "\n"; + var lineEndingsLength = lineEndings.length; + var chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); + while (!isNaN(chunkSize)) { + chunks.push(input.slice(chunkSizeEnd, chunkSize + chunkSizeEnd)); + input = input.slice(chunkSizeEnd + chunkSize + lineEndingsLength); + chunkSizeEnd = input.indexOf(lineEndings) + lineEndingsLength; + chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); + } + return chunks.join('') + input; + } + +} + +export default DechunkHTTP; diff --git a/src/core/operations/legacy/HTTP.js b/src/core/operations/legacy/HTTP.js index dcb1cc50..b41e118c 100755 --- a/src/core/operations/legacy/HTTP.js +++ b/src/core/operations/legacy/HTTP.js @@ -37,6 +37,27 @@ const HTTP = { return (headerEnd < 2) ? input : input.slice(headerEnd, input.length); }, + /** + * Dechunk response operation + * + * @param {string} input + * @param {Object[]} args} + * @returns {string} + */ + runDechunk: function(input, args) { + var chunks = []; + var chunkSizeEnd = input.indexOf("\n") + 1; + var lineEndings = input.charAt(chunkSizeEnd - 2) == "\r" ? "\r\n" : "\n"; + var lineEndingsLength = lineEndings.length; + var chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); + while (!isNaN(chunkSize)) { + chunks.push(input.slice(chunkSizeEnd, chunkSize + chunkSizeEnd)); + input = input.slice(chunkSizeEnd + chunkSize + lineEndingsLength); + chunkSizeEnd = input.indexOf(lineEndings) + lineEndingsLength; + chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); + } + return chunks.join('') + input; + }, /** * Parse User Agent operation. From 83c145c2ac60849b96e2b593b16eee8c09212cbe Mon Sep 17 00:00:00 2001 From: sevzero Date: Thu, 24 May 2018 13:17:46 +0000 Subject: [PATCH 04/78] Reduced variable scopes --- src/core/operations/DechunkHTTP.mjs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/operations/DechunkHTTP.mjs b/src/core/operations/DechunkHTTP.mjs index 1a428e3a..310d595a 100644 --- a/src/core/operations/DechunkHTTP.mjs +++ b/src/core/operations/DechunkHTTP.mjs @@ -31,18 +31,18 @@ class DechunkHTTP extends Operation { * @returns {string} */ run(input, args) { - var chunks = []; - var chunkSizeEnd = input.indexOf("\n") + 1; - var lineEndings = input.charAt(chunkSizeEnd - 2) == "\r" ? "\r\n" : "\n"; - var lineEndingsLength = lineEndings.length; - var chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); + let chunks = []; + let chunkSizeEnd = input.indexOf("\n") + 1; + let lineEndings = input.charAt(chunkSizeEnd - 2) === "\r" ? "\r\n" : "\n"; + let lineEndingsLength = lineEndings.length; + let chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); while (!isNaN(chunkSize)) { chunks.push(input.slice(chunkSizeEnd, chunkSize + chunkSizeEnd)); input = input.slice(chunkSizeEnd + chunkSize + lineEndingsLength); chunkSizeEnd = input.indexOf(lineEndings) + lineEndingsLength; chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); } - return chunks.join('') + input; + return chunks.join("") + input; } } From 67bd2605c05fcf86ab70fad1f73701bcf168a27f Mon Sep 17 00:00:00 2001 From: sevzero Date: Thu, 24 May 2018 13:21:50 +0000 Subject: [PATCH 05/78] Updated variable scope in legacy HTTP.js file --- src/core/operations/legacy/HTTP.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/operations/legacy/HTTP.js b/src/core/operations/legacy/HTTP.js index b41e118c..e0d40528 100755 --- a/src/core/operations/legacy/HTTP.js +++ b/src/core/operations/legacy/HTTP.js @@ -45,18 +45,18 @@ const HTTP = { * @returns {string} */ runDechunk: function(input, args) { - var chunks = []; - var chunkSizeEnd = input.indexOf("\n") + 1; - var lineEndings = input.charAt(chunkSizeEnd - 2) == "\r" ? "\r\n" : "\n"; - var lineEndingsLength = lineEndings.length; - var chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); + let chunks = []; + let chunkSizeEnd = input.indexOf("\n") + 1; + let lineEndings = input.charAt(chunkSizeEnd - 2) === "\r" ? "\r\n" : "\n"; + let lineEndingsLength = lineEndings.length; + let chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); while (!isNaN(chunkSize)) { chunks.push(input.slice(chunkSizeEnd, chunkSize + chunkSizeEnd)); input = input.slice(chunkSizeEnd + chunkSize + lineEndingsLength); chunkSizeEnd = input.indexOf(lineEndings) + lineEndingsLength; chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); } - return chunks.join('') + input; + return chunks.join("") + input; }, /** From ed84614389e65d4755053a27588cbf984e720b3b Mon Sep 17 00:00:00 2001 From: sevzero Date: Thu, 24 May 2018 13:39:14 +0000 Subject: [PATCH 06/78] Fixed issues raised by Travis --- src/core/operations/DechunkHTTP.mjs | 8 ++++---- src/core/operations/legacy/HTTP.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/operations/DechunkHTTP.mjs b/src/core/operations/DechunkHTTP.mjs index 310d595a..b63bd590 100644 --- a/src/core/operations/DechunkHTTP.mjs +++ b/src/core/operations/DechunkHTTP.mjs @@ -31,13 +31,13 @@ class DechunkHTTP extends Operation { * @returns {string} */ run(input, args) { - let chunks = []; + const chunks = []; let chunkSizeEnd = input.indexOf("\n") + 1; - let lineEndings = input.charAt(chunkSizeEnd - 2) === "\r" ? "\r\n" : "\n"; - let lineEndingsLength = lineEndings.length; + const lineEndings = input.charAt(chunkSizeEnd - 2) === "\r" ? "\r\n" : "\n"; + const lineEndingsLength = lineEndings.length; let chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); while (!isNaN(chunkSize)) { - chunks.push(input.slice(chunkSizeEnd, chunkSize + chunkSizeEnd)); + chunks.push(input.slice(chunkSizeEnd, chunkSize + chunkSizeEnd)); input = input.slice(chunkSizeEnd + chunkSize + lineEndingsLength); chunkSizeEnd = input.indexOf(lineEndings) + lineEndingsLength; chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); diff --git a/src/core/operations/legacy/HTTP.js b/src/core/operations/legacy/HTTP.js index e0d40528..70e3f8a1 100755 --- a/src/core/operations/legacy/HTTP.js +++ b/src/core/operations/legacy/HTTP.js @@ -45,13 +45,13 @@ const HTTP = { * @returns {string} */ runDechunk: function(input, args) { - let chunks = []; + const chunks = []; let chunkSizeEnd = input.indexOf("\n") + 1; - let lineEndings = input.charAt(chunkSizeEnd - 2) === "\r" ? "\r\n" : "\n"; - let lineEndingsLength = lineEndings.length; + const lineEndings = input.charAt(chunkSizeEnd - 2) === "\r" ? "\r\n" : "\n"; + const lineEndingsLength = lineEndings.length; let chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); while (!isNaN(chunkSize)) { - chunks.push(input.slice(chunkSizeEnd, chunkSize + chunkSizeEnd)); + chunks.push(input.slice(chunkSizeEnd, chunkSize + chunkSizeEnd)); input = input.slice(chunkSizeEnd + chunkSize + lineEndingsLength); chunkSizeEnd = input.indexOf(lineEndings) + lineEndingsLength; chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16); From 0c06e640518b66a3d767ccd5358412f317b48463 Mon Sep 17 00:00:00 2001 From: Matt C Date: Thu, 9 Aug 2018 11:09:28 +0100 Subject: [PATCH 07/78] Added MessagePack operations --- package-lock.json | 166 ++++++++++++++++++------ package.json | 1 + src/core/config/Categories.json | 4 +- src/core/operations/FromMessagePack.mjs | 45 +++++++ src/core/operations/ToMessagePack.mjs | 45 +++++++ 5 files changed, 218 insertions(+), 43 deletions(-) create mode 100644 src/core/operations/FromMessagePack.mjs create mode 100644 src/core/operations/ToMessagePack.mjs diff --git a/package-lock.json b/package-lock.json index d8454f78..5329c51b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -385,6 +385,7 @@ "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, "requires": { "co": "^4.6.0", "fast-deep-equal": "^1.0.0", @@ -548,6 +549,7 @@ "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, "requires": { "safer-buffer": "~2.1.0" } @@ -592,7 +594,8 @@ "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true }, "assign-symbols": { "version": "1.0.0", @@ -630,7 +633,8 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true }, "atob": { "version": "2.1.1", @@ -708,12 +712,14 @@ "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true }, "aws4": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", + "dev": true }, "axios": { "version": "0.18.0", @@ -1467,6 +1473,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, "optional": true, "requires": { "tweetnacl": "^0.14.3" @@ -1807,7 +1814,8 @@ "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true }, "buffer-indexof": { "version": "1.1.1", @@ -1940,7 +1948,8 @@ "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true }, "catharsis": { "version": "0.8.9", @@ -2147,7 +2156,8 @@ "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true }, "code-point-at": { "version": "1.1.0", @@ -2196,6 +2206,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -2260,6 +2271,7 @@ "version": "1.6.2", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, "requires": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", @@ -2358,7 +2370,8 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, "cosmiconfig": { "version": "4.0.0", @@ -2594,6 +2607,7 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, "requires": { "assert-plus": "^1.0.0" } @@ -2766,7 +2780,8 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true }, "delegates": { "version": "1.0.0", @@ -2963,6 +2978,7 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, "optional": true, "requires": { "jsbn": "~0.1.0", @@ -2973,6 +2989,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, "optional": true } } @@ -3133,7 +3150,8 @@ "es6-promise": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", - "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==" + "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==", + "dev": true }, "es6-promise-polyfill": { "version": "1.2.0", @@ -3699,7 +3717,8 @@ "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true }, "extend-shallow": { "version": "3.0.2", @@ -3814,6 +3833,7 @@ "version": "1.6.7", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "dev": true, "requires": { "concat-stream": "1.6.2", "debug": "2.6.9", @@ -3824,7 +3844,8 @@ "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true }, "eyes": { "version": "0.1.8", @@ -3835,12 +3856,14 @@ "fast-deep-equal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", @@ -3866,6 +3889,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "dev": true, "requires": { "pend": "~1.2.0" } @@ -4058,12 +4082,14 @@ "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true }, "form-data": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "1.0.6", @@ -4105,6 +4131,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", + "dev": true, "requires": { "graceful-fs": "^4.1.2", "jsonfile": "^2.1.0", @@ -4768,6 +4795,7 @@ "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, "requires": { "assert-plus": "^1.0.0" } @@ -4848,7 +4876,8 @@ "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true }, "grunt": { "version": "1.0.3", @@ -5195,12 +5224,14 @@ "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true }, "har-validator": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "dev": true, "requires": { "ajv": "^5.1.0", "har-schema": "^2.0.0" @@ -5297,6 +5328,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=", + "dev": true, "requires": { "is-stream": "^1.0.1", "pinkie-promise": "^2.0.0" @@ -5546,6 +5578,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, "requires": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", @@ -5716,7 +5749,8 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true }, "ini": { "version": "1.3.5", @@ -6056,7 +6090,8 @@ "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true }, "is-symbol": { "version": "1.0.1", @@ -6067,7 +6102,8 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true }, "is-utf8": { "version": "0.2.1", @@ -6090,12 +6126,14 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true }, "isobject": { "version": "3.0.1", @@ -6106,7 +6144,8 @@ "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true }, "jison": { "version": "0.4.13", @@ -6379,12 +6418,14 @@ "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true }, "json-schema-traverse": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true }, "json-stable-stringify": { "version": "1.0.1", @@ -6404,7 +6445,8 @@ "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true }, "json3": { "version": "3.3.2", @@ -6422,6 +6464,7 @@ "version": "2.4.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "dev": true, "requires": { "graceful-fs": "^4.1.6" } @@ -6454,6 +6497,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -6501,7 +6545,8 @@ "kew": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", - "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=" + "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", + "dev": true }, "keybase-ecurve": { "version": "1.0.0", @@ -6544,6 +6589,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "dev": true, "requires": { "graceful-fs": "^4.1.9" } @@ -6973,12 +7019,14 @@ "mime-db": { "version": "1.35.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", - "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", + "dev": true }, "mime-types": { "version": "2.1.19", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "dev": true, "requires": { "mime-db": "~1.35.0" } @@ -7019,7 +7067,8 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true }, "mississippi": { "version": "2.0.0", @@ -7082,6 +7131,7 @@ "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, "requires": { "minimist": "0.0.8" } @@ -7506,6 +7556,11 @@ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", "dev": true }, + "notepack.io": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/notepack.io/-/notepack.io-2.1.3.tgz", + "integrity": "sha512-AgSt+cP5XMooho1Ppn8NB3FFaVWefV+qZoZncYTUSch2GAEwlYLcIIbT5YVkMlFeNHnfwOvc4HDlbvrB5BRxXA==" + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -7562,7 +7617,8 @@ "oauth-sign": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true }, "object-assign": { "version": "4.1.1", @@ -7954,12 +8010,14 @@ "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true }, "pgp-utils": { "version": "0.0.34", @@ -7986,6 +8044,7 @@ "version": "2.1.16", "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz", "integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=", + "dev": true, "requires": { "es6-promise": "^4.0.3", "extract-zip": "^1.6.5", @@ -8007,12 +8066,14 @@ "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true }, "pinkie-promise": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, "requires": { "pinkie": "^2.0.0" } @@ -8308,7 +8369,8 @@ "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true }, "progress": { "version": "1.1.8", @@ -8431,7 +8493,8 @@ "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true }, "purepack": { "version": "1.0.4", @@ -8441,7 +8504,8 @@ "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true }, "querystring": { "version": "0.2.0", @@ -8596,6 +8660,7 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -8821,6 +8886,7 @@ "version": "2.87.0", "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "dev": true, "requires": { "aws-sign2": "~0.7.0", "aws4": "^1.6.0", @@ -8848,6 +8914,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=", + "dev": true, "requires": { "throttleit": "^1.0.0" } @@ -9046,7 +9113,8 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true }, "safe-json-parse": { "version": "1.0.1", @@ -9066,7 +9134,8 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true }, "sanitize-html": { "version": "1.18.4", @@ -9775,6 +9844,7 @@ "version": "1.14.2", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "dev": true, "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -9791,6 +9861,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, "optional": true } } @@ -9949,6 +10020,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -10130,7 +10202,8 @@ "throttleit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", - "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=" + "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=", + "dev": true }, "through": { "version": "2.3.8", @@ -10260,6 +10333,7 @@ "version": "2.3.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "dev": true, "requires": { "punycode": "^1.4.1" } @@ -10345,6 +10419,7 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, "requires": { "safe-buffer": "^5.0.1" } @@ -10353,6 +10428,7 @@ "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, "optional": true }, "type-check": { @@ -10376,7 +10452,8 @@ "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true }, "ua-parser-js": { "version": "0.7.18", @@ -10689,7 +10766,8 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "util.promisify": { "version": "1.0.0", @@ -10744,7 +10822,8 @@ "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true }, "valid-data-url": { "version": "0.1.6", @@ -10778,6 +10857,7 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, "requires": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", @@ -11237,6 +11317,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, "requires": { "isexe": "^2.0.0" } @@ -11482,6 +11563,7 @@ "version": "2.4.1", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "dev": true, "requires": { "fd-slicer": "~1.0.1" } diff --git a/package.json b/package.json index 39072bef..fc790ab4 100644 --- a/package.json +++ b/package.json @@ -108,6 +108,7 @@ "moment-timezone": "^0.5.21", "node-forge": "^0.7.5", "node-md6": "^0.1.0", + "notepack.io": "^2.1.3", "nwmatcher": "^1.4.4", "otp": "^0.1.3", "popper.js": "^1.14.4", diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index 7c234d0e..1101c50c 100755 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -47,7 +47,9 @@ "Change IP format", "Encode text", "Decode text", - "Swap endianness" + "Swap endianness", + "To MessagePack", + "From MessagePack" ] }, { diff --git a/src/core/operations/FromMessagePack.mjs b/src/core/operations/FromMessagePack.mjs new file mode 100644 index 00000000..c585c055 --- /dev/null +++ b/src/core/operations/FromMessagePack.mjs @@ -0,0 +1,45 @@ +/** + * @author Matt C [matt@artemisbot.uk] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import OperationError from "../errors/OperationError"; +import notepack from "notepack.io"; + +/** + * From MessagePack operation + */ +class FromMessagePack extends Operation { + + /** + * FromMessagePack constructor + */ + constructor() { + super(); + + this.name = "From MessagePack"; + this.module = "Code"; + this.description = "Converts MessagePack encoded data to JSON"; + this.inputType = "ArrayBuffer"; + this.outputType = "JSON"; + this.args = []; + } + + /** + * @param {byteArray} input + * @param {Object[]} args + * @returns {JSON} + */ + run(input, args) { + try { + return notepack.decode(input); + } catch (err) { + throw new OperationError(`Could not decode MessagePack to JSON:MessagePack ${err}`); + } + } + +} + +export default FromMessagePack; diff --git a/src/core/operations/ToMessagePack.mjs b/src/core/operations/ToMessagePack.mjs new file mode 100644 index 00000000..30cb3ca7 --- /dev/null +++ b/src/core/operations/ToMessagePack.mjs @@ -0,0 +1,45 @@ +/** + * @author Matt C [matt@artemisbot.uk] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import OperationError from "../errors/OperationError.mjs"; +import notepack from "notepack.io"; + +/** + * To MessagePack operation + */ +class ToMessagePack extends Operation { + + /** + * ToMessagePack constructor + */ + constructor() { + super(); + + this.name = "To MessagePack"; + this.module = "Code"; + this.description = "Converts JSON to MessagePack encoded byte buffer"; + this.inputType = "JSON"; + this.outputType = "ArrayBuffer"; + this.args = []; + } + + /** + * @param {JSON} input + * @param {Object[]} args + * @returns {ArrayBuffer} + */ + run(input, args) { + try { + return notepack.encode(input); + } catch (err) { + throw new OperationError(`Could not encode JSON to MessagePack: ${err}`); + } + } + +} + +export default ToMessagePack; From 6155dbb6e9124558d5cba98ae388546c3deb294e Mon Sep 17 00:00:00 2001 From: d98762625 Date: Mon, 13 Aug 2018 10:38:56 +0100 Subject: [PATCH 08/78] Update CLA info in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d1960abb..ffa0d326 100755 --- a/README.md +++ b/README.md @@ -88,9 +88,9 @@ Contributing a new operation to CyberChef is super easy! There is a quickstart s An installation walkthrough, how-to guides for adding new operations and themes, descriptions of the repository structure, available data types and coding conventions can all be found in the project [wiki pages](https://github.com/gchq/CyberChef/wiki). - - Sign the [GCHQ Contributor Licence Agreement](https://github.com/gchq/Gaffer/wiki/GCHQ-OSS-Contributor-License-Agreement-V1.0) + - Sign the [GCHQ Contributor Licence Agreement](https://gist.github.com/p013570/edfbf68fe58d0d057770fde526176558#file-gchq-oss-contributor-license-agreement-md) - Push your changes to your fork. - - Submit a pull request. + - Submit a pull request. If you are doing this for the first time, you will be prompted to sign the [GCHQ Contributor Licence Agreement](https://github.com/gchq/Gaffer/wiki/GCHQ-OSS-Contributor-License-Agreement-V1.0) via the CLA assistant on the pull request. This will also ask whether you are happy for GCHQ to contact you about a token of thanks for your contribution, or about job opportunities at GCHQ. ## Licencing From 1a1fad743330c0f3d57714828ea243ca1df23d7e Mon Sep 17 00:00:00 2001 From: Cynser <42423063+Cynser@users.noreply.github.com> Date: Thu, 16 Aug 2018 03:01:19 +0100 Subject: [PATCH 09/78] Fixed DateTime format arguments --- src/core/operations/TranslateDateTimeFormat.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/operations/TranslateDateTimeFormat.mjs b/src/core/operations/TranslateDateTimeFormat.mjs index 6a60f6f0..568da94b 100644 --- a/src/core/operations/TranslateDateTimeFormat.mjs +++ b/src/core/operations/TranslateDateTimeFormat.mjs @@ -60,7 +60,7 @@ class TranslateDateTimeFormat extends Operation { * @returns {html} */ run(input, args) { - const [inputFormat, inputTimezone, outputFormat, outputTimezone] = args; + const [inputFormat, inputTimezone, outputFormat, outputTimezone] = args.splice(1); let date; try { From f1c31ea966364139c81b5b3c90f57de2ab831104 Mon Sep 17 00:00:00 2001 From: Cynser <42423063+Cynser@users.noreply.github.com> Date: Thu, 16 Aug 2018 03:28:11 +0100 Subject: [PATCH 10/78] Added some tests for the Translate DateTime Format operation --- test/index.mjs | 1 + .../operations/TranslateDateTimeFormat.mjs | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 test/tests/operations/TranslateDateTimeFormat.mjs diff --git a/test/index.mjs b/test/index.mjs index 48aa5427..d075886c 100644 --- a/test/index.mjs +++ b/test/index.mjs @@ -62,6 +62,7 @@ import "./tests/operations/SetDifference"; import "./tests/operations/SetIntersection"; import "./tests/operations/SetUnion"; import "./tests/operations/SymmetricDifference"; +import "./tests/operations/TranslateDateTimeFormat"; import "./tests/operations/Magic"; let allTestsPassing = true; diff --git a/test/tests/operations/TranslateDateTimeFormat.mjs b/test/tests/operations/TranslateDateTimeFormat.mjs new file mode 100644 index 00000000..12921f4b --- /dev/null +++ b/test/tests/operations/TranslateDateTimeFormat.mjs @@ -0,0 +1,56 @@ +/** + * Translate DateTime Format tests. + * + * @author Cynser + * + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ +import TestRegister from "../../TestRegister"; + +TestRegister.addTests([ + { + name: "Translate DateTime Format", + input: "01/04/1999 22:33:01", + expectedOutput: "Thursday 1st April 1999 22:33:01 +00:00 UTC", + recipeConfig: [ + { + op: "Translate DateTime Format", + args: ["Standard date and time", "DD/MM/YYYY HH:mm:ss", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "UTC"], + }, + ], + }, + { + name: "Translate DateTime Format: invalid input", + input: "1234567890", + expectedMatch: /Invalid format./, + recipeConfig: [ + { + op: "Translate DateTime Format", + args: ["Standard date and time", "DD/MM/YYYY HH:mm:ss", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "UTC"], + }, + ], + }, + { + name: "Translate DateTime Format: timezone conversion", + input: "01/04/1999 22:33:01", + expectedOutput: "Thursday 1st April 1999 17:33:01 -05:00 EST", + recipeConfig: [ + { + op: "Translate DateTime Format", + args: ["Standard date and time", "DD/MM/YYYY HH:mm:ss", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "US/Eastern"], + }, + ], + }, + { + name: "Translate DateTime Format: automatic input format", + input: "1999-04-01 22:33:01", + expectedOutput: "Thursday 1st April 1999 22:33:01 +00:00 UTC", + recipeConfig: [ + { + op: "Translate DateTime Format", + args: ["Automatic", "", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "UTC"], + }, + ], + } +]); From 8b78383732abd6886cc7d8015d5b065b2509db74 Mon Sep 17 00:00:00 2001 From: Cynser <42423063+Cynser@users.noreply.github.com> Date: Thu, 16 Aug 2018 03:31:09 +0100 Subject: [PATCH 11/78] Newline at end of files --- src/core/operations/TranslateDateTimeFormat.mjs | 1 + test/index.mjs | 1 + test/tests/operations/TranslateDateTimeFormat.mjs | 1 + 3 files changed, 3 insertions(+) diff --git a/src/core/operations/TranslateDateTimeFormat.mjs b/src/core/operations/TranslateDateTimeFormat.mjs index 568da94b..eeceec96 100644 --- a/src/core/operations/TranslateDateTimeFormat.mjs +++ b/src/core/operations/TranslateDateTimeFormat.mjs @@ -76,3 +76,4 @@ class TranslateDateTimeFormat extends Operation { } export default TranslateDateTimeFormat; + diff --git a/test/index.mjs b/test/index.mjs index d075886c..8cf69732 100644 --- a/test/index.mjs +++ b/test/index.mjs @@ -142,3 +142,4 @@ TestRegister.runTests() process.exit(allTestsPassing ? 0 : 1); }); + diff --git a/test/tests/operations/TranslateDateTimeFormat.mjs b/test/tests/operations/TranslateDateTimeFormat.mjs index 12921f4b..d991f8be 100644 --- a/test/tests/operations/TranslateDateTimeFormat.mjs +++ b/test/tests/operations/TranslateDateTimeFormat.mjs @@ -54,3 +54,4 @@ TestRegister.addTests([ ], } ]); + From 8dab0eac58a4702fa9efe083dcba4a2b69d6d481 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Sun, 19 Aug 2018 17:14:07 +0100 Subject: [PATCH 12/78] Removed excess newline --- package-lock.json | 183 +++++++++++++----- .../operations/TranslateDateTimeFormat.mjs | 1 - 2 files changed, 135 insertions(+), 49 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec0a0bf1..4b1032d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -385,6 +385,7 @@ "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, "requires": { "co": "^4.6.0", "fast-deep-equal": "^1.0.0", @@ -548,6 +549,7 @@ "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, "requires": { "safer-buffer": "~2.1.0" } @@ -592,7 +594,8 @@ "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true }, "assign-symbols": { "version": "1.0.0", @@ -630,7 +633,8 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true }, "atob": { "version": "2.1.1", @@ -708,12 +712,14 @@ "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true }, "aws4": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", + "dev": true }, "axios": { "version": "0.18.0", @@ -1467,6 +1473,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, "optional": true, "requires": { "tweetnacl": "^0.14.3" @@ -1807,7 +1814,8 @@ "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true }, "buffer-indexof": { "version": "1.1.1", @@ -1940,7 +1948,8 @@ "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true }, "catharsis": { "version": "0.8.9", @@ -2147,7 +2156,8 @@ "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true }, "code-point-at": { "version": "1.1.0", @@ -2196,6 +2206,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -2260,6 +2271,7 @@ "version": "1.6.2", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, "requires": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", @@ -2358,7 +2370,8 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, "cosmiconfig": { "version": "4.0.0", @@ -2594,6 +2607,7 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, "requires": { "assert-plus": "^1.0.0" } @@ -2766,7 +2780,8 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true }, "delegates": { "version": "1.0.0", @@ -2963,6 +2978,7 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, "optional": true, "requires": { "jsbn": "~0.1.0", @@ -2973,6 +2989,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, "optional": true } } @@ -3133,7 +3150,8 @@ "es6-promise": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", - "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==" + "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==", + "dev": true }, "es6-promise-polyfill": { "version": "1.2.0", @@ -3699,7 +3717,8 @@ "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true }, "extend-shallow": { "version": "3.0.2", @@ -3814,6 +3833,7 @@ "version": "1.6.7", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "dev": true, "requires": { "concat-stream": "1.6.2", "debug": "2.6.9", @@ -3824,7 +3844,8 @@ "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true }, "eyes": { "version": "0.1.8", @@ -3835,12 +3856,14 @@ "fast-deep-equal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", @@ -3866,6 +3889,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "dev": true, "requires": { "pend": "~1.2.0" } @@ -4058,12 +4082,14 @@ "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true }, "form-data": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "1.0.6", @@ -4105,6 +4131,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", + "dev": true, "requires": { "graceful-fs": "^4.1.2", "jsonfile": "^2.1.0", @@ -4170,12 +4197,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4190,17 +4219,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4317,7 +4349,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4329,6 +4362,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4343,6 +4377,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4454,7 +4489,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4587,6 +4623,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4768,6 +4805,7 @@ "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, "requires": { "assert-plus": "^1.0.0" } @@ -4848,7 +4886,8 @@ "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true }, "grunt": { "version": "1.0.3", @@ -5195,12 +5234,14 @@ "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true }, "har-validator": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "dev": true, "requires": { "ajv": "^5.1.0", "har-schema": "^2.0.0" @@ -5297,6 +5338,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=", + "dev": true, "requires": { "is-stream": "^1.0.1", "pinkie-promise": "^2.0.0" @@ -5546,6 +5588,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, "requires": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", @@ -5716,7 +5759,8 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true }, "ini": { "version": "1.3.5", @@ -6056,7 +6100,8 @@ "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true }, "is-symbol": { "version": "1.0.1", @@ -6067,7 +6112,8 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true }, "is-utf8": { "version": "0.2.1", @@ -6090,12 +6136,14 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true }, "isobject": { "version": "3.0.1", @@ -6106,7 +6154,8 @@ "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true }, "jison": { "version": "0.4.13", @@ -6379,12 +6428,14 @@ "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true }, "json-schema-traverse": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true }, "json-stable-stringify": { "version": "1.0.1", @@ -6404,7 +6455,8 @@ "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true }, "json3": { "version": "3.3.2", @@ -6422,6 +6474,7 @@ "version": "2.4.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "dev": true, "requires": { "graceful-fs": "^4.1.6" } @@ -6454,6 +6507,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -6501,7 +6555,8 @@ "kew": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", - "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=" + "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", + "dev": true }, "keybase-ecurve": { "version": "1.0.0", @@ -6544,6 +6599,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "dev": true, "requires": { "graceful-fs": "^4.1.9" } @@ -6973,12 +7029,14 @@ "mime-db": { "version": "1.35.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", - "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", + "dev": true }, "mime-types": { "version": "2.1.19", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "dev": true, "requires": { "mime-db": "~1.35.0" } @@ -7019,7 +7077,8 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true }, "mississippi": { "version": "2.0.0", @@ -7082,6 +7141,7 @@ "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, "requires": { "minimist": "0.0.8" } @@ -7562,7 +7622,8 @@ "oauth-sign": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true }, "object-assign": { "version": "4.1.1", @@ -7954,12 +8015,14 @@ "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true }, "pgp-utils": { "version": "0.0.34", @@ -7986,6 +8049,7 @@ "version": "2.1.16", "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz", "integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=", + "dev": true, "requires": { "es6-promise": "^4.0.3", "extract-zip": "^1.6.5", @@ -8007,12 +8071,14 @@ "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true }, "pinkie-promise": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, "requires": { "pinkie": "^2.0.0" } @@ -8308,7 +8374,8 @@ "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true }, "progress": { "version": "1.1.8", @@ -8431,7 +8498,8 @@ "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true }, "purepack": { "version": "1.0.4", @@ -8441,7 +8509,8 @@ "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true }, "querystring": { "version": "0.2.0", @@ -8596,6 +8665,7 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -8821,6 +8891,7 @@ "version": "2.87.0", "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "dev": true, "requires": { "aws-sign2": "~0.7.0", "aws4": "^1.6.0", @@ -8848,6 +8919,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=", + "dev": true, "requires": { "throttleit": "^1.0.0" } @@ -9046,7 +9118,8 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true }, "safe-json-parse": { "version": "1.0.1", @@ -9066,7 +9139,8 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true }, "sanitize-html": { "version": "1.18.4", @@ -9775,6 +9849,7 @@ "version": "1.14.2", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "dev": true, "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -9791,6 +9866,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, "optional": true } } @@ -9949,6 +10025,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -10130,7 +10207,8 @@ "throttleit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", - "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=" + "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=", + "dev": true }, "through": { "version": "2.3.8", @@ -10260,6 +10338,7 @@ "version": "2.3.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "dev": true, "requires": { "punycode": "^1.4.1" } @@ -10345,6 +10424,7 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, "requires": { "safe-buffer": "^5.0.1" } @@ -10353,6 +10433,7 @@ "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, "optional": true }, "type-check": { @@ -10376,7 +10457,8 @@ "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true }, "ua-parser-js": { "version": "0.7.18", @@ -10689,7 +10771,8 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "util.promisify": { "version": "1.0.0", @@ -10744,7 +10827,8 @@ "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true }, "valid-data-url": { "version": "0.1.6", @@ -10778,6 +10862,7 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, "requires": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", @@ -11237,6 +11322,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, "requires": { "isexe": "^2.0.0" } @@ -11482,6 +11568,7 @@ "version": "2.4.1", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "dev": true, "requires": { "fd-slicer": "~1.0.1" } diff --git a/src/core/operations/TranslateDateTimeFormat.mjs b/src/core/operations/TranslateDateTimeFormat.mjs index eeceec96..568da94b 100644 --- a/src/core/operations/TranslateDateTimeFormat.mjs +++ b/src/core/operations/TranslateDateTimeFormat.mjs @@ -76,4 +76,3 @@ class TranslateDateTimeFormat extends Operation { } export default TranslateDateTimeFormat; - From b9703e2bb6a9ac12be402cd6676841dbf35a117d Mon Sep 17 00:00:00 2001 From: n1474335 Date: Sun, 19 Aug 2018 17:14:36 +0100 Subject: [PATCH 13/78] 8.0.2 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b1032d6..4a5e8f24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.0.1", + "version": "8.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ada4d13d..04e4d7e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.0.1", + "version": "8.0.2", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From 782e0f3475d33e71f936f2fa3534a7252eb2fb32 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Sun, 19 Aug 2018 17:37:19 +0100 Subject: [PATCH 14/78] 8.1.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4a5e8f24..99374122 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.0.2", + "version": "8.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 04e4d7e3..4575efd0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.0.2", + "version": "8.1.0", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From c1b2fc94009c847146a11d8a01a44a413c75397e Mon Sep 17 00:00:00 2001 From: n1474335 Date: Sun, 19 Aug 2018 17:39:49 +0100 Subject: [PATCH 15/78] Updated CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad6e8be9..82b2019b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All notable changes to this project will be documented in this file. +### [8.1.0] - 2018-08-19 +- 'Dechunk HTTP response' operation added @sevzero #311 + ## [8.0.0] - 2018-08-05 - Codebase rewritten using [ES modules](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/) and [classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) #284 - Operation architecture restructured to make adding new operations a lot simpler #284 @@ -29,6 +32,7 @@ All notable changes to this project will be documented in this file. - Initial open source commit @n1474335 +[8.1.0]: https://github.com/gchq/CyberChef/releases/tag/v8.1.0 [8.0.0]: https://github.com/gchq/CyberChef/releases/tag/v8.0.0 [7.0.0]: https://github.com/gchq/CyberChef/releases/tag/v7.0.0 [6.0.0]: https://github.com/gchq/CyberChef/releases/tag/v6.0.0 From affe057cab5fed1204339f5a18dea7039a28bff7 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Sun, 19 Aug 2018 22:50:49 +0100 Subject: [PATCH 16/78] Added 'Decimal' option for toggleStrings. Closes #337. --- src/core/Utils.mjs | 5 +++- src/core/lib/Decimal.mjs | 37 +++++++++++++++++++++++++++++ src/core/lib/Hex.mjs | 5 ++-- src/core/operations/ADD.mjs | 2 +- src/core/operations/AND.mjs | 2 +- src/core/operations/FromDecimal.mjs | 13 ++-------- src/core/operations/FromHex.mjs | 2 +- src/core/operations/OR.mjs | 2 +- src/core/operations/SUB.mjs | 2 +- src/core/operations/XOR.mjs | 2 +- 10 files changed, 51 insertions(+), 21 deletions(-) create mode 100644 src/core/lib/Decimal.mjs diff --git a/src/core/Utils.mjs b/src/core/Utils.mjs index 78d4d97d..65ed07fb 100755 --- a/src/core/Utils.mjs +++ b/src/core/Utils.mjs @@ -8,6 +8,7 @@ import utf8 from "utf8"; import moment from "moment-timezone"; import {fromBase64} from "./lib/Base64"; import {fromHex} from "./lib/Hex"; +import {fromDecimal} from "./lib/Decimal"; /** @@ -297,7 +298,7 @@ class Utils { * Accepts hex, Base64, UTF8 and Latin1 strings. * * @param {string} str - * @param {string} type - One of "Hex", "Base64", "UTF8" or "Latin1" + * @param {string} type - One of "Hex", "Decimal", "Base64", "UTF8" or "Latin1" * @returns {byteArray} * * @example @@ -314,6 +315,8 @@ class Utils { switch (type.toLowerCase()) { case "hex": return fromHex(str); + case "decimal": + return fromDecimal(str); case "base64": return fromBase64(str, null, "byteArray"); case "utf8": diff --git a/src/core/lib/Decimal.mjs b/src/core/lib/Decimal.mjs new file mode 100644 index 00000000..846b2a94 --- /dev/null +++ b/src/core/lib/Decimal.mjs @@ -0,0 +1,37 @@ +/** + * Decimal functions. + * + * @author n1474335 [n1474335@gmail.com] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import Utils from "../Utils"; + + +/** + * Convert a string of decimal values into a byte array. + * + * @param {string} data + * @param {string} [delim] + * @returns {byteArray} + * + * @example + * // returns [10,20,30] + * fromDecimal("10 20 30"); + * + * // returns [10,20,30] + * fromDecimal("10:20:30", "Colon"); + */ +export function fromDecimal(data, delim="Auto") { + delim = Utils.charRep(delim); + const output = []; + let byteStr = data.split(delim); + if (byteStr[byteStr.length-1] === "") + byteStr = byteStr.slice(0, byteStr.length-1); + + for (let i = 0; i < byteStr.length; i++) { + output[i] = parseInt(byteStr[i], 10); + } + return output; +} diff --git a/src/core/lib/Hex.mjs b/src/core/lib/Hex.mjs index 538ba44b..760d84b5 100644 --- a/src/core/lib/Hex.mjs +++ b/src/core/lib/Hex.mjs @@ -1,5 +1,5 @@ /** - * Byte representation functions. + * Hexadecimal functions. * * @author n1474335 [n1474335@gmail.com] * @copyright Crown Copyright 2016 @@ -83,8 +83,7 @@ export function toHexFast(data) { * // returns [10,20,30] * fromHex("0a:14:1e", "Colon"); */ -export function fromHex(data, delim, byteLen=2) { - delim = delim || "Auto"; +export function fromHex(data, delim="Auto", byteLen=2) { if (delim !== "None") { const delimRegex = delim === "Auto" ? /[^a-f\d]/gi : Utils.regexRep(delim); data = data.replace(delimRegex, ""); diff --git a/src/core/operations/ADD.mjs b/src/core/operations/ADD.mjs index 7e6ad9d5..40329494 100644 --- a/src/core/operations/ADD.mjs +++ b/src/core/operations/ADD.mjs @@ -29,7 +29,7 @@ class ADD extends Operation { "name": "Key", "type": "toggleString", "value": "", - "toggleValues": ["Hex", "Base64", "UTF8", "Latin1"] + "toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"] } ]; } diff --git a/src/core/operations/AND.mjs b/src/core/operations/AND.mjs index 4a062725..30022ab9 100644 --- a/src/core/operations/AND.mjs +++ b/src/core/operations/AND.mjs @@ -29,7 +29,7 @@ class AND extends Operation { "name": "Key", "type": "toggleString", "value": "", - "toggleValues": ["Hex", "Base64", "UTF8", "Latin1"] + "toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"] } ]; } diff --git a/src/core/operations/FromDecimal.mjs b/src/core/operations/FromDecimal.mjs index 48667148..f3c117ff 100644 --- a/src/core/operations/FromDecimal.mjs +++ b/src/core/operations/FromDecimal.mjs @@ -5,8 +5,8 @@ */ import Operation from "../Operation"; -import Utils from "../Utils"; import {DELIM_OPTIONS} from "../lib/Delim"; +import {fromDecimal} from "../lib/Decimal"; /** * From Decimal operation @@ -71,16 +71,7 @@ class FromDecimal extends Operation { * @returns {byteArray} */ run(input, args) { - const delim = Utils.charRep(args[0]), - output = []; - let byteStr = input.split(delim); - if (byteStr[byteStr.length-1] === "") - byteStr = byteStr.slice(0, byteStr.length-1); - - for (let i = 0; i < byteStr.length; i++) { - output[i] = parseInt(byteStr[i], 10); - } - return output; + return fromDecimal(input, args[0]); } } diff --git a/src/core/operations/FromHex.mjs b/src/core/operations/FromHex.mjs index 45ea9955..3c846824 100644 --- a/src/core/operations/FromHex.mjs +++ b/src/core/operations/FromHex.mjs @@ -86,7 +86,7 @@ class FromHex extends Operation { * @returns {byteArray} */ run(input, args) { - const delim = args[0] || "Space"; + const delim = args[0] || "Auto"; return fromHex(input, delim, 2); } diff --git a/src/core/operations/OR.mjs b/src/core/operations/OR.mjs index 33bb2f63..cd3b757e 100644 --- a/src/core/operations/OR.mjs +++ b/src/core/operations/OR.mjs @@ -29,7 +29,7 @@ class OR extends Operation { "name": "Key", "type": "toggleString", "value": "", - "toggleValues": ["Hex", "Base64", "UTF8", "Latin1"] + "toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"] } ]; } diff --git a/src/core/operations/SUB.mjs b/src/core/operations/SUB.mjs index 79ce95d0..5fef815d 100644 --- a/src/core/operations/SUB.mjs +++ b/src/core/operations/SUB.mjs @@ -29,7 +29,7 @@ class SUB extends Operation { "name": "Key", "type": "toggleString", "value": "", - "toggleValues": ["Hex", "Base64", "UTF8", "Latin1"] + "toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"] } ]; } diff --git a/src/core/operations/XOR.mjs b/src/core/operations/XOR.mjs index ae35eab7..c3d14a7a 100644 --- a/src/core/operations/XOR.mjs +++ b/src/core/operations/XOR.mjs @@ -29,7 +29,7 @@ class XOR extends Operation { "name": "Key", "type": "toggleString", "value": "", - "toggleValues": ["Hex", "Base64", "UTF8", "Latin1"] + "toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"] }, { "name": "Scheme", From e11bb386256d2ac9c83ac212802141a7e64a0999 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Sun, 19 Aug 2018 22:50:54 +0100 Subject: [PATCH 17/78] 8.1.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99374122..76cc3a7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.1.0", + "version": "8.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4575efd0..cfd0b560 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.1.0", + "version": "8.1.1", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From 5bcdd99870dd7306dd303bb42a6ce9e63ad6f640 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Sun, 19 Aug 2018 22:58:31 +0100 Subject: [PATCH 18/78] 'Change IP format' operation now uses the correct arguments. Fixes #332 --- src/core/Utils.mjs | 4 +++- src/core/operations/ChangeIPFormat.mjs | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/Utils.mjs b/src/core/Utils.mjs index 65ed07fb..ec93cdc4 100755 --- a/src/core/Utils.mjs +++ b/src/core/Utils.mjs @@ -333,7 +333,7 @@ class Utils { * Accepts hex, Base64, UTF8 and Latin1 strings. * * @param {string} str - * @param {string} type - One of "Hex", "Base64", "UTF8" or "Latin1" + * @param {string} type - One of "Hex", "Decimal", "Base64", "UTF8" or "Latin1" * @returns {string} * * @example @@ -350,6 +350,8 @@ class Utils { switch (type.toLowerCase()) { case "hex": return Utils.byteArrayToChars(fromHex(str)); + case "decimal": + return Utils.byteArrayToChars(fromDecimal(str)); case "base64": return Utils.byteArrayToChars(fromBase64(str, null, "byteArray")); case "utf8": diff --git a/src/core/operations/ChangeIPFormat.mjs b/src/core/operations/ChangeIPFormat.mjs index b985312a..56c5ffe1 100644 --- a/src/core/operations/ChangeIPFormat.mjs +++ b/src/core/operations/ChangeIPFormat.mjs @@ -21,7 +21,7 @@ class ChangeIPFormat extends Operation { super(); this.name = "Change IP format"; - this.module = "JSBN"; + this.module = "Default"; this.description = "Convert an IP address from one format to another, e.g. 172.20.23.54 to ac141736"; this.inputType = "string"; this.outputType = "string"; @@ -29,12 +29,12 @@ class ChangeIPFormat extends Operation { { "name": "Input format", "type": "option", - "value": ["Hex", "Raw"] + "value": ["Dotted Decimal", "Decimal", "Hex"] }, { "name": "Output format", "type": "option", - "value": ["Hex", "Raw"] + "value": ["Dotted Decimal", "Decimal", "Hex"] } ]; } From 92d9abf43ab3e9bc0f99d5da2b5ac322986cbfb1 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Sun, 19 Aug 2018 22:58:35 +0100 Subject: [PATCH 19/78] 8.1.2 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 76cc3a7a..aea02479 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.1.1", + "version": "8.1.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index cfd0b560..cdef27ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.1.1", + "version": "8.1.2", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From 481a4266b0d2e1b83fe83ca9938be5411c862e85 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Sun, 19 Aug 2018 23:07:53 +0100 Subject: [PATCH 20/78] Reset progress on statechange events. Fixes #329. --- src/web/App.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/web/App.mjs b/src/web/App.mjs index a291aa8b..bb9cffb2 100755 --- a/src/web/App.mjs +++ b/src/web/App.mjs @@ -115,7 +115,7 @@ class App { * @param {boolean} [step] - Set to true if we should only execute one operation instead of the * whole recipe. */ - bake(step) { + bake(step=false) { if (this.baking) return; // Reset attemptHighlight flag @@ -634,6 +634,7 @@ class App { * @param {event} e */ stateChange(e) { + this.progress = 0; this.autoBake(); // Set title From 2507362741ada458009a82cbdf24f996bc328ff1 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Sun, 19 Aug 2018 23:08:02 +0100 Subject: [PATCH 21/78] 8.1.3 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index aea02479..9754ae3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.1.2", + "version": "8.1.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index cdef27ec..714ca305 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "8.1.2", + "version": "8.1.3", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From f052ed9b00e1bc3d146b3d3b8df3a5ae0021ed9b Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 20 Aug 2018 00:04:49 +0100 Subject: [PATCH 22/78] Compile message no longer overflows on small screens --- src/web/App.mjs | 4 +++- src/web/html/index.html | 2 +- src/web/stylesheets/layout/_banner.css | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/web/App.mjs b/src/web/App.mjs index bb9cffb2..d001f9e4 100755 --- a/src/web/App.mjs +++ b/src/web/App.mjs @@ -533,7 +533,9 @@ class App { compileInfo += " - " + window.compileMessage; } - document.getElementById("notice").innerHTML = compileInfo; + const notice = document.getElementById("notice"); + notice.innerHTML = compileInfo; + notice.setAttribute("title", Utils.stripHtmlTags(window.compileMessage)); } diff --git a/src/web/html/index.html b/src/web/html/index.html index aa13da7c..f03590ab 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -155,7 +155,7 @@ Download CyberChef file_download <% } %> -
    +