zoukankan      html  css  js  c++  java
  • scapy模块分析数据包

    scapy模块分析数据包

    scapy是python写的一个功能强大的交互式数据包处理程序,可用来发送、嗅探、解析和伪造网络数据包,常常被用到网络攻击和测试中。----(网上抄的介绍...)

    https://scapy.readthedocs.io/en/latest/usage.html#starting-scapy 官方文档

    pip install scapy 安装scapy就好了

    from scapy.all import *
    a = rdpcap("data.pcap") #读取本地数据包
    >>> a
    <data.pcap: TCP:7068 UDP:326 ICMP:2120 Other:107>
    a.summary()   #displays a list of summaries of each packet,这个太多了
    
    Command Effect
    summary() displays a list of summaries of each packet
    nsummary() same as previous, with the packet number
    conversations() displays a graph of conversations
    show() displays the preferred representation (usually nsummary())
    filter() returns a packet list filtered with a lambda function
    hexdump() returns a hexdump of all packets
    hexraw() returns a hexdump of the Raw layer of all packets
    padding() returns a hexdump of packets with padding
    nzpadding() returns a hexdump of packets with non-zero padding
    plot() plots a lambda function applied to the packet list
    make table() displays a table according to a lambda function

    看一点效果图

    Q截图2018050412463

    Q截图2018050412481

    类似于 python 中的 list 类型, 可以使用下标访问,长度可以使用 len 计算 ,但数据不是list也不是string,如果要进行str操作需要,str(dpkg)

    如果安装了pyx模块,则可以将分析结果转换为图片格式(pyx只支持python3)

    dpkt.psdump() draws a PostScript diagram with explained dissection
    dpkt.pdfdump() draws a PDF with explained dissection
  • 相关阅读:
    Ubuntu下多版本软件的管理
    关于高考
    Openca安装笔记
    Nginx+uwsgi+python配置
    cpabe的安装
    线形同余法求随机数
    world wind 之 applet 篇
    0909 海贼王我当定了
    实验0:了解和熟悉操作系统
    0316复利计算器3.0
  • 原文地址:https://www.cnblogs.com/GH-D/p/8991972.html
Copyright © 2011-2022 走看看