From 5f36a58a8925aeb54aa0ea4c98ed4331fd5283a1 Mon Sep 17 00:00:00 2001 From: Macide Celik Date: Tue, 29 Oct 2019 00:22:13 +0300 Subject: [PATCH] Delete DefangIPAddresses.mjs --- src/core/operations/DefangIPAddresses.mjs | 61 ----------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/core/operations/DefangIPAddresses.mjs diff --git a/src/core/operations/DefangIPAddresses.mjs b/src/core/operations/DefangIPAddresses.mjs deleted file mode 100644 index 74e03500..00000000 --- a/src/core/operations/DefangIPAddresses.mjs +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @author h345983745 - * @copyright Crown Copyright 2019 - * @license Apache-2.0 - */ - -import Operation from "../Operation"; - - -/** - * Defang IP Addresses operation - */ -class DefangIPAddresses extends Operation { - - /** - * DefangIPAddresses constructor - */ - constructor() { - super(); - - this.name = "Defang IP Addresses"; - this.module = "Default"; - this.description = "Takes a IPv4 or IPv6 address and 'Defangs' it, meaning the IP becomes invalid, removing the risk of accidentally utilising it as an IP address."; - this.infoURL = "https://isc.sans.edu/forums/diary/Defang+all+the+things/22744/"; - this.inputType = "string"; - this.outputType = "string"; - this.args = []; - - } - - /** - * @param {string} input - * @param {Object[]} args - * @returns {string} - */ - run(input, args) { - input = input.replace(IPV4_REGEX, x => { - return x.replace(/\./g, "[.]"); - }); - - input = input.replace(IPV6_REGEX, x => { - return x.replace(/:/g, "[:]"); - }); - - return input; - } -} - -export default DefangIPAddresses; - - -/** - * IPV4 regular expression - */ -const IPV4_REGEX = new RegExp("(?:(?:\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d|\\d)(?:\\/\\d{1,2})?", "g"); - - -/** - * IPV6 regular expression - */ -const IPV6_REGEX = new RegExp("((?=.*::)(?!.*::.+::)(::)?([\\dA-Fa-f]{1,4}:(:|\\b)|){5}|([\\dA-Fa-f]{1,4}:){6})((([\\dA-Fa-f]{1,4}((?!\\3)::|:\\b|(?![\\dA-Fa-f])))|(?!\\2\\3)){2}|(((2[0-4]|1\\d|[1-9])?\\d|25[0-5])\\.?\\b){4})", "g");