杨莎莉(scapy 学习send sendp sr hexdump )

杨莎莉:scapy 学习send sendp sr hexdump wrpcap rdpcap。

#!/bin/python3
# -*-coding:utf-8 -*-

# Author: Kaer
# TG: seedccy
# QQ: 188189858

from scapy.all import *
#构建一个ICMP包到192.168.5.100
pkt=IP(dst="192.168.5.100")/ICMP()
#发送IP包
send(pkt)
#构建并且发送mac地址到数据包
sendp(Ether(dst="ff:ff:ff:ff:ff:ff"))

#发送并接收数据包,ans为接收到的数据包列表 uans为没有接收到的-一般uans为空列表
ans,uans=sr(pkt)
#summary()方法是简单显示出人类能看懂的数据发收情况
ans.summary()
#sr1和sr一样,只是没没有未接收到的uans,所以只需要1个变量接收
ans=sr1(pkt)
ans.summary()
#16进制数据来显示数据包
print(hexdump(pkt))
# 保存数据包
wrpcap("temp.cap",pkt)
#读取存储的数据包
rdpcap("temp.cap")
本文《杨莎莉(scapy 学习send sendp sr hexdump )》由网赚联盟( wangzhuan.org.cn )整理或原创,感谢您的阅读。

随机文章

SEO小小课堂网
站长导航
友情链接交换
关键词排名优化
GEO培训
SEO小小课堂网
站长导航
友情链接交换

百度搜索“网赚联盟”即可找到本站,微信搜索“小小课堂网”关注小小课堂网公众号。网赚联盟( wangzhuan.org.cn )欢迎用户投稿,发布者:用户投稿,文章版权归作者所有,投稿文章不代表网赚联盟立场,中二少年发布为网赚联盟原创文章,转载请注明出处:https://wangzhuan.org.cn/57254.html