Repository navigation
Conversation
ListServices, ListIdentity and ListInterfaces encoded itemCount (and the ListInterfaces itemLength) big-endian, so a device reply with one item dissected as itemCount=256. The counts and lengths also defaulted to 0, so a built reply wrote 0 for itemCount, itemLength and productNameLength, and peers (and scapy itself) read an empty product name. Items after the first were dissected as Raw. Encode them little-endian, compute them when left unset, and split the items of a list. AI-Assisted: yes (Claude Opus 5.5, GPT-6.1 Sol)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5251 +/- ##
=======================================
Coverage 80.41% 80.42%
=======================================
Files 376 376
Lines 98405 98414 +9
=======================================
+ Hits 79137 79149 +12
+ Misses 19268 19265 -3
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The ListServices, ListIdentity and ListInterfaces replies in
enipTCP.pyencodeitemCount(and the ListInterfacesitemLength) big-endian, while EtherNet/IP is little-endian. Their counts and lengths also default to 0 instead ofNone, so scapy never computes them. A device reply with one item dissects asitemCount=256, and a built ListIdentity reply hasitemCount,itemLengthandproductNameLengthset to 0. The fix encodes these fields little-endian, computes them when they are left unset, and addsextract_paddingso that a list with more than one item dissects into separate items.Before:
After:
A reply built this way (with
ENIPTCP(commandId=0x63, length=None)) is read by pycomm3CIPDriver.list_identity()and by tshark with the right product name, which they do not find on master.Before the packet is built,
itemCountanditemLengthnow readNoneinstead of 0. The default-value tests check the built bytes instead.This message was written with the help of AI (Claude Opus 5.5).