Normalize a port entry string for consistent comparisons
(port_entry)
| 3990 | if not line or line.startswith('Interface:') or line.startswith('Starting') or line.startswith('Ending'): |
| 3991 | continue |
| 3992 | |
| 3993 | parts = re.split(r'\s+', line) |
| 3994 | if len(parts) < 2: |
| 3995 | continue |
| 3996 | |
| 3997 | ip_candidate, mac_candidate = parts[0], parts[1] |
| 3998 | if not (_is_valid_ipv4(ip_candidate) and MAC_REGEX.match(mac_candidate)): |
| 3999 | continue |
| 4000 | |
| 4001 | vendor = ' '.join(parts[2:]).strip() if len(parts) > 2 else '' |
| 4002 | hosts[ip_candidate] = { |
| 4003 | 'mac': _normalize_mac(mac_candidate), |
| 4004 | 'vendor': vendor |
| 4005 | } |
| 4006 | |
| 4007 | return hosts |
| 4008 | |
| 4009 | |
| 4010 | def build_pseudo_mac_from_ip(ip): |
| 4011 | try: |
| 4012 | octets = [int(part) for part in ip.split('.')] |
no outgoing calls
no test coverage detected