We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New function _raw_packet_cache_field_value from commit 4aaed1d breaks some use of PacketListField.
_raw_packet_cache_field_value
PacketListField
2.6.0rc1
all
No response
The following code stopped working after this commit.
from scapy.packet import Packet from scapy.fields import StrField from scapy.fields import PacketListField import re class HeaderKey(StrField): def getfield(self, pkt, s): m = re.match(b"([!-9;-~]+):[ \t]*", s) if m is None: return s, None _, stop = m.span() return s[stop:], m.groups()[0] def addfield(self, pkt, s, val): if val is None: return s else: return s + self.i2m(pkt, val) + b': ' class Header(Packet): fields_desc = [ HeaderKey("key", None), ] class MIME(Packet): fields_desc = [ PacketListField ("headers", [], Header), ] mime8 = b'Content-Length: 2' p = MIME(mime8) p.show() p.headers[0] = Header(key='Content-Length')/b'3' p.show() print(p.build()) assert(p.build() == b'Content-Length: 3')
###[ MIME ]### \headers \ |###[ Header ]### | key = b'Content-Length' |###[ Raw ]### | load = b'2' ###[ MIME ]### \headers \ |###[ Header ]### | key = b'Content-Length' |###[ Raw ]### | load = b'3' b'Content-Length: 2' Traceback (most recent call last): File "/tmp/a.py", line 35, in <module> assert(p.build() == b'Content-Length: 3') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError
###[ MIME ]### \headers \ |###[ Header ]### | key = 'Content-Length' |###[ Raw ]### | load = '2' ###[ MIME ]### \headers \ |###[ Header ]### | key = 'Content-Length' |###[ Raw ]### | load = '3' b'Content-Length: 3'
The text was updated successfully, but these errors were encountered:
Fix nested ListFields
4aaed1d
Successfully merging a pull request may close this issue.
Brief description
New function
_raw_packet_cache_field_value
from commit 4aaed1d breaks some use ofPacketListField
.Scapy version
2.6.0rc1
Python version
all
Operating system
all
Additional environment information
No response
How to reproduce
The following code stopped working after this commit.
Actual result
Expected result
Related resources
No response
The text was updated successfully, but these errors were encountered: