什么是Scapy?
没有人能比Scapy的作者更好的介绍Scapy。
Scapy is a powerful interactive packet manipulation program. It is able to forge or decode packets of a wide number of protocols, send them on the wire, capture them, match requests and replies, and much more. It can easily handle most classical tasks like scanning, tracerouting, probing, unit tests, attacks or network discovery
It also performs very well at a lot of other specific tasks that most other tools can't handle, like sending invalid frames, injecting your own 802.11 frames, combining technics (VLAN hopping+ARP cache poisoning, VOIP decoding on WEP encrypted channel, ...), etc.
Scapy是一个强大的交互式的数据包操作程序。它能够伪造或解码许多种类的协议包,并在网络中发送,嗅探,过滤请求和应答等等。同时,它也能很轻松的实现传统的网络任务,比如扫描,链路追踪,刺探,单元测试,攻击和网络发现等。
安装Scapy
有很多种方法把Scapy安装到你的系统平台。最简单的安装方式如下:
pip install scapy
[root@controller ~]# scapy
AutoCompletion, History are disabled.
aSPY//YASa
apyyyyCY//YCa |
sY//YSpcs scpCY//Pp | Welcome to Scapy
ayp ayyyyyyySCP//Pp syY//C | Version 2.4.4
AYAsAYYYYYYYY///Ps cY//S |
pCCCCY//p cSSps y//Y | https://github.com/secdev/scapy
SPPPP///a pP///AC//Y |
A//A cyPC | Have fun!
p///Ac sC///a |
PYCpc A//A | Craft packets like I craft my beer.
scccccp///pSP///p p//Y | -- Jean De Clerck
sY/y caa S//P |
cayCyayP//Ya pY/Ya
sY/PsYYCc aC//Yp
sc sccaCY//PCypaapyCP//YSs
spCPY//YPSps
ccaacs
>>>
Scapy指定网口
如果在你的电脑上有多个物理网口,或许你不得不检查当前Scapy使用的是哪个默认网口。在Scapy终端,通过conf命令可以查看默认网口:
>>> conf.iface
'ens192'
如果想修改Scapy使用的默认网口,可用使用如下命令:
>>> conf.iface = 'eth0'
Root权限
一些处理发送流量的Scapy函数需要用到root权限,所以在启动Scapy终端时,可以使用sudo scapy方式。如果是Python脚本,则需要类似如下操作:
sudo python script.py
如果对云计算感兴趣,可以关注我的微信公众号: