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

Compare commits

...

40 Commits

Author SHA1 Message Date
n1474335
8ee3742216 6.8.0 2017-12-21 15:13:54 +00:00
n1474335
194eb184f3 Merge branch 'bwhitn-math' 2017-12-21 15:13:35 +00:00
n1474335
98f59ace3a Small tweaks to the arithmetic ops 2017-12-21 15:12:06 +00:00
n1474335
c1fb6d9776 Merge branch 'math' of https://github.com/bwhitn/CyberChef into bwhitn-math 2017-12-21 14:46:37 +00:00
bwhitn
fc7d2c2f52 separated all functions and updated comments/descriptions 2017-12-21 05:58:31 -08:00
bwhitn
0fea84ed7a WIP 2017-12-21 00:19:47 -05:00
n1474335
5e7f8e3976 Removed unnecessary whitespace 2017-12-20 16:34:21 +00:00
n1474335
fe4c5f5899 6.7.2 2017-12-20 15:56:56 +00:00
n1474335
d47b7b9242 Merge branch 'bug-numberwang' 2017-12-20 15:56:47 +00:00
n1474335
09b6661e35 Fixed trailing spaces 2017-12-20 15:51:57 +00:00
n1474335
57b1667b69 Fixed the Numberwang algorithm to correctly recognise recently discovered Numberwang values. Fixes #204 2017-12-20 15:45:58 +00:00
n1474335
5e9380b550 6.7.1 2017-12-20 13:43:31 +00:00
n1474335
fc8a0480fb Merge branch 'bug-css-selector' 2017-12-20 13:43:00 +00:00
n1474335
317327d097 CSS selector operation now works in a web worker. Fixes #218 2017-12-20 13:30:51 +00:00
n1474335
ecd0ac2521 Updated dependencies 2017-12-19 16:53:57 +00:00
n1474335
f9eaf67db2 6.7.0 2017-12-19 15:02:23 +00:00
n1474335
99e0c8d5e3 Merge branch 'bwhitn-chi' 2017-12-19 15:02:08 +00:00
n1474335
7a951d86d8 Tidied up Chi Square operation 2017-12-19 15:02:01 +00:00
n1474335
d9dfaec84c Merge branch 'chi' of https://github.com/bwhitn/CyberChef into bwhitn-chi 2017-12-19 14:45:50 +00:00
n1474335
80719ae368 6.6.3 2017-12-19 14:41:34 +00:00
n1474335
9407809356 Merge branch 'bwhitn-fixHOTP' 2017-12-19 14:40:30 +00:00
n1474335
f7e958e7a1 Changed HOTP inputType to byteArray 2017-12-19 14:38:13 +00:00
n1474335
5d75f8636a Resolved conflict 2017-12-19 14:31:40 +00:00
bwhitn
4ca2a30249 Fixed minor errors 2017-12-18 05:33:52 -08:00
bwhitn
08a31523b2 changed the function comment 2017-12-18 05:04:11 -08:00
bwhitn
224d79be05 merged with master 2017-12-17 23:56:30 -05:00
bwhitn
435ed587a5 Fixed HOTP, TOTP and added test for HOTP 2017-12-17 23:53:13 -05:00
bwhitn
81082ea001 I really need to learn git 2017-12-17 23:45:15 -05:00
bwhitn
1d3229a729 rebase to current 2017-12-17 23:35:34 -05:00
bwhitn
a9e60d3450 minor fix 2017-12-17 23:29:16 -05:00
bwhitn
f9ddee7d80 Inital commit for pull 2017-12-17 23:29:16 -05:00
bwhitn
ef0d3b73b0 changed op array 2017-12-17 23:29:16 -05:00
bwhitn
5368040e83 Added additional arithmetic source 2017-12-17 23:29:16 -05:00
bwhitn
b9b4147c2f start of math operations 2017-12-17 23:28:09 -05:00
bwhitn
2b47631f4d minor fix 2017-12-17 22:15:13 -05:00
bwhitn
298e8e8491 Inital commit for pull 2017-12-17 21:57:09 -05:00
bwhitn
6ad3728314 changed op array 2017-12-17 15:29:31 -05:00
bwhitn
772f9a806e Added additional arithmetic source 2017-12-17 15:20:58 -05:00
bwhitn
ae8d1f2178 start of math operations 2017-12-17 15:19:10 -05:00
bwhitn
9bc6c46dc3 Fixed HOTP, TOTP and added test for HOTP 2017-12-16 09:10:52 -05:00
19 changed files with 2172 additions and 743 deletions

View File

@@ -2,7 +2,7 @@
[![Build Status](https://travis-ci.org/gchq/CyberChef.svg?branch=master)](https://travis-ci.org/gchq/CyberChef)
[![dependencies Status](https://david-dm.org/gchq/CyberChef/status.svg)](https://david-dm.org/gchq/CyberChef)
[![npm](http://img.shields.io/npm/v/cyberchef.svg)](https://www.npmjs.com/package/cyberchef)
[![npm](https://img.shields.io/npm/v/cyberchef.svg)](https://www.npmjs.com/package/cyberchef)
![](https://reposs.herokuapp.com/?path=gchq/CyberChef&color=blue)
[![](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/gchq/CyberChef/blob/master/LICENSE)
[![Gitter](https://badges.gitter.im/gchq/CyberChef.svg)](https://gitter.im/gchq/CyberChef?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

2339
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "cyberchef",
"version": "6.6.2",
"version": "6.8.0",
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
"author": "n1474335 <n1474335@gmail.com>",
"homepage": "https://gchq.github.io/CyberChef",
@@ -36,7 +36,7 @@
"css-loader": "^0.28.7",
"exports-loader": "^0.6.4",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.5",
"file-loader": "^1.1.6",
"grunt": ">=1.0.1",
"grunt-accessibility": "~5.0.0",
"grunt-chmod": "~1.1.1",
@@ -56,13 +56,13 @@
"less-loader": "^4.0.5",
"postcss-css-variables": "^0.8.0",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"style-loader": "^0.19.0",
"postcss-loader": "^2.0.9",
"style-loader": "^0.19.1",
"url-loader": "^0.6.2",
"val-loader": "^1.1.0",
"web-resource-inliner": "^4.2.0",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.9.4",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.9.7",
"webpack-node-externals": "^1.6.0",
"worker-loader": "^1.1.0"
},
@@ -81,21 +81,22 @@
"google-code-prettify": "^1.0.5",
"jquery": "^3.2.1",
"js-crc": "^0.2.0",
"js-sha3": "^0.6.1",
"js-sha3": "^0.7.0",
"jsbn": "^1.1.0",
"jsonpath": "^1.0.0",
"jsrsasign": "8.0.4",
"lodash": "^4.17.4",
"moment": "^2.19.2",
"moment": "^2.20.1",
"moment-timezone": "^0.5.14",
"node-md6": "^0.1.0",
"nwmatcher": "^1.4.3",
"otp": "^0.1.3",
"sladex-blowfish": "^0.8.1",
"sortablejs": "^1.7.0",
"split.js": "^1.3.5",
"vkbeautify": "^0.99.3",
"xmldom": "^0.1.27",
"xpath": "0.0.24",
"xpath": "0.0.27",
"zlibjs": "^0.3.1"
},
"scripts": {

View File

@@ -13,7 +13,7 @@ import Utils from "./Utils.js";
*/
const Dish = function(value, type) {
this.value = value || typeof value == "string" ? value : null;
this.type = type || Dish.BYTE_ARRAY;
this.type = type || Dish.BYTE_ARRAY;
};
@@ -101,7 +101,7 @@ Dish.enumLookup = function(typeEnum) {
*/
Dish.prototype.set = function(value, type) {
this.value = value;
this.type = type;
this.type = type;
if (!this.valid()) {
const sample = Utils.truncate(JSON.stringify(this.value), 13);

View File

@@ -859,7 +859,7 @@ const Utils = {
*
* fragment = *( pchar / "/" / "?" )
* query = *( pchar / "/" / "?" )
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* pct-encoded = "%" HEXDIG HEXDIG
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"

View File

@@ -113,7 +113,7 @@ const Categories = [
]
},
{
name: "Logical operations",
name: "Arithmetic / Logic",
ops: [
"XOR",
"XOR Brute Force",
@@ -122,6 +122,13 @@ const Categories = [
"AND",
"ADD",
"SUB",
"Sum",
"Subtract",
"Multiply",
"Divide",
"Mean",
"Median",
"Standard Deviation",
"Bit shift left",
"Bit shift right",
"Rotate left",
@@ -302,6 +309,7 @@ const Categories = [
ops: [
"Entropy",
"Frequency distribution",
"Chi Square",
"Detect File Type",
"Scan for Embedded Files",
"Disassemble x86",

View File

@@ -1,3 +1,4 @@
import Arithmetic from "../operations/Arithmetic.js";
import Base from "../operations/Base.js";
import Base58 from "../operations/Base58.js";
import Base64 from "../operations/Base64.js";
@@ -519,6 +520,97 @@ const OperationConfig = {
}
]
},
"Sum": {
module: "Default",
description: "Adds together a list of numbers. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5</code> becomes <code>18.5</code>",
inputType: "string",
outputType: "number",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Subtract": {
module: "Default",
description: "Subtracts a list of numbers. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5</code> becomes <code>1.5</code>",
inputType: "string",
outputType: "number",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Multiply": {
module: "Default",
description: "Multiplies a list of numbers. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5</code> becomes <code>40</code>",
inputType: "string",
outputType: "number",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Divide": {
module: "Default",
description: "Divides a list of numbers. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5</code> becomes <code>2.5</code>",
inputType: "string",
outputType: "number",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Mean": {
module: "Default",
description: "Computes the mean (average) of a number list. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5 .5</code> becomes <code>4.75</code>",
inputType: "string",
outputType: "number",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Median": {
module: "Default",
description: "Computes the median of a number list. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 1 .5</code> becomes <code>4.5</code>",
inputType: "string",
outputType: "number",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"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.<br><br>e.g. <code>0x0a 8 .5</code> becomes <code>4.089281382128433</code>",
inputType: "string",
outputType: "number",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"From Hex": {
module: "Default",
description: "Converts a hexadecimal byte string back into its raw value.<br><br>e.g. <code>ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a</code> becomes the UTF-8 encoded string <code>Γειά σου</code>",
@@ -3205,6 +3297,13 @@ const OperationConfig = {
}
]
},
"Chi Square": {
module: "Default",
description: "Calculates the Chi Square distribution of values.",
inputType: "byteArray",
outputType: "number",
args: []
},
"Numberwang": {
module: "Default",
description: "Based on the popular gameshow by Mitchell and Webb.",
@@ -3840,7 +3939,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.<br><br>Enter the secret as the input or leave it blank for a random secret to be generated.",
inputType: "string",
inputType: "byteArray",
outputType: "string",
args: [
{

View File

@@ -1,4 +1,5 @@
import FlowControl from "../../FlowControl.js";
import Arithmetic from "../../operations/Arithmetic.js";
import Base from "../../operations/Base.js";
import Base58 from "../../operations/Base58.js";
import Base64 from "../../operations/Base64.js";
@@ -143,6 +144,7 @@ OpModules.Default = {
"Microsoft Script Decoder": MS.runDecodeScript,
"Entropy": Entropy.runEntropy,
"Frequency distribution": Entropy.runFreqDistrib,
"Chi Square": Entropy.runChiSq,
"Detect File Type": FileType.runDetect,
"Scan for Embedded Files": FileType.runScanForEmbeddedFiles,
"Generate UUID": UUID.runGenerateV4,
@@ -158,6 +160,13 @@ OpModules.Default = {
"Return": FlowControl.runReturn,
"Comment": FlowControl.runComment,
"PHP Deserialize": PHP.runDeserialize,
"Sum": Arithmetic.runSum,
"Subtract": Arithmetic.runSub,
"Multiply": Arithmetic.runMulti,
"Divide": Arithmetic.runDiv,
"Mean": Arithmetic.runMean,
"Median": Arithmetic.runMedian,
"Standard Deviation": Arithmetic.runStdDev,
/*

View File

@@ -0,0 +1,252 @@
import Utils from "../Utils.js";
/**
* Math operations on numbers.
*
* @author bwhitn [brian.m.whitney@outlook.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*
* @namespace
*/
const Arithmetic = {
/**
* @constant
* @default
*/
DELIM_OPTIONS: ["Line feed", "Space", "Comma", "Semi-colon", "Colon", "CRLF"],
/**
* Splits a string based on a delimiter and calculates the sum of numbers.
*
* @param {string} input
* @param {Object[]} args
* @returns {number}
*/
runSum: function(input, args) {
const val = Arithmetic._sum(Arithmetic._createNumArray(input, args[0]));
return typeof(val) === "number" ? val : NaN;
},
/**
* Splits a string based on a delimiter and subtracts all the numbers.
*
* @param {string} input
* @param {Object[]} args
* @returns {number}
*/
runSub: function(input, args) {
let val = Arithmetic._sub(Arithmetic._createNumArray(input, args[0]));
return typeof(val) === "number" ? val : NaN;
},
/**
* Splits a string based on a delimiter and multiplies the numbers.
*
* @param {string} input
* @param {Object[]} args
* @returns {number}
*/
runMulti: function(input, args) {
let val = Arithmetic._multi(Arithmetic._createNumArray(input, args[0]));
return typeof(val) === "number" ? val : NaN;
},
/**
* Splits a string based on a delimiter and divides the numbers.
*
* @param {string} input
* @param {Object[]} args
* @returns {number}
*/
runDiv: function(input, args) {
let val = Arithmetic._div(Arithmetic._createNumArray(input, args[0]));
return typeof(val) === "number" ? val : NaN;
},
/**
* Splits a string based on a delimiter and computes the mean (average).
*
* @param {string} input
* @param {Object[]} args
* @returns {number}
*/
runMean: function(input, args) {
let val = Arithmetic._mean(Arithmetic._createNumArray(input, args[0]));
return typeof(val) === "number" ? val : NaN;
},
/**
* Splits a string based on a delimiter and finds the median.
*
* @param {string} input
* @param {Object[]} args
* @returns {number}
*/
runMedian: function(input, args) {
let val = Arithmetic._median(Arithmetic._createNumArray(input, args[0]));
return typeof(val) === "number" ? val : NaN;
},
/**
* splits a string based on a delimiter and computes the standard deviation.
*
* @param {string} input
* @param {Object[]} args
* @returns {number}
*/
runStdDev: function(input, args) {
let val = Arithmetic._stdDev(Arithmetic._createNumArray(input, args[0]));
return typeof(val) === "number" ? val : NaN;
},
/**
* Converts a string array to a number array.
*
* @private
* @param {string[]} input
* @param {string} delim
* @returns {number[]}
*/
_createNumArray: function(input, delim) {
delim = Utils.charRep[delim || "Space"];
let splitNumbers = input.split(delim),
numbers = [],
num;
for (let i = 0; i < splitNumbers.length; i++) {
if (splitNumbers[i].indexOf(".") >= 0) {
num = parseFloat(splitNumbers[i].trim());
} else {
num = parseInt(splitNumbers[i].trim(), 0);
}
if (!isNaN(num)) {
numbers.push(num);
}
}
return numbers;
},
/**
* Adds an array of numbers and returns the value.
*
* @private
* @param {number[]} data
* @returns {number}
*/
_sum: function(data) {
if (data.length > 0) {
return data.reduce((acc, curr) => acc + curr);
}
},
/**
* Subtracts an array of numbers and returns the value.
*
* @private
* @param {number[]} data
* @returns {number}
*/
_sub: function(data) {
if (data.length > 0) {
return data.reduce((acc, curr) => acc - curr);
}
},
/**
* Multiplies an array of numbers and returns the value.
*
* @private
* @param {number[]} data
* @returns {number}
*/
_multi: function(data) {
if (data.length > 0) {
return data.reduce((acc, curr) => acc * curr);
}
},
/**
* Divides an array of numbers and returns the value.
*
* @private
* @param {number[]} data
* @returns {number}
*/
_div: function(data) {
if (data.length > 0) {
return data.reduce((acc, curr) => acc / curr);
}
},
/**
* Computes mean of a number array and returns the value.
*
* @private
* @param {number[]} data
* @returns {number}
*/
_mean: function(data) {
if (data.length > 0) {
return Arithmetic._sum(data) / data.length;
}
},
/**
* Computes median of a number array and returns the value.
*
* @private
* @param {number[]} data
* @returns {number}
*/
_median: function (data) {
if ((data.length % 2) === 0) {
let first, second;
data.sort(function(a, b){
return a - b;
});
first = data[Math.floor(data.length / 2)];
second = data[Math.floor(data.length / 2) - 1];
return Arithmetic._mean([first, second]);
} else {
return data[Math.floor(data.length / 2)];
}
},
/**
* Computes standard deviation of a number array and returns the value.
*
* @private
* @param {number[]} data
* @returns {number}
*/
_stdDev: function (data) {
if (data.length > 0) {
let avg = Arithmetic._mean(data);
let devSum = 0;
for (let i = 0; i < data.length; i++) {
devSum += (data[i] - avg) ** 2;
}
return Math.sqrt(devSum / data.length);
}
},
};
export default Arithmetic;

View File

@@ -186,7 +186,7 @@ const ByteRepr = {
// 0x and \x are added to the beginning if they are selected, so increment the positions accordingly
if (delim === "0x" || delim === "\\x") {
pos[0].start += 2;
pos[0].end += 2;
pos[0].end += 2;
}
return pos;
},

View File

@@ -2,9 +2,10 @@ import {camelCase, kebabCase, snakeCase} from "lodash";
import Utils from "../Utils.js";
import vkbeautify from "vkbeautify";
import {DOMParser as dom} from "xmldom";
import {DOMParser} from "xmldom";
import xpath from "xpath";
import jpath from "jsonpath";
import nwmatcher from "nwmatcher";
import prettyPrintOne from "imports-loader?window=>global!exports-loader?prettyPrintOne!google-code-prettify/bin/prettify.min.js";
@@ -336,7 +337,7 @@ const Code = {
let doc;
try {
doc = new dom().parseFromString(input);
doc = new DOMParser().parseFromString(input, "application/xml");
} catch (err) {
return "Invalid input XML.";
}
@@ -423,7 +424,7 @@ const Code = {
let query = args[0],
delimiter = args[1],
parser = new DOMParser(),
html,
dom,
result;
if (!query.length || !input.length) {
@@ -431,32 +432,32 @@ const Code = {
}
try {
html = parser.parseFromString(input, "text/html");
dom = parser.parseFromString(input);
} catch (err) {
return "Invalid input HTML.";
}
try {
result = html.querySelectorAll(query);
const matcher = nwmatcher({document: dom});
result = matcher.select(query, dom);
} catch (err) {
return "Invalid CSS Selector. Details:\n" + err.message;
}
const nodeToString = function(node) {
return node.toString();
/* xmldom does not return the outerHTML value.
switch (node.nodeType) {
case Node.ELEMENT_NODE: return node.outerHTML;
case Node.ATTRIBUTE_NODE: return node.value;
case Node.COMMENT_NODE: return node.data;
case Node.TEXT_NODE: return node.wholeText;
case Node.DOCUMENT_NODE: return node.outerHTML;
case node.ELEMENT_NODE: return node.outerHTML;
case node.ATTRIBUTE_NODE: return node.value;
case node.TEXT_NODE: return node.wholeText;
case node.COMMENT_NODE: return node.data;
case node.DOCUMENT_NODE: return node.outerHTML;
default: throw new Error("Unknown Node Type: " + node.nodeType);
}
}*/
};
return Array.apply(null, Array(result.length))
.map(function(_, i) {
return result[i];
})
return result
.map(nodeToString)
.join(delimiter);
},

View File

@@ -135,6 +135,31 @@ const Entropy = {
},
/**
* Chi Square operation.
*
* @param {byteArray} data
* @param {Object[]} args
* @returns {number}
*/
runChiSq: function(input, args) {
let distArray = new Array(256).fill(0),
total = 0;
for (let i = 0; i < input.length; i++) {
distArray[input[i]]++;
}
for (let i = 0; i < distArray.length; i++) {
if (distArray[i] > 0) {
total += Math.pow(distArray[i] - input.length / 256, 2) / (input.length / 256);
}
}
return total;
},
/**
* Calculates the Shannon entropy for a given chunk of data.
*

View File

@@ -1,5 +1,5 @@
/**
* Microsoft operations.
* Microsoft operations.
*
* @author bmwhitn [brian.m.whitney@outlook.com]
* @copyright Crown Copyright 2017

View File

@@ -14,16 +14,72 @@ const Numberwang = {
* @returns {string}
*/
run: function(input, args) {
if (!input) return "Let's play Wangernumb!";
const match = input.match(/\d+/);
if (match) {
return match[0] + "! That's Numberwang!";
let output;
if (!input) {
output = "Let's play Wangernumb!";
} else {
// That's a bad miss!
return "Sorry, that's not Numberwang. Let's rotate the board!";
const match = input.match(/(f0rty-s1x|shinty-six|filth-hundred and neeb|-?√?\d+(\.\d+)?i?([a-z]?)%?)/i);
if (match) {
if (match[3]) output = match[0] + "! That's AlphaNumericWang!";
else output = match[0] + "! That's Numberwang!";
} else {
// That's a bad miss!
output = "Sorry, that's not Numberwang. Let's rotate the board!";
}
}
const rand = Math.floor(Math.random() * Numberwang._didYouKnow.length);
return output + "\n\nDid you know: " + Numberwang._didYouKnow[rand];
},
/**
* Taken from http://numberwang.wikia.com/wiki/Numberwang_Wikia
*
* @private
* @constant
*/
_didYouKnow: [
"Numberwang, contrary to popular belief, is a fruit and not a vegetable.",
"Robert Webb once got WordWang while presenting an episode of Numberwang.",
"The 6705th digit of pi is Numberwang.",
"Numberwang was invented on a Sevenday.",
"Contrary to popular belief, Albert Einstein always got good grades in Numberwang at school. He once scored ^4$ on a test.",
"680 asteroids have been named after Numberwang.",
"Archimedes is most famous for proclaiming \"That's Numberwang!\" during an epiphany about water displacement he had while taking a bath.",
"Numberwang Day is celebrated in Japan on every day of the year apart from June 6.",
"Biologists recently discovered Numberwang within a strand of human DNA.",
"Numbernot is a special type of non-Numberwang number. It is divisible by 3 and the letter \"y\".",
"Julie once got 612.04 Numberwangs in a single episode of Emmerdale.",
"In India, it is traditional to shout out \"Numberwang!\" instead of checkmate during games of chess.",
"There is a rule on Countdown which states that if you get Numberwang in the numbers round, you automatically win. It has only ever been invoked twice.",
"\"Numberwang\" was the third-most common baby name for a brief period in 1722.",
"\"The Lion King\" was loosely based on Numberwang.",
"\"A Numberwang a day keeps the doctor away\" is how Donny Cosy, the oldest man in the world, explained how he was in such good health at the age of 136.",
"The \"number lock\" button on a keyboard is based on the popular round of the same name in \"Numberwang\".",
"Cambridge became the first university to offer a course in Numberwang in 1567.",
"Schrödinger's Numberwang is a number that has been confusing dentists for centuries.",
"\"Harry Potter and the Numberwang of Numberwang\" was rejected by publishers -41 times before it became a bestseller.",
"\"Numberwang\" is the longest-running British game show in history; it has aired 226 seasons, each containing 19 episodes, which makes a grand total of 132 episodes.",
"The triple Numberwang bonus was discovered by archaeologist Thomas Jefferson in Somerset.",
"Numberwang is illegal in parts of Czechoslovakia.",
"Numberwang was discovered in India in the 12th century.",
"Numberwang has the chemical formula Zn4SO2(HgEs)3.",
"The first pack of cards ever created featured two \"Numberwang\" cards instead of jokers.",
"Julius Caesar was killed by an overdose of Numberwang.",
"The most Numberwang musical note is G#.",
"In 1934, the forty-third Google Doodle promoted the upcoming television show \"Numberwang on Ice\".",
"A recent psychology study found that toddlers were 17% faster at identifying numbers which were Numberwang.",
"There are 700 ways to commit a foul in the television show \"Numberwang\". All 700 of these fouls were committed by Julie in one single episode in 1473.",
"Astronomers suspect God is Numberwang.",
"Numberwang is the official beverage of Canada.",
"In the pilot episode of \"The Price is Right\", if a contestant got the value of an item exactly right they were told \"That's Numberwang!\" and immediately won ₹5.7032.",
"The first person to get three Numberwangs in a row was Madonna.",
"\"Numberwang\" has the code U+46402 in Unicode.",
"The musical note \"Numberwang\" is between D# and E♮.",
"Numberwang was first played on the moon in 1834.",
],
};
export default Numberwang;

View File

@@ -1,6 +1,7 @@
import otp from "otp";
import Base64 from "./Base64.js";
/**
* One-Time Password operations.
*

View File

@@ -529,7 +529,7 @@ App.prototype.setCompileMessage = function() {
/**
* Determines whether the browser supports Local Storage and if it is accessible.
*
*
* @returns {boolean}
*/
App.prototype.isLocalStorageAvailable = function() {

View File

@@ -27,6 +27,7 @@ import "./tests/operations/MorseCode.js";
import "./tests/operations/MS.js";
import "./tests/operations/PHP.js";
import "./tests/operations/NetBIOS.js";
import "./tests/operations/OTP.js";
import "./tests/operations/StrUtils.js";
import "./tests/operations/SeqUtils.js";

View File

@@ -310,4 +310,26 @@ TestRegister.addTests([
}
],
},
{
name: "CSS selector",
input: '<div id="test">\n<p class="a">hello</p>\n<p>world</p>\n<p class="a">again</p>\n</div>',
expectedOutput: '<p class="a">hello</p>\n<p class="a">again</p>',
recipeConfig: [
{
"op": "CSS selector",
"args": ["#test p.a", "\\n"]
}
]
},
{
name: "XPath expression",
input: '<div id="test">\n<p class="a">hello</p>\n<p>world</p>\n<p class="a">again</p>\n</div>',
expectedOutput: '<p class="a">hello</p>\n<p class="a">again</p>',
recipeConfig: [
{
"op": "XPath expression",
"args": ["/div/p[@class=\"a\"]", "\\n"]
}
]
}
]);

View File

@@ -0,0 +1,23 @@
/**
* OTP HOTP tests.
*
* @author bwhitn [brian.m.whitney@outlook.com]
*
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister.js";
TestRegister.addTests([
{
name: "Generate HOTP",
input: "12345678901234567890",
expectedOutput: "URI: otpauth://hotp/OTPAuthentication?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ\n\nPassword: 755224",
recipeConfig: [
{
op: "Generate HOTP",
args: ["", 32, 6, 0],
},
],
},
]);