在 ICMP scapy 中更改 IP

Change IP in ICMP scapy

我有这个 ICMP 数据包,我想更改 IP in ICMP 字段(我也试图了解这个内部 IP header 是什么),我该如何访问它? 我已经尝试过 pack[ICMP].fieldname 之类的东西,但到目前为止没有任何效果。

    ###[ IP ]### 
     version   = 4
     ihl       = 5
     tos       = 0x0
     len       = 84
     id        = 2531
     flags     = DF
     frag      = 0
     ttl       = 63
     proto     = icmp
     chksum    = 0x1ab3
     src       = 192.168.100.2
     dst       = 192.168.100.1
     \options   \
###[ ICMP ]### 
        type      = dest-unreach
        code      = fragmentation-needed
        chksum    = 0xfcfb
        reserved  = 0
        length    = 0
        nexthopmtu= 0
        unused    = ''
###[ IP in ICMP ]### 
           version   = 9
           ihl       = 2
           tos       = 0x5f
           len       = 59487
           id        = 0
           flags     = 
           frag      = 0
           ttl       = 231
           proto     = esp
           chksum    = 0x800
           src       = 0.0.0.0
           dst       = 16.17.18.19
           \options   \
            |###[ IP Option Router Alert ]### 
            |  copy_flag = 0
            |  optclass  = control
            |  option    = router_alert
            |  length    = 21
            |  alert     = 5655
            |###[ IP Option ]### 
            |  copy_flag = 0
            |  optclass  = control
            |  option    = upstream_multicast_packet
            |  length    = 25
            |  value     = '\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+'

没关系我找到了答案:ICMP() 错误封装了他的原始 IP header,所以它是 IP/ICMP/IP

IPerror 是允许更改的字段。