From cc78076d32ee3b83550eb721c280526d83ff9ab5 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Fri, 24 Jul 2020 10:45:33 +0300 Subject: [PATCH] Added hostname's to IP range validation --- .../components/configuration-components/ValidationFormats.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ce605be39..db2bcb29c 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,5 +1,6 @@ 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]*)$' export const formValidationFormats = { 'ip-range': buildIpRangeRegex(), @@ -10,7 +11,8 @@ function buildIpRangeRegex(){ return new RegExp([ '^'+ipRegex+'$|', // Single IP '^'+ipRegex+'-'+ipRegex+'$|', // IP range IP-IP - '^'+ipRegex+'/'+cidrNotationRegex+'$' // IP range with cidr notation: IP/cidr + '^'+ipRegex+'/'+cidrNotationRegex+'$|', // IP range with cidr notation: IP/cidr + hostnameRegex, // IP range with cidr notation: IP/cidr ].join('')) }