MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / get_host_by_mac

Method get_host_by_mac

db_manager.py:892–905  ·  view source on GitHub ↗

Get host record by MAC address.

(self, mac: str)

Source from the content-addressed store, hash-verified

890
891 if cursor.rowcount > 0:
892 logger.info(f"Deleted host: {mac}")
893 return True
894 else:
895 logger.debug(f"No host found to delete: {mac}")
896 return False
897
898 except Exception as e:
899 logger.error(f"Failed to delete host {mac}: {e}")
900 return False
901
902 def get_host_by_mac(self, mac: str) -> Optional[Dict]:
903 """Get host record by MAC address."""
904 try:
905 with self.get_connection() as conn:
906 cursor = conn.cursor()
907 cursor.execute("SELECT * FROM hosts WHERE mac = ?", (mac.lower().strip(),))
908 row = cursor.fetchone()

Callers 1

db_manager.pyFile · 0.80

Calls 5

get_connectionMethod · 0.95
cursorMethod · 0.80
errorMethod · 0.80
executeMethod · 0.45
fetchoneMethod · 0.45

Tested by

no test coverage detected