()
| 6476 | new_row['MAC Address'] = mac_to_store |
| 6477 | else: |
| 6478 | # Don't generate pseudo MAC - let ARP cache provide real MAC addresses |
| 6479 | new_row['MAC Address'] = '' |
| 6480 | new_row['Alive'] = alive_value |
| 6481 | # CRITICAL: Don't set Ports to '' - preserve existing ports if they exist |
| 6482 | # The Ports field should only be updated by scanning.py during actual port scans |
| 6483 | # Leave it empty for new entries, but scanning.py will populate it |
| 6484 | new_row['Ports'] = new_row.get('Ports', '') # Preserve if exists, empty if new |
| 6485 | rows.append(new_row) |
| 6486 | updated_row = new_row |
| 6487 | |
| 6488 | with open(netkb_path, 'w', newline='', encoding='utf-8') as f: |
| 6489 | writer = csv.DictWriter(f, fieldnames=headers) |
| 6490 | writer.writeheader() |
no test coverage detected