标签:span tar python src ip地址 get eth bsp rom
代码
1 import sys
2 if len(sys.argv) != 2:
3 print("Usage:aprPing <IP>\n eg:arpPing 192.168.1.1")
4 sys.exit(1)
5 from scapy.all import srp,Ether,ARP
6 ans,unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=sys.argv[1]),timeout=3)
7 for s,r in ans:
8 print("Target is alive")
9 print(r[Ether].src,r[ARP].psrc)
使用sys模块来输入数据,使用srp()函数扫描输入ip,如果扫描到返回的包,则会被遍历,打印出目标MAC地址和IP地址
调用
eg: python arpPing.py 192.168.1.128
标签:span tar python src ip地址 get eth bsp rom
原文地址:https://www.cnblogs.com/code0x/p/12236982.html