2
0
mirror of https://github.com/gchq/CyberChef synced 2026-01-02 16:43:22 +00:00

Compare commits

..

15 Commits

Author SHA1 Message Date
n1474335
a177e2ab7e 7.7.5 2018-02-21 11:24:46 +00:00
n1474335
8cef6db482 Added IPv6 interface IDs to the 'Format MAC address' operation 2018-02-21 11:24:38 +00:00
n1474335
79a3128491 Changed fragment to query in sitemap 2018-02-20 17:39:46 +00:00
n1474335
cb1fe80214 Added robots meta tag to inline version to prevent indexing. 2018-02-20 17:34:19 +00:00
n1474335
19f2e6dae0 Fixed robots.txt copy 2018-02-20 17:15:06 +00:00
n1474335
74394a773d Fixed URL in sitemap 2018-02-20 17:09:02 +00:00
n1474335
d491e95d1c 7.7.4 2018-02-20 17:04:47 +00:00
n1474335
881523ce54 Merge branch 'sitemap' 2018-02-20 17:04:34 +00:00
n1474335
502a9fbb92 Added dynamically generated sitemap and robots.txt file to prevent crawling of inline version 2018-02-20 16:52:27 +00:00
n1474335
cc44fe6557 7.7.3 2018-02-16 13:33:41 +00:00
n1474335
5b1ac3de18 Reduced byte length in 'Unescape Unicode Characters' 2018-02-16 13:33:33 +00:00
n1474335
5a2a649d8e 7.7.2 2018-02-15 13:41:17 +00:00
n1474335
1aef193b40 Fixed file loading error message 2018-02-15 13:41:13 +00:00
n1474335
750fa45c04 7.7.1 2018-02-14 10:34:14 +00:00
n1474335
50f2819699 OR now calls the correct function instead of duplicating XOR. Closes #243. 2018-02-14 10:34:08 +00:00
12 changed files with 97 additions and 26 deletions

View File

@@ -11,6 +11,7 @@ script:
- grunt node
- grunt prod --msg="$COMPILE_MSG"
before_deploy:
- grunt exec:sitemap
- grunt copy:ghPages
deploy:
- provider: pages

View File

@@ -218,7 +218,8 @@ module.exports = function (grunt) {
web: {
target: "web",
entry: Object.assign({
main: "./src/web/index.js"
main: "./src/web/index.js",
sitemap: "./src/web/static/sitemap.js"
}, moduleEntryPoints),
output: {
path: __dirname + "/build/prod"
@@ -377,7 +378,7 @@ module.exports = function (grunt) {
expand: true,
src: "docs/**",
dest: "build/prod/"
}
},
]
}
},
@@ -406,6 +407,9 @@ module.exports = function (grunt) {
cleanGit: {
command: "git gc --prune=now --aggressive"
},
sitemap: {
command: "node build/prod/sitemap.js > build/prod/sitemap.xml"
}
},
execute: {
test: "build/test/index.js"

18
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "cyberchef",
"version": "7.7.0",
"version": "7.7.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -9566,6 +9566,16 @@
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"dev": true
},
"sitemap": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/sitemap/-/sitemap-1.13.0.tgz",
"integrity": "sha1-Vpy+IYAgKSamKiZs094Jyc60P4M=",
"dev": true,
"requires": {
"underscore": "1.7.0",
"url-join": "1.1.0"
}
},
"sladex-blowfish": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/sladex-blowfish/-/sladex-blowfish-0.8.1.tgz",
@@ -10726,6 +10736,12 @@
}
}
},
"url-join": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz",
"integrity": "sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg=",
"dev": true
},
"url-loader": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/url-loader/-/url-loader-0.6.2.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "cyberchef",
"version": "7.7.0",
"version": "7.7.5",
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
"author": "n1474335 <n1474335@gmail.com>",
"homepage": "https://gchq.github.io/CyberChef",
@@ -58,6 +58,7 @@
"postcss-css-variables": "^0.8.0",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.10",
"sitemap": "^1.13.0",
"style-loader": "^0.19.1",
"url-loader": "^0.6.2",
"val-loader": "^1.1.0",

View File

@@ -1825,6 +1825,11 @@ const OperationConfig = {
name: "Cisco style",
type: "boolean",
value: MAC.CISCO_STYLE
},
{
name: "IPv6 interface ID",
type: "boolean",
value: MAC.IPV6_INTERFACE_ID
}
]
},

View File

@@ -92,7 +92,7 @@ OpModules.Default = {
"Bit shift right": BitwiseOp.runBitShiftRight,
"XOR": BitwiseOp.runXor,
"XOR Brute Force": BitwiseOp.runXorBrute,
"OR": BitwiseOp.runXor,
"OR": BitwiseOp.runOr,
"NOT": BitwiseOp.runNot,
"AND": BitwiseOp.runAnd,
"ADD": BitwiseOp.runAdd,

View File

@@ -34,6 +34,11 @@ const MAC = {
* @default
*/
CISCO_STYLE: false,
/**
* @constant
* @default
*/
IPV6_INTERFACE_ID: false,
/**
* Format MAC addresses operation.
@@ -50,6 +55,7 @@ const MAC = {
dashDelim = args[2],
colonDelim = args[3],
ciscoStyle = args[4],
ipv6IntID = args[5],
outputList = [],
macs = input.toLowerCase().split(/[,\s\r\n]+/);
@@ -57,23 +63,32 @@ const MAC = {
let cleanMac = mac.replace(/[:.-]+/g, ""),
macHyphen = cleanMac.replace(/(.{2}(?=.))/g, "$1-"),
macColon = cleanMac.replace(/(.{2}(?=.))/g, "$1:"),
macCisco = cleanMac.replace(/(.{4}(?=.))/g, "$1.");
macCisco = cleanMac.replace(/(.{4}(?=.))/g, "$1."),
macIPv6 = cleanMac.slice(0, 6) + "fffe" + cleanMac.slice(6);
macIPv6 = macIPv6.replace(/(.{4}(?=.))/g, "$1:");
let bite = parseInt(macIPv6.slice(0, 2), 16) ^ 2;
bite = bite.toString(16).padStart(2, "0");
macIPv6 = bite + macIPv6.slice(2);
if (outputCase === "Lower only") {
if (noDelim) outputList.push(cleanMac);
if (dashDelim) outputList.push(macHyphen);
if (colonDelim) outputList.push(macColon);
if (ciscoStyle) outputList.push(macCisco);
if (ipv6IntID) outputList.push(macIPv6);
} else if (outputCase === "Upper only") {
if (noDelim) outputList.push(cleanMac.toUpperCase());
if (dashDelim) outputList.push(macHyphen.toUpperCase());
if (colonDelim) outputList.push(macColon.toUpperCase());
if (ciscoStyle) outputList.push(macCisco.toUpperCase());
if (ipv6IntID) outputList.push(macIPv6.toUpperCase());
} else {
if (noDelim) outputList.push(cleanMac, cleanMac.toUpperCase());
if (dashDelim) outputList.push(macHyphen, macHyphen.toUpperCase());
if (colonDelim) outputList.push(macColon, macColon.toUpperCase());
if (ciscoStyle) outputList.push(macCisco, macCisco.toUpperCase());
if (ipv6IntID) outputList.push(macIPv6, macIPv6.toUpperCase());
}
outputList.push(

View File

@@ -27,7 +27,7 @@ const Unicode = {
*/
runUnescape: function(input, args) {
let prefix = Unicode._prefixToRegex[args[0]],
regex = new RegExp(prefix+"([a-f\\d]{4,6})", "ig"),
regex = new RegExp(prefix+"([a-f\\d]{4})", "ig"),
output = "",
m,
i = 0;

View File

@@ -377,6 +377,7 @@ App.prototype.loadURIParams = function() {
window.location.href.split("#")[1] ||
window.location.hash;
this.uriParams = Utils.parseURIParams(params);
this.autoBakePause = true;
// Read in recipe from URI params
if (this.uriParams.recipe) {
@@ -387,35 +388,29 @@ App.prototype.loadURIParams = function() {
} else if (this.uriParams.op) {
// If there's no recipe, look for single operations
this.manager.recipe.clearRecipe();
try {
this.manager.recipe.addOperation(this.uriParams.op);
} catch (err) {
// If no exact match, search for nearest match and add that
const matchedOps = this.manager.ops.filterOperations(this.uriParams.op, false);
if (matchedOps.length) {
this.manager.recipe.addOperation(matchedOps[0].name);
}
// Populate search with the string
const search = document.getElementById("search");
search.value = this.uriParams.op;
search.dispatchEvent(new Event("search"));
// Search for nearest match and add it
const matchedOps = this.manager.ops.filterOperations(this.uriParams.op, false);
if (matchedOps.length) {
this.manager.recipe.addOperation(matchedOps[0].name);
}
// Populate search with the string
const search = document.getElementById("search");
search.value = this.uriParams.op;
search.dispatchEvent(new Event("search"));
}
// Read in input data from URI params
if (this.uriParams.input) {
this.autoBakePause = true;
try {
const inputData = Utils.fromBase64(this.uriParams.input);
this.setInput(inputData);
} catch (err) {
} finally {
this.autoBakePause = false;
}
} catch (err) {}
}
this.autoBakePause = false;
this.autoBake();
};

View File

@@ -47,7 +47,7 @@ self.loadFile = function(file) {
};
reader.onerror = function(e) {
self.postMessage({"error": file.error.message});
self.postMessage({"error": reader.error.message});
};
seek();

View File

@@ -88,6 +88,7 @@
window.loadingMsgsInt = setInterval(changeLoadingMsg, (Math.random() * 2000) + 1500);
</script>
<% if (!htmlWebpackPlugin.options.inline) { %>
<meta name="robots" content="noindex" />
<script type="application/ld+json">
<% print(JSON.stringify(require("../static/structuredData.json"))); %>
</script>

33
src/web/static/sitemap.js Normal file
View File

@@ -0,0 +1,33 @@
import sm from "sitemap";
import OperationConfig from "../../core/config/MetaConfig.js";
/**
* Generates an XML sitemap for all CyberChef operations and a number of recipes.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
const sitemap = sm.createSitemap({
hostname: "https://gchq.github.io/CyberChef",
});
sitemap.add({
url: "/",
changefreq: "weekly",
priority: 1.0
});
for (let op in OperationConfig) {
sitemap.add({
url: `/?op=${encodeURIComponent(op)}`,
changeFreq: "yearly",
priority: 0.5
});
}
const xml = sitemap.toString();
console.log(xml); // eslint-disable-line no-console