网络协议从入门到上瘾--Scapy初探

什么是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

如果对云计算感兴趣,可以关注我的微信公众号:

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值