[Draft Pull Request] Proof of concept Mac utun support#4100
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
|
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.
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.
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.
Use bind_layers() rather than implementing guess_payload_class.
|
Superseded by #4816 |
Resolves #4049