簡體   English   中英

Scapy:如何訪問自定義數據包的RAW

[英]Scapy: How to access RAW of a custom packet

我正在嘗試訪問此數據包的RAW數據。 我不知道如何提取它並將其存儲在變量中。 我嘗試過使用getlayer方法,但它沒有返回Raw有效負載。

>>> b.show2()
###[ LSP Object ]###
  \common_object_header\
   |###[ PCEP Common Object Header ]###
   |  oclass= LSP
   |  oType= 1L
   |  resflags=
   |  pflag=
   |  iflag=
   |  obLength= 20
  plspid= 0x1L
  flag= 0L
  Cflag=
  oflag= DOWN
  Aflag=
  Rflag=
  Sflag=
  Dflag= D
  \symbolic_path_name\
   |###[ symbolic_path_name_tlv ]###
   |  tlvType= SYMBOLIC-PATHNAME-TLV
   |  tlvLength= 5
   |  tlvValue= 'lsp12'
   |###[ Raw ]###
   |     load= '000' <---- How to access this field???
>>>

>>> b.symbolic_path_name.getlayer(Raw) <--- This does'nt return anything
>>>
>>>
>>> b.symbolic_path_name.getlayer(Raw).load
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'load'
>>>                                                                                                                                                                                    

所以我認為Raw對象是最后一層,代表有效載荷。 所以你可以直接訪問它

last = b.getlayer(Raw)
# Because Raw is last this works as well, e.g. No Padding
last2 = b.lastlayer()
print last.load
print last2.load

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM