简体   繁体   中英

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. This layer as seen below falls under the TCP layer in scapy. 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"() . Maybe you will find more information in the documentation. TCPOptions is defined in scapy->layers->inet.py.

Another way is to build a new pcap. Thats the unclean way, but this works too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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