Added module framework
This commit is contained in:
parent
9f19afc943
commit
a61cf6a68a
30
Gruntfile.js
30
Gruntfile.js
@ -1,6 +1,7 @@
|
||||
const webpack = require("webpack");
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const Inliner = require("web-resource-inliner");
|
||||
const fs = require("fs");
|
||||
|
||||
/**
|
||||
* Grunt configuration for building the app in various formats.
|
||||
@ -68,7 +69,8 @@ module.exports = function (grunt) {
|
||||
COMPILE_TIME: JSON.stringify(compileTime),
|
||||
COMPILE_MSG: JSON.stringify(grunt.option("compile-msg") || grunt.option("msg") || ""),
|
||||
PKG_VERSION: JSON.stringify(pkg.version)
|
||||
};
|
||||
},
|
||||
moduleEntryPoints = listEntryModules();
|
||||
|
||||
/**
|
||||
* Compiles a production build of CyberChef into a single, portable web page.
|
||||
@ -97,6 +99,21 @@ module.exports = function (grunt) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an entry list for all the modules.
|
||||
*/
|
||||
function listEntryModules() {
|
||||
const path = "./src/core/config/modules/";
|
||||
let entryModules = {};
|
||||
|
||||
fs.readdirSync(path).forEach(file => {
|
||||
if (file !== "Default.js")
|
||||
entryModules[file.split(".js")[0]] = path + file;
|
||||
});
|
||||
|
||||
return entryModules;
|
||||
}
|
||||
|
||||
grunt.initConfig({
|
||||
clean: {
|
||||
dev: ["build/dev/*"],
|
||||
@ -146,7 +163,9 @@ module.exports = function (grunt) {
|
||||
options: webpackConfig,
|
||||
web: {
|
||||
target: "web",
|
||||
entry: "./src/web/index.js",
|
||||
entry: Object.assign({
|
||||
main: "./src/web/index.js"
|
||||
}, moduleEntryPoints),
|
||||
output: {
|
||||
filename: "scripts.js",
|
||||
path: __dirname + "/build/prod"
|
||||
@ -165,6 +184,7 @@ module.exports = function (grunt) {
|
||||
new HtmlWebpackPlugin({ // Main version
|
||||
filename: "index.html",
|
||||
template: "./src/web/html/index.html",
|
||||
chunks: ["main"],
|
||||
compileTime: compileTime,
|
||||
version: pkg.version,
|
||||
minify: {
|
||||
@ -177,6 +197,7 @@ module.exports = function (grunt) {
|
||||
new HtmlWebpackPlugin({ // Inline version
|
||||
filename: "cyberchef.htm",
|
||||
template: "./src/web/html/index.html",
|
||||
chunks: ["main"],
|
||||
compileTime: compileTime,
|
||||
version: pkg.version,
|
||||
inline: true,
|
||||
@ -219,12 +240,15 @@ module.exports = function (grunt) {
|
||||
start: {
|
||||
webpack: {
|
||||
target: "web",
|
||||
entry: "./src/web/index.js",
|
||||
entry: Object.assign({
|
||||
main: "./src/web/index.js"
|
||||
}, moduleEntryPoints),
|
||||
plugins: [
|
||||
new webpack.DefinePlugin(BUILD_CONSTANTS),
|
||||
new HtmlWebpackPlugin({
|
||||
filename: "index.html",
|
||||
template: "./src/web/html/index.html",
|
||||
chunks: ["main"],
|
||||
compileTime: compileTime,
|
||||
version: pkg.version,
|
||||
})
|
||||
|
@ -8,9 +8,13 @@
|
||||
|
||||
import "babel-polyfill";
|
||||
import Chef from "./Chef.js";
|
||||
import OperationConfig from "value-loader?name=conf!./config/OperationConfig.js";
|
||||
import OpModules from "./config/modules/Default.js";
|
||||
|
||||
|
||||
// Set up Chef instance
|
||||
self.chef = new Chef();
|
||||
self.OpModules = OpModules;
|
||||
|
||||
// Tell the app that the worker has loaded and is ready to operate
|
||||
self.postMessage({
|
||||
@ -50,8 +54,13 @@ self.addEventListener("message", function(e) {
|
||||
|
||||
/**
|
||||
* Baking handler
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
async function bake(data) {
|
||||
// Ensure the relevant modules are loaded
|
||||
loadRequiredModules(data.recipeConfig);
|
||||
|
||||
try {
|
||||
const response = await self.chef.bake(
|
||||
data.input, // The user's input
|
||||
@ -68,7 +77,7 @@ async function bake(data) {
|
||||
} catch (err) {
|
||||
self.postMessage({
|
||||
action: "bakeError",
|
||||
data: err
|
||||
data: err.message
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -85,3 +94,20 @@ function silentBake(data) {
|
||||
data: duration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks that all required modules are loaded and loads them if not.
|
||||
*
|
||||
* @param {Object} recipeConfig
|
||||
*/
|
||||
function loadRequiredModules(recipeConfig) {
|
||||
recipeConfig.forEach(op => {
|
||||
let module = OperationConfig[op.op].module;
|
||||
|
||||
if (!OpModules.hasOwnProperty(module)) {
|
||||
console.log("Loading module " + module);
|
||||
self.importScripts(module + ".js");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -13,22 +13,6 @@ import Dish from "./Dish.js";
|
||||
*/
|
||||
const FlowControl = {
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
FORK_DELIM: "\\n",
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
MERGE_DELIM: "\\n",
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
FORK_IGNORE_ERRORS: false,
|
||||
|
||||
/**
|
||||
* Fork operation.
|
||||
*
|
||||
@ -106,17 +90,6 @@ const FlowControl = {
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
JUMP_NUM: 0,
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
MAX_JUMPS: 10,
|
||||
|
||||
/**
|
||||
* Jump operation.
|
||||
*
|
||||
|
@ -1,5 +1,7 @@
|
||||
import Dish from "./Dish.js";
|
||||
import Ingredient from "./Ingredient.js";
|
||||
import OperationConfig from "value-loader?name=conf!./config/OperationConfig.js";
|
||||
import OpModules from "./config/modules/Default.js";
|
||||
|
||||
|
||||
/**
|
||||
@ -11,10 +13,10 @@ import Ingredient from "./Ingredient.js";
|
||||
*
|
||||
* @class
|
||||
* @param {string} operationName
|
||||
* @param {Object} operationConfig
|
||||
*/
|
||||
const Operation = function(operationName, operationConfig) {
|
||||
const Operation = function(operationName) {
|
||||
this.name = operationName;
|
||||
this.module = "";
|
||||
this.description = "";
|
||||
this.inputType = -1;
|
||||
this.outputType = -1;
|
||||
@ -25,8 +27,8 @@ const Operation = function(operationName, operationConfig) {
|
||||
this.disabled = false;
|
||||
this.ingList = [];
|
||||
|
||||
if (operationConfig) {
|
||||
this._parseConfig(operationConfig);
|
||||
if (OperationConfig.hasOwnProperty(this.name)) {
|
||||
this._parseConfig(OperationConfig[this.name]);
|
||||
}
|
||||
};
|
||||
|
||||
@ -38,13 +40,14 @@ const Operation = function(operationName, operationConfig) {
|
||||
* @param {Object} operationConfig
|
||||
*/
|
||||
Operation.prototype._parseConfig = function(operationConfig) {
|
||||
this.module = operationConfig.module;
|
||||
this.description = operationConfig.description;
|
||||
this.inputType = Dish.typeEnum(operationConfig.inputType);
|
||||
this.outputType = Dish.typeEnum(operationConfig.outputType);
|
||||
this.run = operationConfig.run;
|
||||
this.highlight = operationConfig.highlight;
|
||||
this.highlightReverse = operationConfig.highlightReverse;
|
||||
this.flowControl = operationConfig.flowControl;
|
||||
this.run = OpModules[this.module][this.name];
|
||||
|
||||
for (let a = 0; a < operationConfig.args.length; a++) {
|
||||
const ingredientConfig = operationConfig.args[a];
|
||||
|
@ -1,5 +1,4 @@
|
||||
import Operation from "./Operation.js";
|
||||
import OperationConfig from "./config/OperationConfig.js";
|
||||
|
||||
|
||||
/**
|
||||
@ -30,8 +29,7 @@ const Recipe = function(recipeConfig) {
|
||||
Recipe.prototype._parseConfig = function(recipeConfig) {
|
||||
for (let c = 0; c < recipeConfig.length; c++) {
|
||||
const operationName = recipeConfig[c].op;
|
||||
const operationConfig = OperationConfig[operationName];
|
||||
const operation = new Operation(operationName, operationConfig);
|
||||
const operation = new Operation(operationName);
|
||||
operation.setIngValues(recipeConfig[c].args);
|
||||
operation.setBreakpoint(recipeConfig[c].breakpoint);
|
||||
operation.setDisabled(recipeConfig[c].disabled);
|
||||
|
@ -1,23 +0,0 @@
|
||||
/**
|
||||
* Re-exports OperationConfig in value-loader format without the run function
|
||||
* allowing the web app to access metadata about operations without having to
|
||||
* import all the dependencies.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import "babel-regenerator-runtime";
|
||||
import Utils from "../Utils.js";
|
||||
import OperationConfig from "./OperationConfig.js";
|
||||
|
||||
|
||||
// Remove the run function from each operation config
|
||||
for (let opConf in OperationConfig) {
|
||||
delete OperationConfig[opConf].run;
|
||||
}
|
||||
|
||||
// Export a string version of the meta config so that it can be imported using
|
||||
// value-loader without any of the dependencies.
|
||||
export default "module.exports = " + JSON.stringify(OperationConfig) + ";";
|
File diff suppressed because it is too large
Load Diff
22
src/core/config/modules/CharEnc.js
Normal file
22
src/core/config/modules/CharEnc.js
Normal file
@ -0,0 +1,22 @@
|
||||
import CharEnc from "../../operations/CharEnc.js";
|
||||
|
||||
|
||||
/**
|
||||
* CharEnc module.
|
||||
*
|
||||
* Libraries:
|
||||
* - cptable
|
||||
* - CryptoJS
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.CharEnc = {
|
||||
"Encode text": CharEnc.runEncode,
|
||||
"Decode text": CharEnc.runDecode,
|
||||
};
|
||||
|
||||
export default OpModules;
|
42
src/core/config/modules/Ciphers.js
Normal file
42
src/core/config/modules/Ciphers.js
Normal file
@ -0,0 +1,42 @@
|
||||
import Cipher from "../../operations/Cipher.js";
|
||||
|
||||
|
||||
/**
|
||||
* Ciphers module.
|
||||
*
|
||||
* Libraries:
|
||||
* - CryptoJS
|
||||
* - Blowfish
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.Ciphers = {
|
||||
"AES Encrypt": Cipher.runAesEnc,
|
||||
"AES Decrypt": Cipher.runAesDec,
|
||||
"Blowfish Encrypt": Cipher.runBlowfishEnc,
|
||||
"Blowfish Decrypt": Cipher.runBlowfishDec,
|
||||
"DES Encrypt": Cipher.runDesEnc,
|
||||
"DES Decrypt": Cipher.runDesDec,
|
||||
"Triple DES Encrypt": Cipher.runTripleDesEnc,
|
||||
"Triple DES Decrypt": Cipher.runTripleDesDec,
|
||||
"Rabbit Encrypt": Cipher.runRabbitEnc,
|
||||
"Rabbit Decrypt": Cipher.runRabbitDec,
|
||||
"Derive PBKDF2 key": Cipher.runPbkdf2,
|
||||
"Derive EVP key": Cipher.runEvpkdf,
|
||||
"RC4": Cipher.runRc4,
|
||||
"RC4 Drop": Cipher.runRc4drop,
|
||||
"Vigenère Encode": Cipher.runVigenereEnc,
|
||||
"Vigenère Decode": Cipher.runVigenereDec,
|
||||
"Bifid Cipher Encode": Cipher.runBifidEnc,
|
||||
"Bifid Cipher Decode": Cipher.runBifidDec,
|
||||
"Affine Cipher Encode": Cipher.runAffineEnc,
|
||||
"Affine Cipher Decode": Cipher.runAffineDec,
|
||||
"Atbash Cipher": Cipher.runAtbash,
|
||||
"Substitute": Cipher.runSubstitute,
|
||||
};
|
||||
|
||||
export default OpModules;
|
42
src/core/config/modules/Code.js
Normal file
42
src/core/config/modules/Code.js
Normal file
@ -0,0 +1,42 @@
|
||||
import JS from "../../operations/JS.js";
|
||||
import Code from "../../operations/Code.js";
|
||||
|
||||
|
||||
/**
|
||||
* Code module.
|
||||
*
|
||||
* Libraries:
|
||||
* - lodash
|
||||
* - vkbeautify
|
||||
* - xmldom
|
||||
* - xpath
|
||||
* - googlecodeprettify
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.Code = {
|
||||
"JavaScript Parser": JS.runParse,
|
||||
"JavaScript Beautify": JS.runBeautify,
|
||||
"JavaScript Minify": JS.runMinify,
|
||||
"Syntax highlighter": Code.runSyntaxHighlight,
|
||||
"Generic Code Beautify": Code.runGenericBeautify,
|
||||
"JSON Beautify": Code.runJsonBeautify,
|
||||
"JSON Minify": Code.runJsonMinify,
|
||||
"XML Beautify": Code.runXmlBeautify,
|
||||
"XML Minify": Code.runXmlMinify,
|
||||
"SQL Beautify": Code.runSqlBeautify,
|
||||
"SQL Minify": Code.runSqlMinify,
|
||||
"CSS Beautify": Code.runCssBeautify,
|
||||
"CSS Minify": Code.runCssMinify,
|
||||
"XPath expression": Code.runXpath,
|
||||
"CSS selector": Code.runCSSQuery,
|
||||
"To Snake case": Code.runToSnakeCase,
|
||||
"To Camel case": Code.runToCamelCase,
|
||||
"To Kebab case": Code.runToKebabCase,
|
||||
};
|
||||
|
||||
export default OpModules;
|
32
src/core/config/modules/Compression.js
Normal file
32
src/core/config/modules/Compression.js
Normal file
@ -0,0 +1,32 @@
|
||||
import Compress from "../../operations/Compress.js";
|
||||
|
||||
|
||||
/**
|
||||
* Compression module.
|
||||
*
|
||||
* Libraries:
|
||||
* - zlib.js
|
||||
* - bzip2.js
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.Compression = {
|
||||
"Raw Deflate": Compress.runRawDeflate,
|
||||
"Raw Inflate": Compress.runRawInflate,
|
||||
"Zlib Deflate": Compress.runZlibDeflate,
|
||||
"Zlib Inflate": Compress.runZlibInflate,
|
||||
"Gzip": Compress.runGzip,
|
||||
"Gunzip": Compress.runGunzip,
|
||||
"Zip": Compress.runPkzip,
|
||||
"Unzip": Compress.runPkunzip,
|
||||
"Bzip2 Decompress": Compress.runBzip2Decompress,
|
||||
"Tar": Compress.runTar,
|
||||
"Untar": Compress.runUntar,
|
||||
|
||||
};
|
||||
|
||||
export default OpModules;
|
154
src/core/config/modules/Default.js
Normal file
154
src/core/config/modules/Default.js
Normal file
@ -0,0 +1,154 @@
|
||||
import FlowControl from "../../FlowControl.js";
|
||||
import Base from "../../operations/Base.js";
|
||||
import Base58 from "../../operations/Base58.js";
|
||||
import Base64 from "../../operations/Base64.js";
|
||||
import BCD from "../../operations/BCD.js";
|
||||
import BitwiseOp from "../../operations/BitwiseOp.js";
|
||||
import ByteRepr from "../../operations/ByteRepr.js";
|
||||
import Convert from "../../operations/Convert.js";
|
||||
import DateTime from "../../operations/DateTime.js";
|
||||
import Endian from "../../operations/Endian.js";
|
||||
import Entropy from "../../operations/Entropy.js";
|
||||
import Extract from "../../operations/Extract.js";
|
||||
import FileType from "../../operations/FileType.js";
|
||||
import Hexdump from "../../operations/Hexdump.js";
|
||||
import HTML from "../../operations/HTML.js";
|
||||
import MAC from "../../operations/MAC.js";
|
||||
import MorseCode from "../../operations/MorseCode.js";
|
||||
import NetBIOS from "../../operations/NetBIOS.js";
|
||||
import Numberwang from "../../operations/Numberwang.js";
|
||||
import OS from "../../operations/OS.js";
|
||||
import QuotedPrintable from "../../operations/QuotedPrintable.js";
|
||||
import Rotate from "../../operations/Rotate.js";
|
||||
import SeqUtils from "../../operations/SeqUtils.js";
|
||||
import StrUtils from "../../operations/StrUtils.js";
|
||||
import Tidy from "../../operations/Tidy.js";
|
||||
import Unicode from "../../operations/Unicode.js";
|
||||
import URL_ from "../../operations/URL.js";
|
||||
import UUID from "../../operations/UUID.js";
|
||||
|
||||
|
||||
/**
|
||||
* Default module.
|
||||
*
|
||||
* The Default module is for operations that are expected to be very commonly used or
|
||||
* do not require any libraries. This module is loaded into the app at compile time.
|
||||
*
|
||||
* Libraries:
|
||||
* - Utils.js
|
||||
* - CryptoJS
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.Default = {
|
||||
"To Hexdump": Hexdump.runTo,
|
||||
"From Hexdump": Hexdump.runFrom,
|
||||
"To Hex": ByteRepr.runToHex,
|
||||
"From Hex": ByteRepr.runFromHex,
|
||||
"To Octal": ByteRepr.runToOct,
|
||||
"From Octal": ByteRepr.runFromOct,
|
||||
"To Charcode": ByteRepr.runToCharcode,
|
||||
"From Charcode": ByteRepr.runFromCharcode,
|
||||
"To Decimal": ByteRepr.runToDecimal,
|
||||
"From Decimal": ByteRepr.runFromDecimal,
|
||||
"To Binary": ByteRepr.runToBinary,
|
||||
"From Binary": ByteRepr.runFromBinary,
|
||||
"To Hex Content": ByteRepr.runToHexContent,
|
||||
"From Hex Content": ByteRepr.runFromHexContent,
|
||||
"To Base64": Base64.runTo,
|
||||
"From Base64": Base64.runFrom,
|
||||
"Show Base64 offsets": Base64.runOffsets,
|
||||
"To Base32": Base64.runTo32,
|
||||
"From Base32": Base64.runFrom32,
|
||||
"To Base58": Base58.runTo,
|
||||
"From Base58": Base58.runFrom,
|
||||
"To Base": Base.runTo,
|
||||
"From Base": Base.runFrom,
|
||||
"To BCD": BCD.runToBCD,
|
||||
"From BCD": BCD.runFromBCD,
|
||||
"To HTML Entity": HTML.runToEntity,
|
||||
"From HTML Entity": HTML.runFromEntity,
|
||||
"Strip HTML tags": HTML.runStripTags,
|
||||
"Parse colour code": HTML.runParseColourCode,
|
||||
"URL Encode": URL_.runTo,
|
||||
"URL Decode": URL_.runFrom,
|
||||
"Parse URI": URL_.runParse,
|
||||
"Unescape Unicode Characters": Unicode.runUnescape,
|
||||
"To Quoted Printable": QuotedPrintable.runTo,
|
||||
"From Quoted Printable": QuotedPrintable.runFrom,
|
||||
"Swap endianness": Endian.runSwapEndianness,
|
||||
"ROT13": Rotate.runRot13,
|
||||
"ROT47": Rotate.runRot47,
|
||||
"Rotate left": Rotate.runRotl,
|
||||
"Rotate right": Rotate.runRotr,
|
||||
"XOR": BitwiseOp.runXor,
|
||||
"XOR Brute Force": BitwiseOp.runXorBrute,
|
||||
"OR": BitwiseOp.runXor,
|
||||
"NOT": BitwiseOp.runNot,
|
||||
"AND": BitwiseOp.runAnd,
|
||||
"ADD": BitwiseOp.runAdd,
|
||||
"SUB": BitwiseOp.runSub,
|
||||
"To Morse Code": MorseCode.runTo,
|
||||
"From Morse Code": MorseCode.runFrom,
|
||||
"Format MAC addresses": MAC.runFormat,
|
||||
"Encode NetBIOS Name": NetBIOS.runEncodeName,
|
||||
"Decode NetBIOS Name": NetBIOS.runDecodeName,
|
||||
"Regular expression": StrUtils.runRegex,
|
||||
"Offset checker": StrUtils.runOffsetChecker,
|
||||
"To Upper case": StrUtils.runUpper,
|
||||
"To Lower case": StrUtils.runLower,
|
||||
"Find / Replace": StrUtils.runFindReplace,
|
||||
"Split": StrUtils.runSplit,
|
||||
"Filter": StrUtils.runFilter,
|
||||
"Parse escaped string": StrUtils.runParseEscapedString,
|
||||
"Head": StrUtils.runHead,
|
||||
"Tail": StrUtils.runTail,
|
||||
"Remove whitespace": Tidy.runRemoveWhitespace,
|
||||
"Remove null bytes": Tidy.runRemoveNulls,
|
||||
"Drop bytes": Tidy.runDropBytes,
|
||||
"Take bytes": Tidy.runTakeBytes,
|
||||
"Pad lines": Tidy.runPad,
|
||||
"Reverse": SeqUtils.runReverse,
|
||||
"Sort": SeqUtils.runSort,
|
||||
"Unique": SeqUtils.runUnique,
|
||||
"Count occurrences": SeqUtils.runCount,
|
||||
"Add line numbers": SeqUtils.runAddLineNumbers,
|
||||
"Remove line numbers": SeqUtils.runRemoveLineNumbers,
|
||||
"Expand alphabet range": SeqUtils.runExpandAlphRange,
|
||||
"Convert distance": Convert.runDistance,
|
||||
"Convert area": Convert.runArea,
|
||||
"Convert mass": Convert.runMass,
|
||||
"Convert speed": Convert.runSpeed,
|
||||
"Convert data units": Convert.runDataSize,
|
||||
"Parse UNIX file permissions": OS.runParseUnixPerms,
|
||||
"Parse DateTime": DateTime.runParse,
|
||||
"Translate DateTime Format": DateTime.runTranslateFormat,
|
||||
"From UNIX Timestamp": DateTime.runFromUnixTimestamp,
|
||||
"To UNIX Timestamp": DateTime.runToUnixTimestamp,
|
||||
"Strings": Extract.runStrings,
|
||||
"Extract IP addresses": Extract.runIp,
|
||||
"Extract email addresses": Extract.runEmail,
|
||||
"Extract MAC addresses": Extract.runMac,
|
||||
"Extract URLs": Extract.runUrls,
|
||||
"Extract domains": Extract.runDomains,
|
||||
"Extract file paths": Extract.runFilePaths,
|
||||
"Extract dates": Extract.runDates,
|
||||
"Entropy": Entropy.runEntropy,
|
||||
"Frequency distribution": Entropy.runFreqDistrib,
|
||||
"Detect File Type": FileType.runDetect,
|
||||
"Scan for Embedded Files": FileType.runScanForEmbeddedFiles,
|
||||
"Generate UUID": UUID.runGenerateV4,
|
||||
"Numberwang": Numberwang.run,
|
||||
"Fork": FlowControl.runFork,
|
||||
"Merge": FlowControl.runMerge,
|
||||
"Jump": FlowControl.runJump,
|
||||
"Conditional Jump": FlowControl.runCondJump,
|
||||
"Return": FlowControl.runReturn,
|
||||
"Comment": FlowControl.runComment,
|
||||
};
|
||||
|
||||
export default OpModules;
|
20
src/core/config/modules/Diff.js
Normal file
20
src/core/config/modules/Diff.js
Normal file
@ -0,0 +1,20 @@
|
||||
import Diff from "../../operations/Diff.js";
|
||||
|
||||
|
||||
/**
|
||||
* Diff module.
|
||||
*
|
||||
* Libraries:
|
||||
* - JsDIff
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.Diff = {
|
||||
"Diff": Diff.runDiff,
|
||||
};
|
||||
|
||||
export default OpModules;
|
21
src/core/config/modules/Encodings.js
Normal file
21
src/core/config/modules/Encodings.js
Normal file
@ -0,0 +1,21 @@
|
||||
import Punycode from "../../operations/Punycode.js";
|
||||
|
||||
|
||||
/**
|
||||
* Encodings module.
|
||||
*
|
||||
* Libraries:
|
||||
* - punycode
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.Encodings = {
|
||||
"To Punycode": Punycode.runToAscii,
|
||||
"From Punycode": Punycode.runToUnicode,
|
||||
};
|
||||
|
||||
export default OpModules;
|
22
src/core/config/modules/HTTP.js
Normal file
22
src/core/config/modules/HTTP.js
Normal file
@ -0,0 +1,22 @@
|
||||
import HTTP from "../../operations/HTTP.js";
|
||||
|
||||
|
||||
/**
|
||||
* HTTP module.
|
||||
*
|
||||
* Libraries:
|
||||
* - UAS_parser
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.HTTP = {
|
||||
"HTTP request": HTTP.runHTTPRequest,
|
||||
"Strip HTTP headers": HTTP.runStripHeaders,
|
||||
"Parse User Agent": HTTP.runParseUserAgent,
|
||||
};
|
||||
|
||||
export default OpModules;
|
43
src/core/config/modules/Hashing.js
Normal file
43
src/core/config/modules/Hashing.js
Normal file
@ -0,0 +1,43 @@
|
||||
import Checksum from "../../operations/Checksum.js";
|
||||
import Hash from "../../operations/Hash.js";
|
||||
|
||||
|
||||
/**
|
||||
* Hashing module.
|
||||
*
|
||||
* Libraries:
|
||||
* - CryptoJS
|
||||
* - CryptoApi
|
||||
* - ./Checksum.js
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.Hashing = {
|
||||
"Analyse hash": Hash.runAnalyse,
|
||||
"Generate all hashes": Hash.runAll,
|
||||
"MD2": Hash.runMD2,
|
||||
"MD4": Hash.runMD4,
|
||||
"MD5": Hash.runMD5,
|
||||
"SHA0": Hash.runSHA0,
|
||||
"SHA1": Hash.runSHA1,
|
||||
"SHA224": Hash.runSHA224,
|
||||
"SHA256": Hash.runSHA256,
|
||||
"SHA384": Hash.runSHA384,
|
||||
"SHA512": Hash.runSHA512,
|
||||
"SHA3": Hash.runSHA3,
|
||||
"RIPEMD-160": Hash.runRIPEMD160,
|
||||
"HMAC": Hash.runHMAC,
|
||||
"Fletcher-8 Checksum": Checksum.runFletcher8,
|
||||
"Fletcher-16 Checksum": Checksum.runFletcher16,
|
||||
"Fletcher-32 Checksum": Checksum.runFletcher32,
|
||||
"Fletcher-64 Checksum": Checksum.runFletcher64,
|
||||
"Adler-32 Checksum": Checksum.runAdler32,
|
||||
"CRC-32 Checksum": Checksum.runCRC32,
|
||||
"TCP/IP Checksum": Checksum.runTCPIP,
|
||||
};
|
||||
|
||||
export default OpModules;
|
25
src/core/config/modules/Image.js
Normal file
25
src/core/config/modules/Image.js
Normal file
@ -0,0 +1,25 @@
|
||||
import Image from "../../operations/Image.js";
|
||||
|
||||
|
||||
/**
|
||||
* Image module.
|
||||
*
|
||||
* Libraries:
|
||||
* - exif-parser
|
||||
* - remove-exif
|
||||
* - ./FileType.js
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.Image = {
|
||||
"Extract EXIF": Image.runExtractEXIF,
|
||||
"Remove EXIF": Image.runRemoveEXIF,
|
||||
"Render Image": Image.runRenderImage,
|
||||
|
||||
};
|
||||
|
||||
export default OpModules;
|
28
src/core/config/modules/JSBN.js
Normal file
28
src/core/config/modules/JSBN.js
Normal file
@ -0,0 +1,28 @@
|
||||
import IP from "../../operations/IP.js";
|
||||
import Filetime from "../../operations/Filetime.js";
|
||||
|
||||
|
||||
/**
|
||||
* JSBN module.
|
||||
*
|
||||
* Libraries:
|
||||
* - jsbn
|
||||
* - ./Checksum.js
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.JSBN = {
|
||||
"Parse IP range": IP.runParseIpRange,
|
||||
"Parse IPv6 address": IP.runParseIPv6,
|
||||
"Parse IPv4 header": IP.runParseIPv4Header,
|
||||
"Change IP format": IP.runChangeIpFormat,
|
||||
"Group IP addresses": IP.runGroupIps,
|
||||
"Windows Filetime to UNIX Timestamp": Filetime.runFromFiletimeToUnix,
|
||||
"UNIX Timestamp to Windows Filetime": Filetime.runToFiletimeFromUnix,
|
||||
};
|
||||
|
||||
export default OpModules;
|
25
src/core/config/modules/PublicKey.js
Normal file
25
src/core/config/modules/PublicKey.js
Normal file
@ -0,0 +1,25 @@
|
||||
import PublicKey from "../../operations/PublicKey.js";
|
||||
|
||||
|
||||
/**
|
||||
* PublicKey module.
|
||||
*
|
||||
* Libraries:
|
||||
* - jsrsasign
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
let OpModules = self.OpModules || {};
|
||||
|
||||
OpModules.PublicKey = {
|
||||
"Parse X.509 certificate": PublicKey.runParseX509,
|
||||
"Parse ASN.1 hex string": PublicKey.runParseAsn1HexString,
|
||||
"PEM to Hex": PublicKey.runPemToHex,
|
||||
"Hex to PEM": PublicKey.runHexToPem,
|
||||
"Hex to Object Identifier": PublicKey.runHexToObjectIdentifier,
|
||||
"Object Identifier to Hex": PublicKey.runObjectIdentifierToHex,
|
||||
};
|
||||
|
||||
export default OpModules;
|
@ -91,4 +91,4 @@ const Diff = {
|
||||
|
||||
};
|
||||
|
||||
export default Diff;
|
||||
export default Diff;
|
||||
|
@ -158,12 +158,15 @@ InputWaiter.prototype.inputDrop = function(e) {
|
||||
const CHUNK_SIZE = 20480; // 20KB
|
||||
|
||||
const setInput = function() {
|
||||
this.set(inputCharcode);
|
||||
this.app.autoBakePause = true;
|
||||
const recipeConfig = this.app.getRecipeConfig();
|
||||
if (!recipeConfig[0] || recipeConfig[0].op !== "From Hex") {
|
||||
recipeConfig.unshift({op: "From Hex", args: ["Space"]});
|
||||
this.app.setRecipeConfig(recipeConfig);
|
||||
}
|
||||
this.app.autoBakePause = false;
|
||||
|
||||
this.set(inputCharcode);
|
||||
|
||||
el.classList.remove("loadingFile");
|
||||
}.bind(this);
|
||||
|
@ -17,7 +17,7 @@ import CanvasComponents from "../core/lib/canvascomponents.js";
|
||||
// CyberChef
|
||||
import App from "./App.js";
|
||||
import Categories from "../core/config/Categories.js";
|
||||
import OperationConfig from "value-loader?name=default!../core/config/MetaConfig.js";
|
||||
import OperationConfig from "value-loader?name=conf!../core/config/OperationConfig.js";
|
||||
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user