链接地址: https://github.com/dhgdhg/Scapy-Note

八.数据链路层

8.1.Ether:scapy.layers.l2.Ether

<details>
  • dst

    • Destination MAC(48 bits)
  • src

    • Source MAC(48 bits)
  • type

    • Type(16 bits)

    • 部分常见的以太类型

      <details>
      以太类型编号 代表协议
      0x0800 Internet Protocol version 4
      0x0806 Address Resolution Protocol
      0x0842 Wake-on-LAN
      0x22F0 Audio Video Transport Protocol as defined in IEEE Std 1722-2011
      0x22F3 IETF TRILL Protocol
      0x6003 DECnet
      0x8035 Reverse Address Resolution Protocol
      0x809B AppleTalk
      0x80F3 AppleTalk
      0x8100 IEEE 802.1Q
      0x8137 IPX
      0x8138 IPX
      0x8204 QNX Qnet
      0x86DD Internet Protocol Version 6
      0x8808 Ethernet flow control
      0x8809 IEEE 802.3
      0x8819 CobraNet
      0x8847 MPLS
      0x8848 MPLS
      0x8863 PPPoE
      0x8864 PPPoE
      0x8870 Jumbo Frames
      0x887B HomePlug 1.0 MME
      0x888E IEEE 802.1X
      0x8892 PROFINET
      0x889A HyperSCSI
      0x88A2 ATA over Ethernet
      0x88A4 EtherCAT
      0x88A8 IEEE Std 802.1Q - Service VLAN tag identifier (S-Tag)
      0x88AB Ethernet Powerlink
      0x88CC 链路层发现协议
      0x88CD SERCOS III
      0x88E1 HomePlug AV MME
      0x88E3 Media Redundancy Protocol (IEC62439-2)
      0x88E5 IEEE 802.1AE
      0x88E7 IEEE 802.1ah
      0x88F7 Precision Time Protocol
      0x8902 IEEE 802.1ag
      0x8906 Fibre Channel over Ethernet
      0x8914 FCoE
      0x8915 RDMA over Converged Ethernet
      0x892F High-availability Seamless Redundancy
      0x9000 Ethernet Configuration Testing Protocol
      0x9100 double tagging
      </details>
</details>

8.2.ARP:scapy.layers.l2.ARP

通过解析网络层地址来找寻数据链路层地址的网络传输协议

<details>
  • 硬件字段
    • hwtype
      • Hardware type
      • 此字段指定网络链接协议类型. 例如:以太网是1.
    • hwlen
      • Hardware address length
      • 硬件地址的长度(以字节为单位). 以太网地址长度为6.
    • hwsrc
      • Sender hardware address
      • 发送者的媒体地址. 在ARP请求中, 此字段用于指示发送请求的主机的地址. 在ARP应答中, 此字段用于指示请求正在寻找的主机地址
    • hwdst
      • Target hardware address
      • 接收人的媒体地址. 在ARP请求中, 该字段被忽略. 在ARP应答中, 此字段用于指示发起ARP请求的主机的地址.
  • 协议字段
    • ptype
      • Protocol type
      • 此字段指定ARP请求所针对的网络协议. 对于IPv4, 它的值是0x0800. 允许的PTYPE值与EtherType值共享一个编号空间
    • plen
      • Protocol address length
      • 网络地址的长度(以字节为单位). 网络协议在PTYPE中指定. 示例:IPv4地址长度为4.
    • psrc
      • Sender protocol address
      • 发送者的网络地址
    • pdst
      • Target protocol address
      • 目标接收方的网络地址.
  • op
    • Operation
    • 指定发送方执行的操作:1表示请求, 2表示应答.
</details>

8.3.Dot1Q:scapy.layers.l2.Dot1Q

IEEE 802.1Q, IEEE 802.1q定义一个关于VLAN连接介质访问控制层和IEEE 802.1D生成树协议的具体概念模型. 这个模型允许各个独立的VLAN与以太网交换机的数据链路层或路由器互相连接.

<details>
  • prio
    • priority
  • vlan
    • virtual LANs
  • type
  • id
</details>