Merge branch 'master' into feature/bombe

This commit is contained in:
s2224834 2019-02-28 16:29:21 +00:00
commit a037bf6f9d
50 changed files with 2361 additions and 448 deletions

View file

@ -45,7 +45,6 @@ import "./tests/DateTime";
import "./tests/ExtractEmailAddresses";
import "./tests/Fork";
import "./tests/FromDecimal";
import "./tests/FromGeohash";
import "./tests/Hash";
import "./tests/HaversineDistance";
import "./tests/Hexdump";
@ -77,11 +76,13 @@ import "./tests/SetUnion";
import "./tests/StrUtils";
import "./tests/SymmetricDifference";
import "./tests/TextEncodingBruteForce";
import "./tests/ToGeohash";
import "./tests/TranslateDateTimeFormat";
import "./tests/Magic";
import "./tests/ParseTLV";
import "./tests/Media";
import "./tests/ToFromInsensitiveRegex";
import "./tests/YARA.mjs";
import "./tests/ConvertCoordinateFormat";
import "./tests/Enigma";
import "./tests/Bombe";
import "./tests/MultipleBombe";

View file

@ -0,0 +1,211 @@
/**
* Convert co-ordinate format tests
*
* @author j433866
*
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
/**
* TEST CO-ORDINATES
* DD: 51.504°,-0.126°,
* DDM: 51° 30.24',-0° 7.56',
* DMS: 51° 30' 14.4",-0° 7' 33.6",
* Geohash: gcpvj0h0x,
* MGRS: 30U XC 99455 09790,
* OSNG: TQ 30163 80005,
* UTM: 30N 699456 5709791,
*/
import TestRegister from "../TestRegister";
TestRegister.addTests([
{
name: "Co-ordinates: From Decimal Degrees to Degrees Minutes Seconds",
input: "51.504°,-0.126°,",
expectedOutput: "51° 30' 14.4\",-0° 7' 33.6\",",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Degrees Minutes Seconds", "Comma", "None", 1]
},
],
},
{
name: "Co-ordinates: From Degrees Minutes Seconds to Decimal Degrees",
input: "51° 30' 14.4\",-0° 7' 33.6\",",
expectedOutput: "51.504°,-0.126°,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Degrees Minutes Seconds", "Comma", "Decimal Degrees", "Comma", "None", 3]
},
],
},
{
name: "Co-ordinates: From Decimal Degrees to Degrees Decimal Minutes",
input: "51.504°,-0.126°,",
expectedOutput: "51° 30.24',-0° 7.56',",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Degrees Decimal Minutes", "Comma", "None", 2]
}
]
},
{
name: "Co-ordinates: From Degrees Decimal Minutes to Decimal Degrees",
input: "51° 30.24',-0° 7.56',",
expectedOutput: "51.504°,-0.126°,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Degrees Decimal Minutes", "Comma", "Decimal Degrees", "Comma", "None", 3]
}
]
},
{
name: "Co-ordinates: From Decimal Degrees to Decimal Degrees",
input: "51.504°,-0.126°,",
expectedOutput: "51.504°,-0.126°,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "None", 3]
}
]
},
{
name: "Co-ordinates: From Decimal Degrees to Geohash",
input: "51.504°,-0.126°,",
expectedOutput: "gcpvj0h0x,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Geohash", "Comma", "None", 9]
},
],
},
{
name: "Co-ordinates: From Geohash to Decimal Degrees",
input: "gcpvj0h0x,",
expectedOutput: "51.504°,-0.126°,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Geohash", "Comma", "Decimal Degrees", "Comma", "None", 3]
},
],
},
{
name: "Co-ordinates: From Decimal Degrees to MGRS",
input: "51.504°,-0.126°,",
expectedOutput: "30U XC 99455 09790,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Military Grid Reference System", "Comma", "None", 10]
},
],
},
{
name: "Co-ordinates: From MGRS to Decimal Degrees",
input: "30U XC 99455 09790,",
expectedOutput: "51.504°,-0.126°,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Military Grid Reference System", "Comma", "Decimal Degrees", "Comma", "None", 3]
}
]
},
{
name: "Co-ordinates: From Decimal Degrees to OSNG",
input: "51.504°,-0.126°,",
expectedOutput: "TQ 30163 80005,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Ordnance Survey National Grid", "Comma", "None", 10]
},
],
},
{
name: "Co-ordinates: From OSNG to Decimal Degrees",
input: "TQ 30163 80005,",
expectedOutput: "51.504°,-0.126°,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Ordnance Survey National Grid", "Comma", "Decimal Degrees", "Comma", "None", 3]
},
],
},
{
name: "Co-ordinates: From Decimal Degrees to UTM",
input: "51.504°,-0.126°,",
expectedOutput: "30 N 699456 5709791,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Universal Transverse Mercator", "Comma", "None", 0]
},
],
},
{
name: "Co-ordinates: From UTM to Decimal Degrees",
input: "30 N 699456 5709791,",
expectedOutput: "51.504°,-0.126°,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Universal Transverse Mercator", "Comma", "Decimal Degrees", "Comma", "None", 3]
},
],
},
{
name: "Co-ordinates: Directions in input, not output",
input: "N51.504°,W0.126°,",
expectedOutput: "51.504°,-0.126°,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "None", 3]
},
],
},
{
name: "Co-ordinates: Directions in input and output",
input: "N51.504°,W0.126°,",
expectedOutput: "N 51.504°,W 0.126°,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "Before", 3]
},
],
},
{
name: "Co-ordinates: Directions not in input, in output",
input: "51.504°,-0.126°,",
expectedOutput: "N 51.504°,W 0.126°,",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "Before", 3]
},
],
},
{
name: "Co-ordinates: Directions not in input, in converted output",
input: "51.504°,-0.126°,",
expectedOutput: "N 51° 30' 14.4\",W 0° 7' 33.6\",",
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Degrees Minutes Seconds", "Comma", "Before", 3]
},
],
}
]);

View file

@ -1,55 +0,0 @@
/**
* To Geohash tests
*
* @author gchq77703
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../TestRegister";
TestRegister.addTests([
{
name: "From Geohash",
input: "ww8p1r4t8",
expectedOutput: "37.83238649368286,112.55838632583618",
recipeConfig: [
{
op: "From Geohash",
args: [],
},
],
},
{
name: "From Geohash",
input: "ww8p1r",
expectedOutput: "37.83416748046875,112.5604248046875",
recipeConfig: [
{
op: "From Geohash",
args: [],
},
],
},
{
name: "From Geohash",
input: "ww8",
expectedOutput: "37.265625,113.203125",
recipeConfig: [
{
op: "From Geohash",
args: [],
},
],
},
{
name: "From Geohash",
input: "w",
expectedOutput: "22.5,112.5",
recipeConfig: [
{
op: "From Geohash",
args: [],
},
],
},
]);

View file

@ -0,0 +1,56 @@
/**
* To/From Case Insensitive Regex tests.
*
* @author masq [github.cyberchef@masq.cc]
*
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../TestRegister";
TestRegister.addTests([
{
name: "To Case Insensitive Regex: nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{
op: "To Case Insensitive Regex",
args: [],
},
],
},
{
name: "From Case Insensitive Regex: nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{
op: "From Case Insensitive Regex",
args: [],
},
],
},
{
name: "To Case Insensitive Regex: simple test",
input: "S0meth!ng",
expectedOutput: "[sS]0[mM][eE][tT][hH]![nN][gG]",
recipeConfig: [
{
op: "To Case Insensitive Regex",
args: [],
},
],
},
{
name: "From Case Insensitive Regex: simple test",
input: "[sS]0[mM][eE][tT][hH]![nN][Gg] [wr][On][g]?",
expectedOutput: "s0meth!nG [wr][On][g]?",
recipeConfig: [
{
op: "From Case Insensitive Regex",
args: [],
},
],
},
]);

View file

@ -1,55 +0,0 @@
/**
* To Geohash tests
*
* @author gchq77703
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../TestRegister";
TestRegister.addTests([
{
name: "To Geohash",
input: "37.8324,112.5584",
expectedOutput: "ww8p1r4t8",
recipeConfig: [
{
op: "To Geohash",
args: [9],
},
],
},
{
name: "To Geohash",
input: "37.9324,-112.2584",
expectedOutput: "9w8pv3ruj",
recipeConfig: [
{
op: "To Geohash",
args: [9],
},
],
},
{
name: "To Geohash",
input: "37.8324,112.5584",
expectedOutput: "ww8",
recipeConfig: [
{
op: "To Geohash",
args: [3],
},
],
},
{
name: "To Geohash",
input: "37.9324,-112.2584",
expectedOutput: "9w8pv3rujxy5b99",
recipeConfig: [
{
op: "To Geohash",
args: [15],
},
],
},
]);

View file

@ -0,0 +1,24 @@
/**
* YARA Rules tests.
*
* @author Matt C [matt@artemisbot.uk]
*
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import TestRegister from "../TestRegister";
TestRegister.addTests([
{
name: "YARA Match: simple foobar",
input: "foobar foobar bar foo foobar",
expectedOutput: "Rule \"foo\" matches (4 times):\nPos 0, length 3, identifier $re1, data: \"foo\"\nPos 7, length 3, identifier $re1, data: \"foo\"\nPos 18, length 3, identifier $re1, data: \"foo\"\nPos 22, length 3, identifier $re1, data: \"foo\"\nRule \"bar\" matches (4 times):\nPos 3, length 3, identifier $re1, data: \"bar\"\nPos 10, length 3, identifier $re1, data: \"bar\"\nPos 14, length 3, identifier $re1, data: \"bar\"\nPos 25, length 3, identifier $re1, data: \"bar\"\n",
recipeConfig: [
{
"op": "YARA Rules",
"args": ["rule foo {strings: $re1 = /foo/ condition: $re1} rule bar {strings: $re1 = /bar/ condition: $re1}", true, true, true, true],
}
],
},
]);