[英]Python Scapy and read a pcap in reverse mode
I'm reading a pcap file using the rdpcap
function: 我正在使用rdpcap
函数读取pcap文件:
s = rdpcap(pcap)
I'd like to know how to reverse s
: it should be a list, but I tried with: 我想知道如何反转s
:它应该是一个列表,但是我尝试了:
rev_s = s.reverse()
and it doesn't work: it gives me the SyntaxError: invalid syntax
error. 它不起作用:它给了我SyntaxError: invalid syntax
错误。
Can anyone help me, please? 有人可以帮我吗?
For me, this works: 对我来说,这有效:
>>> a = rdpcap("test.pcap")
>>> b = a.reverse()
>>> c = a[::-1]
(you can also use the slice notation to create a reversed copy of the list) (您也可以使用切片符号创建列表的反向副本)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.