fix eslint:recommended errors

this should find most of the imports
This commit is contained in:
Thomas Grainger 2016-11-29 01:58:58 +00:00
parent ad730d806b
commit 640f555b8a
No known key found for this signature in database
GPG Key ID: 995EA0A029283160
61 changed files with 269 additions and 44 deletions

View File

@ -1,13 +1,21 @@
{
"extends": "airbnb-base",
"extends": "eslint:recommended",
"parser": "babel-eslint",
"plugins": ["babel"],
"rules": {
"no-unused-vars": 0,
"no-console": 0,
"no-cond-assign": 0,
"no-unsafe-finally": 0
},
"settings": {
"import/resolver": {
"webpack": {}
}
},
"env": {
"browser": true
"browser": true,
"node": true
}
}

View File

@ -67,6 +67,7 @@
"webpack-dev-server": "2.1.0-beta.12"
},
"dependencies": {
"core-js": "^2.4.1",
"esprima": "^3.1.2",
"estraverse": "^4.2.0",
"jquery": "^3.1.1",

View File

@ -264,3 +264,5 @@ const Categories = [
],
},
];
export default Categories;

View File

@ -1,3 +1,39 @@
import FlowControl from '../core/FlowControl';
import Base64 from '../operations/Base64';
import BitwiseOp from '../operations/BitwiseOp';
import ByteRepr from '../operations/ByteRepr';
import Hexdump from '../operations/Hexdump';
import Base from '../operations/Base';
import HTML from '../operations/HTML';
import URL_ from '../operations/URL';
import Unicode from '../operations/Unicode';
import QuotedPrintable from '../operations/QuotedPrintable';
import Punycode from '../operations/Punycode';
import IP from '../operations/IP';
import CharEnc from '../operations/CharEnc';
import Cipher from '../operations/Cipher';
import Rotate from '../operations/Rotate';
import HTTP from '../operations/HTTP';
import MAC from '../operations/MAC';
import StrUtils from '../operations/StrUtils';
import Tidy from '../operations/Tidy';
import SeqUtils from '../operations/SeqUtils';
import Extract from '../operations/Extract';
import DateTime from '../operations/DateTime';
import Convert from '../operations/Convert';
import Compress from '../operations/Compress';
import JS from '../operations/JS';
import Code from '../operations/Code';
import Hash from '../operations/Hash';
import Checksum from '../operations/Checksum';
import Entropy from '../operations/Entropy';
import Numberwang from '../operations/Numberwang';
import PublicKey from '../operations/PublicKey';
import FileType from '../operations/FileType';
import OS from '../operations/OS';
import Endian from '../operations/Endian';
import UUID from '../operations/UUID';
/*
* Tell JSHint to ignore "'Object' is not defined" errors in this file, as it references every
* single operation object by definition.
@ -2784,3 +2820,5 @@ const OperationConfig = {
args: [],
},
};
export default OperationConfig;

View File

@ -1,3 +1,6 @@
import Dish from './Dish';
import Recipe from './Recipe';
/**
* The main controller for CyberChef.
*
@ -7,9 +10,9 @@
*
* @class
*/
const Chef = function () {
export default function Chef() {
this.dish = new Dish();
};
}
/**

View File

@ -1,3 +1,5 @@
import Utils from './Utils';
/**
* The data being operated on by each operation.
*
@ -9,10 +11,10 @@
* @param {byte_array|string|number} value - The value of the input data.
* @param {number} type - The data type of value, see Dish enums.
*/
const Dish = function (value, type) {
export default function Dish(value, type) {
this.value = value || typeof value === 'string' ? value : null;
this.type = type || Dish.BYTE_ARRAY;
};
}
/**

View File

@ -1,3 +1,6 @@
import Recipe from './Recipe';
import Dish from './Dish';
/**
* Flow Control operations.
*
@ -170,3 +173,5 @@ const FlowControl = {
},
};
export default FlowControl;

View File

@ -1,3 +1,5 @@
import Utils from './Utils';
/**
* The arguments to operations.
*
@ -8,7 +10,7 @@
* @class
* @param {Object} ingredient_config
*/
const Ingredient = function (ingredient_config) {
export default function Ingredient(ingredient_config) {
this.name = '';
this.type = '';
this.value = null;
@ -16,7 +18,7 @@ const Ingredient = function (ingredient_config) {
if (ingredient_config) {
this._parse_config(ingredient_config);
}
};
}
/**
@ -72,7 +74,6 @@ Ingredient.prepare = function (data, type) {
} else {
return data;
}
break;
case 'number':
var number = parseFloat(data);
if (isNaN(number)) {

View File

@ -1,3 +1,6 @@
import Dish from './Dish';
import Ingredient from './Ingredient';
/**
* The Operation specified by the user to be run.
*
@ -9,7 +12,7 @@
* @param {string} operation_name
* @param {Object} operation_config
*/
const Operation = function (operation_name, operation_config) {
export default function Operation(operation_name, operation_config) {
this.name = operation_name;
this.description = '';
this.input_type = -1;
@ -24,7 +27,7 @@ const Operation = function (operation_name, operation_config) {
if (operation_config) {
this._parse_config(operation_config);
}
};
}
/**

View File

@ -1,3 +1,6 @@
import OperationConfig from '../config/OperationConfig';
import Operation from './Operation';
/**
* The Recipe controls a list of Operations and the Dish they operate on.
*

View File

@ -1,3 +1,5 @@
import $ from 'jquery';
/* globals CryptoJS, moment */
/**
@ -1156,3 +1158,5 @@ CryptoJS.enc.Hex.parse = function (hexStr) {
return new CryptoJS.lib.WordArray.init(words, hexStrLength / 2);
};
export default Utils;

View File

@ -50,3 +50,5 @@ const Base = {
},
};
export default Base;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/**
* Base64 operations.
*
@ -361,3 +363,5 @@ const Base64 = {
},
};
export default Base64;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/* globals CryptoJS */
/**
@ -298,3 +300,5 @@ const BitwiseOp = {
},
};
export default BitwiseOp;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/* globals app */
/**
@ -396,3 +398,5 @@ const ByteRepr = {
},
};
export default ByteRepr;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/* globals CryptoJS */
/**
@ -44,3 +46,5 @@ const CharEnc = {
},
};
export default CharEnc;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/**
* Checksum operations.
*
@ -128,3 +130,5 @@ const Checksum = {
},
};
export default Checksum;

View File

@ -1,3 +1,4 @@
import Utils from '../core/Utils';
/* globals CryptoJS, blowfish */
/**
@ -427,3 +428,5 @@ CryptoJS.kdf.OpenSSL.execute = function (password, keySize, ivSize, salt) {
// Return params
return CryptoJS.lib.CipherParams.create({ key, iv, salt });
};
export default Cipher;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/* globals prettyPrintOne, vkbeautify */
/**
@ -303,3 +305,5 @@ const Code = {
},
};
export default Code;

View File

@ -1,3 +1,6 @@
import Utils from '../core/Utils';
import Uint8Array from 'core-js/modules/es6.typed.uint8-array';
/* globals Zlib, bzip2 */
/**
@ -346,3 +349,5 @@ const Compress = {
},
};
export default Compress;

View File

@ -410,3 +410,5 @@ const Convert = {
},
};
export default Convert;

View File

@ -452,3 +452,5 @@ const DateTime = {
};
export default DateTime;

View File

@ -1,3 +1,4 @@
import Utils from '../core/Utils';
/**
* Endian operations.
*
@ -92,3 +93,5 @@ const Endian = {
},
};
export default Endian;

View File

@ -1,3 +1,4 @@
import Utils from '../core/Utils';
/**
* Entropy operations.
*
@ -164,3 +165,5 @@ const Entropy = {
},
};
export default Entropy;

View File

@ -297,3 +297,5 @@ const Extract = {
},
};
export default Extract;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/**
* File type operations.
*
@ -524,3 +526,5 @@ const FileType = {
},
};
export default FileType;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/**
* HTML operations.
*
@ -205,9 +207,9 @@ const HTML = {
l = Math.round(hsl_[2] * 100),
k = 1 - Math.max(r / 255, g / 255, b / 255),
c = (1 - r / 255 - k) / (1 - k),
m = (1 - g / 255 - k) / (1 - k), // jshint ignore:line
y = (1 - b / 255 - k) / (1 - k);
m = (1 - g / 255 - k) / (1 - k);
c = isNaN(c) ? '0' : c.toFixed(2);
m = isNaN(m) ? '0' : m.toFixed(2);
y = isNaN(y) ? '0' : y.toFixed(2);

View File

@ -51,3 +51,5 @@ const HTTP = {
},
};
export default HTTP;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/* globals CryptoJS, Checksum */
/**
@ -339,3 +341,5 @@ const Hash = {
},
};
export default Hash;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/* globals app */
/**
@ -196,3 +198,5 @@ const Hexdump = {
},
};
export default Hexdump;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/* globals BigInteger */
/**
@ -802,3 +804,5 @@ const IP = {
},
};
export default IP;

View File

@ -158,3 +158,5 @@ const JS = {
},
};
export default JS;

View File

@ -86,3 +86,5 @@ const MAC = {
},
};
export default MAC;

View File

@ -25,3 +25,5 @@ const Numberwang = {
},
};
export default Numberwang;

View File

@ -307,3 +307,5 @@ const OS = {
},
};
export default OS;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/* globals X509, KJUR, ASN1HEX, KEYUTIL, BigInteger */
/**
@ -1051,3 +1053,5 @@ X509.DN_ATTRHEX = {
'060355080101': 'rsa',
'0603604c0101': 'DPC',
};
export default PublicKey;

View File

@ -53,3 +53,5 @@ const Punycode = {
},
};
export default Punycode;

View File

@ -266,3 +266,5 @@ const QuotedPrintable = {
},
};
export default QuotedPrintable;

View File

@ -204,3 +204,5 @@ const Rotate = {
},
};
export default Rotate;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/**
* Sequence utility operations.
*
@ -218,3 +220,5 @@ const SeqUtils = {
},
};
export default SeqUtils;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/* globals JsDiff */
/**
@ -502,3 +504,5 @@ const StrUtils = {
},
};
export default StrUtils;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/**
* Tidy operations.
*
@ -240,3 +242,5 @@ const Tidy = {
},
};
export default Tidy;

View File

@ -1,3 +1,4 @@
import Utils from '../core/Utils';
/* globals unescape */
/**
@ -131,3 +132,5 @@ const URL_ = {
},
};
export default URL_;

View File

@ -1,3 +1,5 @@
import Uint32Array from 'core-js/modules/es6.typed.uint32-array';
/**
* UUID operations.
*
@ -37,3 +39,5 @@ const UUID = {
},
};
export default UUID;

View File

@ -1,3 +1,5 @@
import Utils from '../core/Utils';
/**
* Unicode operations.
*
@ -60,3 +62,5 @@ const Unicode = {
},
};
export default Unicode;

View File

@ -1,3 +1,5 @@
import $ from 'jquery';
import Utils from '../../core/Utils';
/**
* Waiter to handle events related to the CyberChef controls (i.e. Bake, Step, Save, Load etc.)
*
@ -9,10 +11,10 @@
* @param {HTMLApp} app - The main view object for CyberChef.
* @param {Manager} manager - The CyberChef event manager.
*/
const ControlsWaiter = function (app, manager) {
export default function ControlsWaiter(app, manager) {
this.app = app;
this.manager = manager;
};
}
/**
@ -191,7 +193,9 @@ ControlsWaiter.prototype.save_text_change = function () {
try {
const recipe_config = JSON.parse(document.getElementById('save-text').value);
this.initialise_save_link(recipe_config);
} catch (err) {}
} catch (err) {
// ignore error
}
};

View File

@ -1,3 +1,12 @@
import $ from 'jquery';
import Utils from '../../core/Utils';
import Chef from '../../core/Chef';
import Manager from './Manager';
import HTMLCategory from './HTMLCategory';
import HTMLOperation from './HTMLOperation';
/* globals Split */
/**
@ -14,7 +23,7 @@
* @param {String[]} default_favourites - A list of default favourite operations.
* @param {Object} options - Default setting for app options.
*/
const HTMLApp = function (categories, operations, default_favourites, default_options) {
export default function HTMLApp(categories, operations, default_favourites, default_options) {
this.categories = categories;
this.operations = operations;
this.dfavourites = default_favourites;
@ -29,7 +38,7 @@ const HTMLApp = function (categories, operations, default_favourites, default_op
this.ing_id = 0;
window.chef = this.chef;
};
}
/**
@ -356,7 +365,9 @@ HTMLApp.prototype.load_URI_params = function () {
try {
const recipe_config = JSON.parse(this.query_string.recipe);
this.set_recipe_config(recipe_config);
} catch (err) {}
} catch (err) {
// ignore error
}
} else if (this.query_string.op) {
// If there's no recipe, look for single operations
this.manager.recipe.clear_recipe();
@ -382,7 +393,9 @@ HTMLApp.prototype.load_URI_params = function () {
try {
const input_data = Utils.from_base64(this.query_string.input);
this.set_input(input_data);
} catch (err) {}
} catch (err) {
// ignore error
}
}
// Restore auto-bake state

View File

@ -9,11 +9,11 @@
* @param {string} name - The name of the category.
* @param {boolean} selected - Whether this category is pre-selected or not.
*/
const HTMLCategory = function (name, selected) {
export default function HTMLCategory(name, selected) {
this.name = name;
this.selected = selected;
this.op_list = [];
};
}
/**

View File

@ -10,7 +10,7 @@
* @param {HTMLApp} app - The main view object for CyberChef.
* @param {Manager} manager - The CyberChef event manager.
*/
const HTMLIngredient = function (config, app, manager) {
export default function HTMLIngredient(config, app, manager) {
this.app = app;
this.manager = manager;
@ -23,7 +23,7 @@ const HTMLIngredient = function (config, app, manager) {
this.target = config.target;
this.toggle_values = config.toggle_values;
this.id = `ing-${this.app.next_ing_id()}`;
};
}
/**

View File

@ -1,3 +1,5 @@
import HTMLIngredient from './HTMLIngredient';
/**
* Object to handle the creation of operations.
*
@ -11,7 +13,7 @@
* @param {HTMLApp} app - The main view object for CyberChef.
* @param {Manager} manager - The CyberChef event manager.
*/
const HTMLOperation = function (name, config, app, manager) {
export default function HTMLOperation(name, config, app, manager) {
this.app = app;
this.manager = manager;
@ -25,7 +27,7 @@ const HTMLOperation = function (name, config, app, manager) {
const ing = new HTMLIngredient(config.args[i], this.app, this.manager);
this.ing_list.push(ing);
}
};
}
/**

View File

@ -1,3 +1,4 @@
import Utils from '../../core/Utils';
/**
* Waiter to handle events related to highlighting in CyberChef.
*
@ -8,12 +9,12 @@
* @constructor
* @param {HTMLApp} app - The main view object for CyberChef.
*/
const HighlighterWaiter = function (app) {
export default function HighlighterWaiter(app) {
this.app = app;
this.mouse_button_down = false;
this.mouse_target = null;
};
}
/**

View File

@ -1,3 +1,5 @@
import Uint8Array from 'core-js/modules/es6.typed.uint8-array';
import Utils from '../../core/Utils';
/**
* Waiter to handle events related to the input.
*
@ -9,7 +11,7 @@
* @param {HTMLApp} app - The main view object for CyberChef.
* @param {Manager} manager - The CyberChef event manager.
*/
const InputWaiter = function (app, manager) {
export default function InputWaiter(app, manager) {
this.app = app;
this.manager = manager;
@ -30,7 +32,7 @@ const InputWaiter = function (app, manager) {
144, // Num
145, //Scroll
];
};
}
/**

View File

@ -1,3 +1,15 @@
import $ from 'jquery';
import WindowWaiter from './WindowWaiter';
import ControlsWaiter from './ControlsWaiter';
import RecipeWaiter from './RecipeWaiter';
import OperationsWaiter from './OperationsWaiter';
import InputWaiter from './InputWaiter';
import OutputWaiter from './OutputWaiter';
import HighlighterWaiter from './HighlighterWaiter';
import SeasonalWaiter from './SeasonalWaiter';
import OptionsWaiter from './OptionsWaiter';
/**
* This object controls the Waiters responsible for handling events from all areas of the app.
*

View File

@ -1,3 +1,6 @@
import $ from 'jquery';
import HTMLOperation from './HTMLOperation';
/* globals Sortable */
/**
@ -11,13 +14,13 @@
* @param {HTMLApp} app - The main view object for CyberChef.
* @param {Manager} manager - The CyberChef event manager.
*/
const OperationsWaiter = function (app, manager) {
export default function OperationsWaiter(app, manager) {
this.app = app;
this.manager = manager;
this.options = {};
this.remove_intent = false;
};
}
/**

View File

@ -1,3 +1,5 @@
import $ from 'jquery';
/**
* Waiter to handle events related to the CyberChef options.
*
@ -8,9 +10,9 @@
* @constructor
* @param {HTMLApp} app - The main view object for CyberChef.
*/
const OptionsWaiter = function (app) {
export default function OptionsWaiter(app) {
this.app = app;
};
}
/**

View File

@ -1,3 +1,5 @@
import Utils from '../../core/Utils';
/**
* Waiter to handle events related to the output.
*
@ -9,10 +11,10 @@
* @param {HTMLApp} app - The main view object for CyberChef.
* @param {Manager} manager - The CyberChef event manager.
*/
const OutputWaiter = function (app, manager) {
export default function OutputWaiter(app, manager) {
this.app = app;
this.manager = manager;
};
}
/**

View File

@ -1,3 +1,5 @@
import $ from 'jquery';
import HTMLOperation from './HTMLOperation';
/* globals Sortable */
/**
@ -11,11 +13,11 @@
* @param {HTMLApp} app - The main view object for CyberChef.
* @param {Manager} manager - The CyberChef event manager.
*/
const RecipeWaiter = function (app, manager) {
export default function RecipeWaiter(app, manager) {
this.app = app;
this.manager = manager;
this.remove_intent = false;
};
}
/**
@ -405,7 +407,7 @@ RecipeWaiter.prototype.dropdown_toggle_click = function (e) {
* @fires Manager#statechange
* @param {event} e
*/
RecipeWaiter.prototype.op_add = function (e) {
RecipeWaiter.prototype.op_add = function () {
window.dispatchEvent(this.manager.statechange);
};
@ -417,6 +419,6 @@ RecipeWaiter.prototype.op_add = function (e) {
* @fires Manager#statechange
* @param {event} e
*/
RecipeWaiter.prototype.op_remove = function (e) {
RecipeWaiter.prototype.op_remove = function () {
window.dispatchEvent(this.manager.statechange);
};

View File

@ -1,3 +1,5 @@
import $ from 'jquery';
/**
* Waiter to handle seasonal events and easter eggs.
*
@ -9,10 +11,10 @@
* @param {HTMLApp} app - The main view object for CyberChef.
* @param {Manager} manager - The CyberChef event manager.
*/
const SeasonalWaiter = function (app, manager) {
export default function SeasonalWaiter(app, manager) {
this.app = app;
this.manager = manager;
};
}
/**

View File

@ -8,9 +8,9 @@
* @constructor
* @param {HTMLApp} app - The main view object for CyberChef.
*/
const WindowWaiter = function (app) {
export default function WindowWaiter(app) {
this.app = app;
};
}
/**

View File

@ -1,3 +1,6 @@
import HTMLApp from './HTMLApp';
import Categories from '../../config/Categories';
import OperationConfig from '../../config/OperationConfig';
/* globals moment */
/**

View File

@ -1185,7 +1185,7 @@ cookie@0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
core-js@^2.4.0:
core-js@^2.4.0, core-js@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e"