From 912c3b7481e4d81f1c762d94bae2093c8c529e52 Mon Sep 17 00:00:00 2001 From: Annika Wickert Date: Wed, 2 Oct 2019 15:48:00 +0200 Subject: [PATCH 1/2] Add macos support via pypcap --- traceflow/socket_handler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/traceflow/socket_handler.py b/traceflow/socket_handler.py index 91acca4..5629ad3 100644 --- a/traceflow/socket_handler.py +++ b/traceflow/socket_handler.py @@ -19,9 +19,9 @@ def __init__(self, daddr): self.ip_daddr = daddr os_release = platform.system() if os_release == "Darwin": - # Boned. TODO: Work on fixing this. - print("Detected Mac OS - Cannot support writing of raw IP packets, exiting") - exit(1) + # Use pypcap on osx to send raw packets + import pcap + self.raw_socket = pcap.pcap() if os_release.endswith("BSD"): # BSD - Need to explicit set IP_HDRINCL. # BSD - Need to explicitly calculate IP total length From faafba83cec57d83935789e40683c1fb6d58c4e8 Mon Sep 17 00:00:00 2001 From: Ruairi Carroll Date: Wed, 2 Oct 2019 18:57:39 +0100 Subject: [PATCH 2/2] Update socket_handler.py - adding debug logging --- traceflow/socket_handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/traceflow/socket_handler.py b/traceflow/socket_handler.py index 5629ad3..96ea626 100644 --- a/traceflow/socket_handler.py +++ b/traceflow/socket_handler.py @@ -22,6 +22,7 @@ def __init__(self, daddr): # Use pypcap on osx to send raw packets import pcap self.raw_socket = pcap.pcap() + logging.debug("Detected Linux") if os_release.endswith("BSD"): # BSD - Need to explicit set IP_HDRINCL. # BSD - Need to explicitly calculate IP total length