Skip to content
New issue

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

Packet().overload_fields can be overwritten #52

Merged
merged 3 commits into from Feb 9, 2016

Conversation

p-l-
Copy link
Member

@p-l- p-l- commented Feb 8, 2016

This is needed by fragment(), which has been broken since PR #11.

@p-l-
Copy link
Member Author

p-l- commented Feb 9, 2016

Before:

>>> fragment(IP() / ("X" * 10), 8)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "scapy/layers/inet.py", line 766, in fragment
    r.overload_fields = p[IP].payload.overload_fields.copy()
  File "scapy/packet.py", line 217, in __setattr__
    except AttributeError:
AttributeError: 'Raw' object attribute 'overload_fields' is read-only

After:

>>> fragment(IP() / ("X" * 10), 8)
[<IP  flags=MF frag=0 |<Raw  load='XXXXXXXX' |>>, <IP  flags= frag=1 |<Raw  load='XX' |>>]

@guedou
Copy link
Member

guedou commented Feb 9, 2016

I think that it would be a good idea to addd this call to fragment to the unit tests.

@p-l-
Copy link
Member Author

p-l- commented Feb 9, 2016

@guedou agreed! Plus that allowed me to notice that defragment() was broken, too :)

try:
dct["_%s" % attr] = dct.pop(attr)
if cls.__name__ == "ISAKMP_payload_SA":
print dct["_%s" % attr]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that this is a debugging statement that was forgotten =)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum. Thanks :)

This is needed by fragment(), which has been broken since PR secdev#11.
As suggested by @guedou, this adds tests for fragment() and
defragment() functions.
guedou added a commit that referenced this pull request Feb 9, 2016
Packet().overload_fields can be overwritten
@guedou guedou merged commit 6c1c859 into secdev:master Feb 9, 2016
@p-l- p-l- deleted the fix-fragment branch February 10, 2016 06:21
@guedou guedou mentioned this pull request Mar 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants