python中的数据包处理模块scapy调研笔记

Scapy简介
Scapy的是一个强大的交互式数据包处理程序(使用python编写)。它能够伪造或者解码大量的网络协议数据包,能够发送、捕捉、匹配请求和回复包等等。它可以很容易地处理一些典型操作,比如端口扫描,tracerouting,探测,单元测试,攻击或网络发现(可替代hping,NMAP,arpspoof,ARP-SK,arping,tcpdump,tethereal,P0F等)。最重要的他还有很多更优秀的特性——发送无效数据帧、注入修改的802.11数据帧、在WEP上解码加密通道(VOIP)、ARP缓存攻击(VLAN)等,这也是其他工具无法处理完成的。

Scapy is a Python program that enables the user to send, sniff and dissect and forge network packets. This capability allows construction of tools that can probe, scan or attack networks.
sniff 嗅探
dissect 解剖
forge  伪造
fingerprinting  指纹识别

安装方法
模块官网
https://pypi.python.org/pypi/scapy
目前最新版本号是2.3.2
wget 'https://pypi.python.org/packages/source/s/scapy/scapy-2.3.2.tar.gz#md5=b8ca06ca3b475bd01ba6cf5cdc5619af'
tar zxvf scapy-2.3.2.tar.gz
cd scapy-2.3.2
python setup.py install
然后在命令行确认下:
import scapy
from scapy.all import *
conf
查看是否有错误,然后运行参考文献[1]中的例子?

另外在ubuntu上需要额外安装标准依赖包
sudo apt-get install tcpdump graphviz imagemagick python-gnuplot python-crypto python-pyx

/符号表示两个链路层的组合
>>>> IP()/TCP()
>>>> IP()/TCP()/"GET /HTTP/1.0\r\n\r\n"     数据部分可以直接使用字符串 

Run Scapy with root priviledges.
In Scapy v2 use from scapy.all import * instead of from scapy import *.
in Python _ (underscore) is the latest result
The sendp() function will work at layer 2. It’s up to you to choose the right interface and the right link layer protocol.

正确的使用方法
sudo scapy
进入scapy交互环境,输入quit()退出并返回shell命令行环境
查看某个函数的具体用法
help(sniff)

参考文献
[1].http://www.cnblogs.com/xiaowuyi/p/3329795.html
[2].http://blog.csdn.net/wang_walfred/article/details/40044141  非常重要,对各函数的解释非常详细
[3].http://blog.csdn.net/wang_walfred/article/details/40072751   非常精彩
[4].http://www.secdev.org/projects/scapy/doc/installation.html   官网安装文档
[5].http://www.secdev.org/projects/scapy/doc/usage.html  详见用法说明,非常详细
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值