mirror of
https://github.com/gchq/CyberChef
synced 2024-12-25 12:03:11 +00:00
Converted the majority of the core and operations to use CommonJS module syntax.
This commit is contained in:
parent
a4197684e5
commit
a21e0e546b
50 changed files with 308 additions and 123 deletions
24
package.json
24
package.json
|
@ -25,6 +25,9 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/gchq/CyberChef/"
|
"url": "https://github.com/gchq/CyberChef/"
|
||||||
},
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "webpack"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "~1.0.1",
|
"grunt": "~1.0.1",
|
||||||
"grunt-chmod": "~1.1.1",
|
"grunt-chmod": "~1.1.1",
|
||||||
|
@ -41,6 +44,25 @@
|
||||||
"grunt-inline-alt": "~0.3.10",
|
"grunt-inline-alt": "~0.3.10",
|
||||||
"grunt-jsdoc": "^2.1.0",
|
"grunt-jsdoc": "^2.1.0",
|
||||||
"ink-docstrap": "^1.1.4",
|
"ink-docstrap": "^1.1.4",
|
||||||
"phantomjs-prebuilt": "^2.1.14"
|
"phantomjs-prebuilt": "^2.1.14",
|
||||||
|
"webpack": "^2.2.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"crypto-api": "^0.6.2",
|
||||||
|
"crypto-js": "^3.1.9-1",
|
||||||
|
"diff": "^3.2.0",
|
||||||
|
"escodegen": "^1.8.1",
|
||||||
|
"esmangle": "^1.0.1",
|
||||||
|
"esprima": "^3.1.3",
|
||||||
|
"google-code-prettify": "^1.0.5",
|
||||||
|
"jquery": "^3.1.1",
|
||||||
|
"jsbn": "^1.1.0",
|
||||||
|
"jsrsasign": "^7.1.0",
|
||||||
|
"moment": "^2.17.1",
|
||||||
|
"moment-timezone": "^0.5.11",
|
||||||
|
"sladex-blowfish": "^0.8.1",
|
||||||
|
"uas-parser": "^0.2.2",
|
||||||
|
"vkbeautify": "^0.99.1",
|
||||||
|
"zlibjs": "^0.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"jquery": true,
|
"jquery": true,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"node": false
|
"commonjs": true,
|
||||||
|
"node": true
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"rules": {
|
"rules": {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* @constant
|
* @constant
|
||||||
* @type {CatConf[]}
|
* @type {CatConf[]}
|
||||||
*/
|
*/
|
||||||
var Categories = [
|
var Categories = module.exports = [
|
||||||
{
|
{
|
||||||
name: "Favourites",
|
name: "Favourites",
|
||||||
ops: []
|
ops: []
|
||||||
|
|
|
@ -1,8 +1,41 @@
|
||||||
/*
|
var FlowControl = require("../core/FlowControl.js"),
|
||||||
* Tell eslint to ignore "'Object' is not defined" errors in this file, as it references every
|
Base = require("../operations/Base.js"),
|
||||||
* single operation object by definition.
|
Base58 = require("../operations/Base58.js"),
|
||||||
*/
|
Base64 = require("../operations/Base64.js"),
|
||||||
/* eslint no-undef: "off" */
|
BitwiseOp = require("../operations/BitwiseOp.js"),
|
||||||
|
ByteRepr = require("../operations/ByteRepr.js"),
|
||||||
|
CharEnc = require("../operations/CharEnc.js"),
|
||||||
|
Checksum = require("../operations/Checksum.js"),
|
||||||
|
Cipher = require("../operations/Cipher.js"),
|
||||||
|
Code = require("../operations/Code.js"),
|
||||||
|
Compress = require("../operations/Compress.js"),
|
||||||
|
Convert = require("../operations/Convert.js"),
|
||||||
|
DateTime = require("../operations/DateTime.js"),
|
||||||
|
Endian = require("../operations/Endian.js"),
|
||||||
|
Entropy = require("../operations/Entropy.js"),
|
||||||
|
Extract = require("../operations/Extract.js"),
|
||||||
|
FileType = require("../operations/FileType.js"),
|
||||||
|
Hash = require("../operations/Hash.js"),
|
||||||
|
Hexdump = require("../operations/Hexdump.js"),
|
||||||
|
HTML = require("../operations/HTML.js"),
|
||||||
|
HTTP = require("../operations/HTTP.js"),
|
||||||
|
IP = require("../operations/IP.js"),
|
||||||
|
JS = require("../operations/JS.js"),
|
||||||
|
MAC = require("../operations/MAC.js"),
|
||||||
|
MorseCode = require("../operations/MorseCode.js"),
|
||||||
|
NetBIOS = require("../operations/NetBIOS.js"),
|
||||||
|
Numberwang = require("../operations/Numberwang.js"),
|
||||||
|
OS = require("../operations/OS.js"),
|
||||||
|
PublicKey = require("../operations/PublicKey.js"),
|
||||||
|
Punycode = require("../operations/Punycode.js"),
|
||||||
|
QuotedPrintable = require("../operations/QuotedPrintable.js"),
|
||||||
|
Rotate = require("../operations/Rotate.js"),
|
||||||
|
SeqUtils = require("../operations/SeqUtils.js"),
|
||||||
|
StrUtils = require("../operations/StrUtils.js"),
|
||||||
|
Tidy = require("../operations/Tidy.js"),
|
||||||
|
Unicode = require("../operations/Unicode.js"),
|
||||||
|
URL_ = require("../operations/URL.js"),
|
||||||
|
UUID = require("../operations/UUID.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +78,7 @@
|
||||||
* @constant
|
* @constant
|
||||||
* @type {Object.<string, OpConf>}
|
* @type {Object.<string, OpConf>}
|
||||||
*/
|
*/
|
||||||
var OperationConfig = {
|
var OperationConfig = module.exports = {
|
||||||
"Fork": {
|
"Fork": {
|
||||||
description: "Split the input data up based on the specified delimiter and run all subsequent operations on each branch separately.<br><br>For example, to decode multiple Base64 strings, enter them all on separate lines then add the 'Fork' and 'From Base64' operations to the recipe. Each string will be decoded separately.",
|
description: "Split the input data up based on the specified delimiter and run all subsequent operations on each branch separately.<br><br>For example, to decode multiple Base64 strings, enter them all on separate lines then add the 'Fork' and 'From Base64' operations to the recipe. Each string will be decoded separately.",
|
||||||
run: FlowControl.runFork,
|
run: FlowControl.runFork,
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
var Dish = require("./Dish.js"),
|
||||||
|
Recipe = require("./Recipe.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main controller for CyberChef.
|
* The main controller for CyberChef.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* @class
|
* @class
|
||||||
*/
|
*/
|
||||||
var Chef = function() {
|
var Chef = module.exports = function() {
|
||||||
this.dish = new Dish();
|
this.dish = new Dish();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("./Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data being operated on by each operation.
|
* The data being operated on by each operation.
|
||||||
*
|
*
|
||||||
|
@ -9,7 +12,7 @@
|
||||||
* @param {byteArray|string|number} value - The value of the input data.
|
* @param {byteArray|string|number} value - The value of the input data.
|
||||||
* @param {number} type - The data type of value, see Dish enums.
|
* @param {number} type - The data type of value, see Dish enums.
|
||||||
*/
|
*/
|
||||||
var Dish = function(value, type) {
|
var Dish = module.exports = function(value, type) {
|
||||||
this.value = value || typeof value == "string" ? value : null;
|
this.value = value || typeof value == "string" ? value : null;
|
||||||
this.type = type || Dish.BYTE_ARRAY;
|
this.type = type || Dish.BYTE_ARRAY;
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var FlowControl = {
|
var FlowControl = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("./Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The arguments to operations.
|
* The arguments to operations.
|
||||||
*
|
*
|
||||||
|
@ -8,7 +11,7 @@
|
||||||
* @class
|
* @class
|
||||||
* @param {Object} ingredientConfig
|
* @param {Object} ingredientConfig
|
||||||
*/
|
*/
|
||||||
var Ingredient = function(ingredientConfig) {
|
var Ingredient = module.exports = function(ingredientConfig) {
|
||||||
this.name = "";
|
this.name = "";
|
||||||
this.type = "";
|
this.type = "";
|
||||||
this.value = null;
|
this.value = null;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
var Dish = require("./Dish.js"),
|
||||||
|
Ingredient = require("./Ingredient.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Operation specified by the user to be run.
|
* The Operation specified by the user to be run.
|
||||||
*
|
*
|
||||||
|
@ -9,7 +13,7 @@
|
||||||
* @param {string} operationName
|
* @param {string} operationName
|
||||||
* @param {Object} operationConfig
|
* @param {Object} operationConfig
|
||||||
*/
|
*/
|
||||||
var Operation = function(operationName, operationConfig) {
|
var Operation = module.exports = function(operationName, operationConfig) {
|
||||||
this.name = operationName;
|
this.name = operationName;
|
||||||
this.description = "";
|
this.description = "";
|
||||||
this.inputType = -1;
|
this.inputType = -1;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
var OperationConfig = require("../config/OperationConfig.js"),
|
||||||
|
Operation = require("./Operation.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Recipe controls a list of Operations and the Dish they operate on.
|
* The Recipe controls a list of Operations and the Dish they operate on.
|
||||||
*
|
*
|
||||||
|
@ -8,7 +12,7 @@
|
||||||
* @class
|
* @class
|
||||||
* @param {Object} recipeConfig
|
* @param {Object} recipeConfig
|
||||||
*/
|
*/
|
||||||
var Recipe = function(recipeConfig) {
|
var Recipe = module.exports = function(recipeConfig) {
|
||||||
this.opList = [];
|
this.opList = [];
|
||||||
|
|
||||||
if (recipeConfig) {
|
if (recipeConfig) {
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
/* globals CryptoJS, moment */
|
var CryptoJS = require("crypto-js"),
|
||||||
|
moment = require("moment"),
|
||||||
|
$ = require("jquery");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility functions for use in operations, the core framework and the stage.
|
* Utility functions for use in operations, the core framework and the stage.
|
||||||
|
@ -9,7 +12,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Utils = {
|
var Utils = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates an ordinal into a character.
|
* Translates an ordinal into a character.
|
||||||
|
@ -1182,21 +1185,21 @@ var Utils = {
|
||||||
* // Places the cursor at the beginning of the element #input-text.
|
* // Places the cursor at the beginning of the element #input-text.
|
||||||
* $("#input-text").selectRange(0);
|
* $("#input-text").selectRange(0);
|
||||||
*/
|
*/
|
||||||
$.fn.selectRange = function(start, end) {
|
// $.fn.selectRange = function(start, end) {
|
||||||
if (!end) end = start;
|
// if (!end) end = start;
|
||||||
return this.each(function() {
|
// return this.each(function() {
|
||||||
if (this.setSelectionRange) {
|
// if (this.setSelectionRange) {
|
||||||
this.focus();
|
// this.focus();
|
||||||
this.setSelectionRange(start, end);
|
// this.setSelectionRange(start, end);
|
||||||
} else if (this.createTextRange) {
|
// } else if (this.createTextRange) {
|
||||||
var range = this.createTextRange();
|
// var range = this.createTextRange();
|
||||||
range.collapse(true);
|
// range.collapse(true);
|
||||||
range.moveEnd("character", end);
|
// range.moveEnd("character", end);
|
||||||
range.moveStart("character", start);
|
// range.moveStart("character", start);
|
||||||
range.select();
|
// range.select();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Base = {
|
var Base = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base58 operations.
|
* Base58 operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Base58 = {
|
var Base58 = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base64 operations.
|
* Base64 operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Base64 = {
|
var Base64 = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* globals CryptoJS */
|
var Utils = require("../core/Utils.js"),
|
||||||
|
CryptoJS = require("crypto-js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bitwise operations.
|
* Bitwise operations.
|
||||||
|
@ -9,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var BitwiseOp = {
|
var BitwiseOp = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs bitwise operations across the input data.
|
* Runs bitwise operations across the input data.
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* globals app */
|
/* globals app */
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Byte representation operations.
|
* Byte representation operations.
|
||||||
|
@ -9,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var ByteRepr = {
|
var ByteRepr = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* globals CryptoJS */
|
var Utils = require("../core/Utils.js"),
|
||||||
|
CryptoJS = require("crypto-js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Character encoding operations.
|
* Character encoding operations.
|
||||||
|
@ -9,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var CharEnc = {
|
var CharEnc = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checksum operations.
|
* Checksum operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Checksum = {
|
var Checksum = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fletcher-8 Checksum operation.
|
* Fletcher-8 Checksum operation.
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
/* globals CryptoJS, blowfish */
|
var Utils = require("../core/Utils.js"),
|
||||||
|
CryptoJS = require("crypto-js"),
|
||||||
|
Blowfish = require("sladex-blowfish");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cipher operations.
|
* Cipher operations.
|
||||||
|
@ -9,7 +12,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Cipher = {
|
var Cipher = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
@ -263,7 +266,7 @@ var Cipher = {
|
||||||
|
|
||||||
if (key.length === 0) return "Enter a key";
|
if (key.length === 0) return "Enter a key";
|
||||||
|
|
||||||
var encHex = blowfish.encrypt(input, key, {
|
var encHex = Blowfish.encrypt(input, key, {
|
||||||
outputType: 1,
|
outputType: 1,
|
||||||
cipherMode: Cipher.BLOWFISH_MODES.indexOf(mode)
|
cipherMode: Cipher.BLOWFISH_MODES.indexOf(mode)
|
||||||
}),
|
}),
|
||||||
|
@ -289,7 +292,7 @@ var Cipher = {
|
||||||
|
|
||||||
input = Utils.format[inputFormat].parse(input);
|
input = Utils.format[inputFormat].parse(input);
|
||||||
|
|
||||||
return blowfish.decrypt(input.toString(CryptoJS.enc.Base64), key, {
|
return Blowfish.decrypt(input.toString(CryptoJS.enc.Base64), key, {
|
||||||
outputType: 0, // This actually means inputType. The library is weird.
|
outputType: 0, // This actually means inputType. The library is weird.
|
||||||
cipherMode: Cipher.BLOWFISH_MODES.indexOf(mode)
|
cipherMode: Cipher.BLOWFISH_MODES.indexOf(mode)
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
/* globals prettyPrintOne, vkbeautify, xpath */
|
/* globals xpath */
|
||||||
|
var Utils = require("../core/Utils.js"),
|
||||||
|
VKbeautify = require("vkbeautify");
|
||||||
|
//Prettify = require("google-code-prettify");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code operations.
|
* Code operations.
|
||||||
|
@ -9,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Code = {
|
var Code = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
@ -32,7 +36,7 @@ var Code = {
|
||||||
runSyntaxHighlight: function(input, args) {
|
runSyntaxHighlight: function(input, args) {
|
||||||
var language = args[0],
|
var language = args[0],
|
||||||
lineNums = args[1];
|
lineNums = args[1];
|
||||||
return "<code class='prettyprint'>" + prettyPrintOne(Utils.escapeHtml(input), language, lineNums) + "</code>";
|
return "<code class='prettyprint'>" + Prettify.prettyPrintOne(Utils.escapeHtml(input), language, lineNums) + "</code>";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +55,7 @@ var Code = {
|
||||||
*/
|
*/
|
||||||
runXmlBeautify: function(input, args) {
|
runXmlBeautify: function(input, args) {
|
||||||
var indentStr = args[0];
|
var indentStr = args[0];
|
||||||
return vkbeautify.xml(input, indentStr);
|
return VKbeautify.xml(input, indentStr);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +69,7 @@ var Code = {
|
||||||
runJsonBeautify: function(input, args) {
|
runJsonBeautify: function(input, args) {
|
||||||
var indentStr = args[0];
|
var indentStr = args[0];
|
||||||
if (!input) return "";
|
if (!input) return "";
|
||||||
return vkbeautify.json(input, indentStr);
|
return VKbeautify.json(input, indentStr);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +82,7 @@ var Code = {
|
||||||
*/
|
*/
|
||||||
runCssBeautify: function(input, args) {
|
runCssBeautify: function(input, args) {
|
||||||
var indentStr = args[0];
|
var indentStr = args[0];
|
||||||
return vkbeautify.css(input, indentStr);
|
return VKbeautify.css(input, indentStr);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +95,7 @@ var Code = {
|
||||||
*/
|
*/
|
||||||
runSqlBeautify: function(input, args) {
|
runSqlBeautify: function(input, args) {
|
||||||
var indentStr = args[0];
|
var indentStr = args[0];
|
||||||
return vkbeautify.sql(input, indentStr);
|
return VKbeautify.sql(input, indentStr);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,7 +114,7 @@ var Code = {
|
||||||
*/
|
*/
|
||||||
runXmlMinify: function(input, args) {
|
runXmlMinify: function(input, args) {
|
||||||
var preserveComments = args[0];
|
var preserveComments = args[0];
|
||||||
return vkbeautify.xmlmin(input, preserveComments);
|
return VKbeautify.xmlmin(input, preserveComments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,7 +127,7 @@ var Code = {
|
||||||
*/
|
*/
|
||||||
runJsonMinify: function(input, args) {
|
runJsonMinify: function(input, args) {
|
||||||
if (!input) return "";
|
if (!input) return "";
|
||||||
return vkbeautify.jsonmin(input);
|
return VKbeautify.jsonmin(input);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,7 +140,7 @@ var Code = {
|
||||||
*/
|
*/
|
||||||
runCssMinify: function(input, args) {
|
runCssMinify: function(input, args) {
|
||||||
var preserveComments = args[0];
|
var preserveComments = args[0];
|
||||||
return vkbeautify.cssmin(input, preserveComments);
|
return VKbeautify.cssmin(input, preserveComments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,7 +152,7 @@ var Code = {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
runSqlMinify: function(input, args) {
|
runSqlMinify: function(input, args) {
|
||||||
return vkbeautify.sqlmin(input);
|
return VKbeautify.sqlmin(input);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,21 @@
|
||||||
/* globals Zlib, bzip2 */
|
/* globals bzip2 */
|
||||||
|
var rawdeflate = require("zlibjs/bin/rawdeflate.min"),
|
||||||
|
rawinflate = require("zlibjs/bin/rawinflate.min"),
|
||||||
|
zlibAndGzip = require("zlibjs/bin/zlib_and_gzip.min"),
|
||||||
|
zip = require("zlibjs/bin/zip.min"),
|
||||||
|
unzip = require("zlibjs/bin/unzip.min");
|
||||||
|
|
||||||
|
var Zlib = {
|
||||||
|
RawDeflate: rawdeflate.Zlib.RawDeflate,
|
||||||
|
RawInflate: rawinflate.Zlib.RawInflate,
|
||||||
|
Deflate: zlibAndGzip.Zlib.Deflate,
|
||||||
|
Inflate: zlibAndGzip.Zlib.Inflate,
|
||||||
|
Gzip: zlibAndGzip.Zlib.Gzip,
|
||||||
|
Gunzip: zlibAndGzip.Zlib.Gunzip,
|
||||||
|
Zip: zip.Zlib.Zip,
|
||||||
|
Unzip: unzip.Zlib.Unzip,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compression operations.
|
* Compression operations.
|
||||||
|
@ -9,7 +26,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Compress = {
|
var Compress = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Convert = {
|
var Convert = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* globals moment */
|
var moment = require("moment-timezone");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date and time operations.
|
* Date and time operations.
|
||||||
|
@ -9,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var DateTime = {
|
var DateTime = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Endian operations.
|
* Endian operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Endian = {
|
var Endian = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entropy operations.
|
* Entropy operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Entropy = {
|
var Entropy = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Extract = {
|
var Extract = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs search operations across the input data using regular expressions.
|
* Runs search operations across the input data using regular expressions.
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File type operations.
|
* File type operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var FileType = {
|
var FileType = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect File Type operation.
|
* Detect File Type operation.
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML operations.
|
* HTML operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var HTML = {
|
var HTML = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* globals UAS_parser */
|
var UAParser = require("uas-parser");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP operations.
|
* HTTP operations.
|
||||||
|
@ -9,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var HTTP = {
|
var HTTP = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Strip HTTP headers operation.
|
* Strip HTTP headers operation.
|
||||||
|
@ -34,7 +35,7 @@ var HTTP = {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
runParseUserAgent: function(input, args) {
|
runParseUserAgent: function(input, args) {
|
||||||
var ua = UAS_parser.parse(input); // eslint-disable-line camelcase
|
var ua = UAParser.parse(input);
|
||||||
|
|
||||||
return "Type: " + ua.type + "\n" +
|
return "Type: " + ua.type + "\n" +
|
||||||
"Family: " + ua.uaFamily + "\n" +
|
"Family: " + ua.uaFamily + "\n" +
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
/* globals CryptoApi, CryptoJS, Checksum */
|
var Utils = require("../core/Utils.js"),
|
||||||
|
CryptoJS = require("crypto-js"),
|
||||||
|
CryptoApi = require("crypto-api"),
|
||||||
|
Checksum = require("./Checksum.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hashing operations.
|
* Hashing operations.
|
||||||
|
@ -9,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Hash = {
|
var Hash = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MD2 operation.
|
* MD2 operation.
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* globals app */
|
/* globals app */
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hexdump operations.
|
* Hexdump operations.
|
||||||
|
@ -9,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Hexdump = {
|
var Hexdump = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
/* globals BigInteger, Checksum */
|
var Utils = require("../core/Utils.js"),
|
||||||
|
Checksum = require("./Checksum.js"),
|
||||||
|
BigInteger = require("jsbn").BigInteger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internet Protocol address operations.
|
* Internet Protocol address operations.
|
||||||
|
@ -9,7 +12,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var IP = {
|
var IP = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
/* globals esprima, escodegen, esmangle */
|
var esprima = require("esprima"),
|
||||||
|
escodegen = require("escodegen"),
|
||||||
|
esmangle = require("esmangle");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JavaScript operations.
|
* JavaScript operations.
|
||||||
|
@ -9,7 +12,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var JS = {
|
var JS = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var MAC = {
|
var MAC = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Morse Code translation operations.
|
* Morse Code translation operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var MorseCode = {
|
var MorseCode = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var NetBIOS = {
|
var NetBIOS = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @author Unknown Male 282
|
* @author Unknown Male 282
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Numberwang = {
|
var Numberwang = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Numberwang operation. Remain indoors.
|
* Numberwang operation. Remain indoors.
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var OS = {
|
var OS = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse UNIX file permissions operation.
|
* Parse UNIX file permissions operation.
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* globals X509, KJUR, ASN1HEX, KEYUTIL, BigInteger */
|
var Utils = require("../core/Utils.js"),
|
||||||
|
r = require("jsrsasign");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public Key operations.
|
* Public Key operations.
|
||||||
|
@ -9,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var PublicKey = {
|
var PublicKey = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
@ -25,7 +27,7 @@ var PublicKey = {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
runParseX509: function (input, args) {
|
runParseX509: function (input, args) {
|
||||||
var cert = new X509(),
|
var cert = new r.X509(),
|
||||||
inputFormat = args[0];
|
inputFormat = args[0];
|
||||||
|
|
||||||
if (!input.length) {
|
if (!input.length) {
|
||||||
|
@ -36,39 +38,39 @@ var PublicKey = {
|
||||||
case "DER Hex":
|
case "DER Hex":
|
||||||
input = input.replace(/\s/g, "");
|
input = input.replace(/\s/g, "");
|
||||||
cert.hex = input;
|
cert.hex = input;
|
||||||
cert.pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(input, "CERTIFICATE");
|
cert.pem = r.KJUR.asn1.ASN1Util.getPEMStringFromHex(input, "CERTIFICATE");
|
||||||
break;
|
break;
|
||||||
case "PEM":
|
case "PEM":
|
||||||
cert.hex = X509.pemToHex(input);
|
cert.hex = r.X509.pemToHex(input);
|
||||||
cert.pem = input;
|
cert.pem = input;
|
||||||
break;
|
break;
|
||||||
case "Base64":
|
case "Base64":
|
||||||
cert.hex = Utils.toHex(Utils.fromBase64(input, null, "byteArray"), "");
|
cert.hex = Utils.toHex(Utils.fromBase64(input, null, "byteArray"), "");
|
||||||
cert.pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(cert.hex, "CERTIFICATE");
|
cert.pem = r.KJUR.asn1.ASN1Util.getPEMStringFromHex(cert.hex, "CERTIFICATE");
|
||||||
break;
|
break;
|
||||||
case "Raw":
|
case "Raw":
|
||||||
cert.hex = Utils.toHex(Utils.strToByteArray(input), "");
|
cert.hex = Utils.toHex(Utils.strToByteArray(input), "");
|
||||||
cert.pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(cert.hex, "CERTIFICATE");
|
cert.pem = r.KJUR.asn1.ASN1Util.getPEMStringFromHex(cert.hex, "CERTIFICATE");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw "Undefined input format";
|
throw "Undefined input format";
|
||||||
}
|
}
|
||||||
|
|
||||||
var version = ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 0, 0]),
|
var version = r.ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 0, 0]),
|
||||||
sn = cert.getSerialNumberHex(),
|
sn = cert.getSerialNumberHex(),
|
||||||
algorithm = KJUR.asn1.x509.OID.oid2name(KJUR.asn1.ASN1Util.oidHexToInt(ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 2, 0]))),
|
algorithm = r.KJUR.asn1.x509.OID.oid2name(r.KJUR.asn1.ASN1Util.oidHexToInt(r.ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 2, 0]))),
|
||||||
issuer = cert.getIssuerString(),
|
issuer = cert.getIssuerString(),
|
||||||
notBefore = cert.getNotBefore(),
|
notBefore = cert.getNotBefore(),
|
||||||
notAfter = cert.getNotAfter(),
|
notAfter = cert.getNotAfter(),
|
||||||
subject = cert.getSubjectString(),
|
subject = cert.getSubjectString(),
|
||||||
pkAlgorithm = KJUR.asn1.x509.OID.oid2name(KJUR.asn1.ASN1Util.oidHexToInt(ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 6, 0, 0]))),
|
pkAlgorithm = r.KJUR.asn1.x509.OID.oid2name(r.KJUR.asn1.ASN1Util.oidHexToInt(r.ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 6, 0, 0]))),
|
||||||
pk = X509.getPublicKeyFromCertPEM(cert.pem),
|
pk = r.X509.getPublicKeyFromCertPEM(cert.pem),
|
||||||
pkFields = [],
|
pkFields = [],
|
||||||
pkStr = "",
|
pkStr = "",
|
||||||
certSigAlg = KJUR.asn1.x509.OID.oid2name(KJUR.asn1.ASN1Util.oidHexToInt(ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [1, 0]))),
|
certSigAlg = r.KJUR.asn1.x509.OID.oid2name(r.KJUR.asn1.ASN1Util.oidHexToInt(r.ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [1, 0]))),
|
||||||
certSig = ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [2]).substr(2),
|
certSig = r.ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [2]).substr(2),
|
||||||
sigStr = "",
|
sigStr = "",
|
||||||
extensions = ASN1HEX.dump(ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 7]));
|
extensions = r.ASN1HEX.dump(r.ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 7]));
|
||||||
|
|
||||||
// Public Key fields
|
// Public Key fields
|
||||||
if (pk.type === "EC") { // ECDSA
|
if (pk.type === "EC") { // ECDSA
|
||||||
|
@ -78,7 +80,7 @@ var PublicKey = {
|
||||||
});
|
});
|
||||||
pkFields.push({
|
pkFields.push({
|
||||||
key: "Length",
|
key: "Length",
|
||||||
value: (((new BigInteger(pk.pubKeyHex, 16)).bitLength()-3) /2) + " bits"
|
value: (((new r.BigInteger(pk.pubKeyHex, 16)).bitLength()-3) /2) + " bits"
|
||||||
});
|
});
|
||||||
pkFields.push({
|
pkFields.push({
|
||||||
key: "pub",
|
key: "pub",
|
||||||
|
@ -122,9 +124,9 @@ var PublicKey = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signature fields
|
// Signature fields
|
||||||
if (ASN1HEX.dump(certSig).indexOf("SEQUENCE") === 0) { // DSA or ECDSA
|
if (r.ASN1HEX.dump(certSig).indexOf("SEQUENCE") === 0) { // DSA or ECDSA
|
||||||
sigStr = " r: " + PublicKey._formatByteStr(ASN1HEX.getDecendantHexVByNthList(certSig, 0, [0]), 16, 18) + "\n" +
|
sigStr = " r: " + PublicKey._formatByteStr(r.ASN1HEX.getDecendantHexVByNthList(certSig, 0, [0]), 16, 18) + "\n" +
|
||||||
" s: " + PublicKey._formatByteStr(ASN1HEX.getDecendantHexVByNthList(certSig, 0, [1]), 16, 18) + "\n";
|
" s: " + PublicKey._formatByteStr(r.ASN1HEX.getDecendantHexVByNthList(certSig, 0, [1]), 16, 18) + "\n";
|
||||||
} else { // RSA
|
} else { // RSA
|
||||||
sigStr = " Signature: " + PublicKey._formatByteStr(certSig, 16, 18) + "\n";
|
sigStr = " Signature: " + PublicKey._formatByteStr(certSig, 16, 18) + "\n";
|
||||||
}
|
}
|
||||||
|
@ -145,7 +147,7 @@ var PublicKey = {
|
||||||
subjectStr = PublicKey._formatDnStr(subject, 2);
|
subjectStr = PublicKey._formatDnStr(subject, 2);
|
||||||
|
|
||||||
var output = "Version: " + (parseInt(version, 16) + 1) + " (0x" + version + ")\n" +
|
var output = "Version: " + (parseInt(version, 16) + 1) + " (0x" + version + ")\n" +
|
||||||
"Serial number: " + new BigInteger(sn, 16).toString() + " (0x" + sn + ")\n" +
|
"Serial number: " + new r.BigInteger(sn, 16).toString() + " (0x" + sn + ")\n" +
|
||||||
"Algorithm ID: " + algorithm + "\n" +
|
"Algorithm ID: " + algorithm + "\n" +
|
||||||
"Validity\n" +
|
"Validity\n" +
|
||||||
" Not Before: " + nbDate + " (dd-mm-yy hh:mm:ss) (" + notBefore + ")\n" +
|
" Not Before: " + nbDate + " (dd-mm-yy hh:mm:ss) (" + notBefore + ")\n" +
|
||||||
|
@ -183,7 +185,7 @@ var PublicKey = {
|
||||||
// Add footer so that the KEYUTIL function works
|
// Add footer so that the KEYUTIL function works
|
||||||
input = input + "-----END CERTIFICATE-----";
|
input = input + "-----END CERTIFICATE-----";
|
||||||
}
|
}
|
||||||
return KEYUTIL.getHexFromPEM(input);
|
return r.KEYUTIL.getHexFromPEM(input);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,7 +203,7 @@ var PublicKey = {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
runHexToPem: function(input, args) {
|
runHexToPem: function(input, args) {
|
||||||
return KJUR.asn1.ASN1Util.getPEMStringFromHex(input.replace(/\s/g, ""), args[0]);
|
return r.KJUR.asn1.ASN1Util.getPEMStringFromHex(input.replace(/\s/g, ""), args[0]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,7 +215,7 @@ var PublicKey = {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
runHexToObjectIdentifier: function(input, args) {
|
runHexToObjectIdentifier: function(input, args) {
|
||||||
return KJUR.asn1.ASN1Util.oidHexToInt(input.replace(/\s/g, ""));
|
return r.KJUR.asn1.ASN1Util.oidHexToInt(input.replace(/\s/g, ""));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,7 +227,7 @@ var PublicKey = {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
runObjectIdentifierToHex: function(input, args) {
|
runObjectIdentifierToHex: function(input, args) {
|
||||||
return KJUR.asn1.ASN1Util.oidIntToHex(input);
|
return r.KJUR.asn1.ASN1Util.oidIntToHex(input);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -245,7 +247,7 @@ var PublicKey = {
|
||||||
runParseAsn1HexString: function(input, args) {
|
runParseAsn1HexString: function(input, args) {
|
||||||
var truncateLen = args[1],
|
var truncateLen = args[1],
|
||||||
index = args[0];
|
index = args[0];
|
||||||
return ASN1HEX.dump(input.replace(/\s/g, ""), {
|
return r.ASN1HEX.dump(input.replace(/\s/g, ""), {
|
||||||
"ommitLongOctet": truncateLen
|
"ommitLongOctet": truncateLen
|
||||||
}, index);
|
}, index);
|
||||||
},
|
},
|
||||||
|
@ -342,12 +344,12 @@ var PublicKey = {
|
||||||
* @param {string} hDN - Hex DN string
|
* @param {string} hDN - Hex DN string
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
X509.hex2dn = function(hDN) {
|
r.X509.hex2dn = function(hDN) {
|
||||||
var s = "";
|
var s = "";
|
||||||
var a = ASN1HEX.getPosArrayOfChildren_AtObj(hDN, 0);
|
var a = r.ASN1HEX.getPosArrayOfChildren_AtObj(hDN, 0);
|
||||||
for (var i = 0; i < a.length; i++) {
|
for (var i = 0; i < a.length; i++) {
|
||||||
var hRDN = ASN1HEX.getHexOfTLV_AtObj(hDN, a[i]);
|
var hRDN = r.ASN1HEX.getHexOfTLV_AtObj(hDN, a[i]);
|
||||||
s = s + ",/|" + X509.hex2rdn(hRDN);
|
s = s + ",/|" + r.X509.hex2rdn(hRDN);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
};
|
};
|
||||||
|
@ -361,7 +363,7 @@ X509.hex2dn = function(hDN) {
|
||||||
*
|
*
|
||||||
* @constant
|
* @constant
|
||||||
*/
|
*/
|
||||||
X509.DN_ATTRHEX = {
|
r.X509.DN_ATTRHEX = {
|
||||||
"0603550403" : "commonName",
|
"0603550403" : "commonName",
|
||||||
"0603550404" : "surname",
|
"0603550404" : "surname",
|
||||||
"0603550406" : "countryName",
|
"0603550406" : "countryName",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* globals punycode */
|
var punycode = require("punycode");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Punycode operations.
|
* Punycode operations.
|
||||||
|
@ -9,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Punycode = {
|
var Punycode = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
@ -28,7 +29,7 @@ var Punycode = {
|
||||||
var idn = args[0];
|
var idn = args[0];
|
||||||
|
|
||||||
if (idn) {
|
if (idn) {
|
||||||
return punycode.ToASCII(input);
|
return punycode.toASCII(input);
|
||||||
} else {
|
} else {
|
||||||
return punycode.encode(input);
|
return punycode.encode(input);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +47,7 @@ var Punycode = {
|
||||||
var idn = args[0];
|
var idn = args[0];
|
||||||
|
|
||||||
if (idn) {
|
if (idn) {
|
||||||
return punycode.ToUnicode(input);
|
return punycode.toUnicode(input);
|
||||||
} else {
|
} else {
|
||||||
return punycode.decode(input);
|
return punycode.decode(input);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var QuotedPrintable = {
|
var QuotedPrintable = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To Quoted Printable operation.
|
* To Quoted Printable operation.
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* @todo Support for UTF16
|
* @todo Support for UTF16
|
||||||
*/
|
*/
|
||||||
var Rotate = {
|
var Rotate = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sequence utility operations.
|
* Sequence utility operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var SeqUtils = {
|
var SeqUtils = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* globals JsDiff */
|
var Utils = require("../core/Utils.js"),
|
||||||
|
JsDiff = require("diff");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String utility operations.
|
* String utility operations.
|
||||||
|
@ -9,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var StrUtils = {
|
var StrUtils = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tidy operations.
|
* Tidy operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Tidy = {
|
var Tidy = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
/* globals unescape */
|
/* globals unescape */
|
||||||
|
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL operations.
|
* URL operations.
|
||||||
* Namespace is appended with an underscore to prevent overwriting the global URL object.
|
* Namespace is appended with an underscore to prevent overwriting the global URL object.
|
||||||
|
@ -10,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var URL_ = {
|
var URL_ = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var UUID = {
|
var UUID = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate UUID operation.
|
* Generate UUID operation.
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var Utils = require("../core/Utils.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unicode operations.
|
* Unicode operations.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var Unicode = {
|
var Unicode = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
|
|
12
src/js/views/node/index.js
Normal file
12
src/js/views/node/index.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
var Chef = require("../../core/Chef.js");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author n1474335 [n1474335@gmail.com]
|
||||||
|
* @copyright Crown Copyright 2017
|
||||||
|
* @license Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
var chef = new Chef();
|
||||||
|
|
||||||
|
console.log(chef.bake("test", [{"op":"To Hex","args":["Space"]}], {}, 0, false));
|
11
webpack.config.js
Normal file
11
webpack.config.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/* eslint-env node */
|
||||||
|
|
||||||
|
var path = require("path");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: "./src/js/views/html/index.js",
|
||||||
|
output: {
|
||||||
|
filename: "bundle.js",
|
||||||
|
path: path.resolve(__dirname, "build/dev")
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue