From 026daba3e0b1815e46f3d4825f02b9a2dfdee0db Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Mon, 27 Jul 2020 11:57:40 +0300 Subject: [PATCH] Validation bugfix (unescaped .), improved comments --- .../configuration-components/ValidationFormats.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/ValidationFormats.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/ValidationFormats.js index db2bcb29c..eb9c5ecc9 100644 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/ValidationFormats.js +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/ValidationFormats.js @@ -1,4 +1,4 @@ -const ipRegex = '((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' +const ipRegex = '((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' const cidrNotationRegex = '([0-9]|1[0-9]|2[0-9]|3[0-2])' const hostnameRegex = '^([A-Za-z0-9]*[A-Za-z]+[A-Za-z0-9]*.?)*([A-Za-z0-9]*[A-Za-z]+[A-Za-z0-9]*)$' @@ -9,10 +9,10 @@ export const formValidationFormats = { function buildIpRangeRegex(){ return new RegExp([ - '^'+ipRegex+'$|', // Single IP - '^'+ipRegex+'-'+ipRegex+'$|', // IP range IP-IP + '^'+ipRegex+'$|', // Single: IP + '^'+ipRegex+'-'+ipRegex+'$|', // IP range: IP-IP '^'+ipRegex+'/'+cidrNotationRegex+'$|', // IP range with cidr notation: IP/cidr - hostnameRegex, // IP range with cidr notation: IP/cidr + hostnameRegex, // Hostname: target.tg ].join('')) }