-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Report the interface ID used to capture pcapng files #4729
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
base: master
Are you sure you want to change the base?
Conversation
a18382f
to
ad116e9
Compare
Hi, thanks for the PR. |
Hi @gpotter2, we'd like to use the interface ID of the pcapng in a wireshark-way In the python code, it would be like this:
In pcapng, Then, parsing the packets of the pcapng, we didn't find a way to get this information from a Packet instance. Thanks in advance |
@@ -1952,6 +1955,7 @@ def _read_block_pkt(self, block, size): | |||
self.endian + "HH4I", | |||
block[:20], | |||
) | |||
ifname = self.interface_names[intid] if intid < len(self.interface_names) else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to use a
try:
...
except KeyError:
pass
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, it's fixed. Thanks
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4729 +/- ##
===========================================
- Coverage 82.20% 49.31% -32.89%
===========================================
Files 361 343 -18
Lines 87195 86931 -264
===========================================
- Hits 71679 42873 -28806
- Misses 15516 44058 +28542
🚀 New features to boost your workflow:
|
* On pcapng files, you can have several capture interfaces. We report this information to be able to use it on another classes
ad116e9
to
58b3bc8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi. Sorry again for the delay of review. Thanks a lot for the PR and your interest in Scapy !
I understand your point, my only question was to know if sniffed_on
didn't already fill that role by providing the interface name. At least that's what it's supposed to do.
Do you specifically need the interface ID for your application? I feel like it would be like storing the same information twice to include both the interface id and name in every packet.
I don't think adding a unit test for this is worth it, since We just report a field to the upper layer that is already parsed.
Note: It's my first contribution to scapy. Let me know if I missed something :-)
Checklist:
cd test && ./run_tests
ortox
)fixes #4731