Is the provided IP in one of the provided CIDRs? Returns a true/false result
(self, ip, cidrs)
| 231 | self.Tracked_CIDRs.append(IPNetwork(result["zone"])) |
| 232 | |
| 233 | def check_in_cidr(self, ip, cidrs): |
| 234 | """ |
| 235 | Is the provided IP in one of the provided CIDRs? |
| 236 | Returns a true/false result |
| 237 | """ |
| 238 | try: |
| 239 | if isinstance(ip, str): |
| 240 | local_ip = IPAddress(ip) |
| 241 | else: |
| 242 | local_ip = ip |
| 243 | |
| 244 | for network in cidrs: |
| 245 | if local_ip in network: |
| 246 | return True |
| 247 | except Exception as e: |
| 248 | self._logger.debug(f"Error checking CIDR: {e}") |
| 249 | return False |
| 250 | |
| 251 | return False |
| 252 | |
| 253 | def find_cidr(self, ip, cidrs): |
| 254 | """ |
no outgoing calls
no test coverage detected