查看本机所有的网卡 show_interfaces()

1
show_interfaces()

image-20230525101336860

监听数据 sniff(count=<数量>)

1
sniff(count=<数量>,iface=<Netname>,fileter="<过滤条件eg:icmp\udp\tcp>")

image-20230525093650422

image-20230525101427570

发送数据包

1
2
pkg = IP(src='发送方ip',dst='接收方ip')/ICMP()/"数据包"
send(pkg,inter=1,count=5)#发送5次数据包,每次间隔1秒

ARP

1
ARP(psrc='发送方ip',pdst='接收方ip')/ICMP()/"数据包"

接收响应

1
pkg = sr(IP(src="192.168.6.121",dst="192.168.88.128")/ICMP()/"This is a roboot,HHHHHHHHHHH")