-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
scapy “Ether()” does not have “chksum” argument #2086
Comments
The Ethernet FCS is added in the last bytes of a Packet, even though it doesn't look obvious when looking at a wireshark dissection. See: https://stackoverflow.com/a/55918627/5459467
In fact, most OSes have decided that they should be managing the FCS, and that applications shouldn't have access to those. Only some (usually Linux) let you see them. This is how they say it on Wireshark
To parse the FCS, we would need to be so sure that our implementation of the various protocols is correct, that if (as there often isn't) a padding is present at the end of a packet we just dissected, it's the checksum. That's what wireshark does. See https://stackoverflow.com/a/30515791/5459467 But because Scapy let you mess around with packets, and build very inconsistent stuff, it wouldn't make much sense. Hope this answers your question :-) |
Darn, well thanks for the confirmation and further explanation; I understand. I had read that stackoverflow post and wanted to reach out. I was looking to use scapy to specify a bad fcs and cause a crc error. I'll look at other approaches. |
If your OS does support FCS, you can craft this behavior quite easily: packet = Ether()/IP()/ICMP()
chksum = b"\0\0\0\0"
packet /= chksum
sendp(packet) and on dissection:
|
@gpotter2
|
The "frame check sequence" is a 32-bit CRC "checksum" over the entire Ethernet frame, starting with the DMAC and covering the SMAC, type, and payload. It's transmitted as the last four bytes of an Ethernet frame, just before the interpacket gap.
I expect Scapy's Ether() method to have an argument for a packet attribute for this field. It does not.
Note that Scapy methods like IP() and TCP()/UDP() contain a checksum argument ("chksum") for the additional checksums defined for those protocols.
For example...
Will FCS be implemented on Ethernet frames in Scapy?
The text was updated successfully, but these errors were encountered: