-
-
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
[Draft Pull Request] Proof of concept Mac utun support #4100
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4100 +/- ##
==========================================
+ Coverage 81.68% 81.95% +0.26%
==========================================
Files 328 328
Lines 75497 75875 +378
==========================================
+ Hits 61668 62181 +513
+ Misses 13829 13694 -135
|
Thanks for this PR. I will give it a try. In the meantine, could you fix the PEP-08 issues https://github.com/secdev/scapy/actions/runs/5920584081/job/16053137679?pr=4100#step:5:1 ? |
self.kernel_packet_class = MacOSUtunPacketInfo | ||
self.mtu_overhead = 4 | ||
|
||
match = re.match(r"([a-z]+)([0-9]+)", self.iface.decode("utf-8"), re.I) |
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.
Don't need to import re
or decode bytestrings - just strip the prefix (b'utun'
) from the string:
# self.iface = b'utun0'
interface_num = int(self.iface[4:])
elif BSD: | ||
if not (self.iface.startswith(b"tap") or | ||
self.iface.startswith(b"tun") or | ||
self.iface.startswith(b"utun")): |
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.
utun
is Darwin-specific, so shouldn't be attempted on BSD.
However, tap
and tun
on Darwin are provided by a third-party kext (which works the same way as BSD's tap
and tun
), so Darwin will still need to hit this BSD
branch.
IntField("addr_family", socket.AF_INET) | ||
] | ||
|
||
def guess_payload_class(self, payload): |
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.
Use bind_layers()
rather than implementing guess_payload_class
.
Resolves #4049