Obtain MAC Address from Devices using Python

前端 未结 8 976
余生分开走
余生分开走 2020-11-30 03:34

I\'m looking for a way (with python) to obtain the layer II address from a device on my local network. Layer III addresses are known.

The

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-30 03:47

    A simple solution using scapy, to scan the 192.168.0.0/24 subnet is as follows:

    from scapy.all import *
    
    ans,unans = arping("192.168.0.0/24", verbose=0)
    for s,r in ans:
        print("{} {}".format(r[Ether].src,s[ARP].pdst))
    

提交回复
热议问题