def validateAllowedIP(allowedIPs): validateCheck = False if isinstance(allowedIPs, str): allowedIPArray = allowedIPs.split(',') pattern = re.compile(r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"); pattern2 = re.compile(r"^regex\([0-9*.\\]{0,1000}\)$"); for allowedIP in allowedIPArray: allowedIP = allowedIP.strip() if pattern.match(allowedIP) or pattern2.match(allowedIP) or allowedIP == "*": validateCheck = True else: validateCheck = False return validateCheck return validateCheck :neocat_shocked_googly_woozy:
Conversation
Notices
-
Embed this notice
Puniko ? (puniko@mk.absturztau.be)'s status on Tuesday, 27-Aug-2024 20:45:49 JST Puniko ? -
Embed this notice
Puniko ? (puniko@mk.absturztau.be)'s status on Tuesday, 27-Aug-2024 20:57:01 JST Puniko ? @flandrescarlet@uwu.social :neocat_googly_woozy: ye, this is terrible code. and not just from the legacy only support standpoint
-
Embed this notice
Flandere (flandrescarlet@uwu.social)'s status on Tuesday, 27-Aug-2024 20:57:02 JST Flandere @puniko IPv6 says hiiiiiiiiiiiiii~ IPv4 subnetting says hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii~ :blobcatdevil:
-
Embed this notice