You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def getMac(ip):
try:
result = os.popen('arp -a '+ip)
data = result.read()
mac = re.findall(r"\b([0-9a-fA-F]{2})\b", data)
if mac!=None:
return mac[0]+"-"+mac[1]+"-"+mac[2]+"-"+mac[3]+"-"+mac[4]+"-"+mac[5]
return ""
except:
pass
return ""
改成这样可行
def getMac(ip):
try:
result = os.popen('arp -a '+target)
data = result.read()
mac = re.findall("(([a-fA-F0-9]{2}[:-]){5}[a-fA-F0-9]{2})", data)
if mac!=None:
return mac[0][0]
return ""
except:
return ""
The text was updated successfully, but these errors were encountered:
源代码是
改成这样可行
The text was updated successfully, but these errors were encountered: