简体   繁体   English

如何删除Scapy数据包中的图层

[英]How to delete layer in scapy packet

I am trying to remove a sub layer is scapy and was wondering how I can I select the sublayer? 我正在尝试删除一个子层,但我想知道如何选择该子层?

For context the "Multipath TCP option" is the sub layer that I am interested in removing. 对于上下文,“多路径TCP选项”是我有兴趣删除的子层。 This layer as seen below falls under the TCP layer in scapy. 如下图所示,该层位于scapy中的TCP层之下。 Any help would be great. 任何帮助都会很棒。

###[ TCP ]###
    sport     = http
    dport     = 35446
    seq       = 2431624968
    ack       = 3319728884
    dataofs   = 13L
    reserved  = 0L
    flags     = A
    window    = 233
    chksum    = 0xb518
    urgptr    = 0
    \options   \
     |###[ No Operation ]###
     |  kind      = NOP
     |###[ No Operation ]###
     |  kind      = NOP
     |###[ Timestamp ]###
     |  kind      = Timestamp
     |  length    = 10
     |  timestamp_value= 3970740631
     |  timestamp_echo= 11847444
     |###[ Multipath TCP option ]###
     |  kind      = MpTCP
     |  \mptcp     \
     |   |###[ Multipath TCP Data Sequence Signal ]###
     |   |  length    = 20
     |   |  subtype   = DSS
     |   |  reserved  = 0L
     |   |  flags     = AM
     |   |  data_ack  = 2484809684
     |   |  dsn       = 2431624968
     |   |  subflow_seqnum= 1429
     |   |  datalevel_len= 1428
     |   |  checksum  = 0xa08b

I am not sure, but scapy has the method remove_"eg payload"() . 我不确定,但是scapy具有方法remove_"eg payload"() Maybe you will find more information in the documentation. 也许您会在文档中找到更多信息。 TCPOptions is defined in scapy->layers->inet.py. TCPOptions在scapy-> layers-> inet.py中定义。

Another way is to build a new pcap. 另一种方法是建立新的pcap。 Thats the unclean way, but this works too. 那是不干净的方式,但这也可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM