Reputation: 21
I'm looking for a solution to programmatically monitor all traffic in macOS/OS X. For example, i got some NSRunningApplication
with it's processIdentifier
, and create NSTask
instance, requesting to nettop, and get in/out bytes on Sierra.
But it's bad, because on El Capitan i can't filter nettop's columns and information, and parsing is very complicated in that case. And energy impact is very high.
Does anyone know some better ways to get application traffic in Mac?
Upvotes: 2
Views: 1084
Reputation:
In all likelihood you’ll want to write a Network Kernel Extension to monitor network traffic. This is a fairly complicated topic and is probably out of the scope of a single Stack Overflow question to get a comprehensive answer. I would start with that document and ask more specific questions as you learn more and begin to write code.
Also take a look at:
Which built-in tools do Little Snitch-like applications rely on?
Upvotes: 1