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

Method get_mac_address

actions/scanning.py:1036–1053  ·  view source on GitHub ↗

Retrieves the MAC address for the given IP address and hostname.

(self, ip, hostname)

Source from the content-addressed store, hash-verified

1034 return info
1035
1036 def get_mac_address(self, ip, hostname):
1037 """
1038 Retrieves the MAC address for the given IP address and hostname.
1039 """
1040 try:
1041 mac = None
1042 retries = 5
1043 while not mac and retries > 0:
1044 mac = gma(ip=ip)
1045 if not mac:
1046 time.sleep(2) # Attendre 2 secondes avant de réessayer
1047 retries -= 1
1048 if not mac:
1049 mac = f"{ip}_{hostname}" if hostname else f"{ip}_NoHostname"
1050 return mac
1051 except Exception as e:
1052 self.logger.error(f"Error in get_mac_address: {e}")
1053 return None
1054
1055 class PortScanner:
1056 """

Callers 4

gmaFunction · 0.80
mainFunction · 0.80

Calls 3

gmaFunction · 0.85
errorMethod · 0.80
sleepMethod · 0.45

Tested by

no test coverage detected