2011-06-16 25 views
0

與所有應用程序關閉,tcpdump的顯示,我的Mac是偶爾發送數據包IPS的屈指可數。它們是沒有數據有效載荷和不尋常的TCP序列號(如隱蔽通道)的包的突發。有沒有一種方法可以確定哪個進程從命令行或以編程方式發起這些數據包?我怎麼知道哪些進程數據包來源於Mac OS X?

注:我已經使用IPFW來外出過濾器的目標IP地址,所以我不擔心數據泄露。

+0

這可能更適合superuser.com嗎? – 2011-06-16 22:29:26

+0

一個相關的問題:誰擁有這些IP地址?這可能會告訴你一些關於這些數據包是幹什麼的... – 2011-06-16 22:46:58

回答

1

我有同樣的問題,但有一個例外 - 我的TCP流量是在lo0的,它是不成立的,但有些過程是試圖連接到本地主機和一些端口。我的任務是確定誰試圖連接。在這一點上,小金斯沒有用。

但是我發現nettop是非常有益的。我在其輸出中發現了不斷變化的TCP連接狀態SynSent/Fin /等,這就是我一直在尋找的過程。

+0

噢,非常好,'nettop'更多的是我最初尋找的方向。 「lsof」比grook更容易。謝謝! – mirth23 2015-02-26 03:58:59

4

我很懶惰,只需安裝Little Snitch(提供免費試用);)

但是,如果它是一個TCP連接,你應該很容易能夠找到netstat罪魁禍首如果您在檢查或之後不久可疑數據包被髮送。

如果你想獲得真正看中的,自己編寫內核擴展,你想要做什麼。蘋果有一個lovely guide,甚至sample code這只是你正在尋找。

+0

感謝指向小史蒂奇的指針!這看起來是一個有價值的投資,並且會使我無需自己編寫監視器。我一定會檢查出來。 'netstat'並不完全做我想做的。在進一步研究之後,我發現'lsof'傾向於給我更多我想要的信息。 – mirth23 2011-06-20 22:19:10

1

蘋果已經進行了修改,以tcpdump的所以它支持一些元數據方案,從tcpdump的Mac OS X的手冊頁:與-k運行tcpdump命令當N我們可以看到進程名稱

-k  Control the display of packet metadata via an optional metadata_arg argument. This is useful when displaying packet saved in the pcap-ng file format 
      or with interfaces that support the PKTAP data link type. 

      By default, when the metadata_arg optional argument is not specified, any available packet metadata information is printed out. 

      The metadata_arg argument controls the display of specific packet metadata information using a flag word, where each character corresponds to a type 
      of packet metadata as follows: 

       I  interface name (or interface ID) 
       N  process name 
       P  process ID 
       S  service class 
       D  direction 
       C  comment 

      This is an Apple modification. 

所以:

19:12:51.823518 pid Google Chrome.313 svc BK IP 192.168.100.191.49424 > 216.58.209.133.443: Flags [.], ack 74, win 4093, options [nop,nop,TS val 507317615 ecr 3185588461], length 0 19:12:51.823518 pid Google Chrome.313 svc BK IP 192.168.100.191.49424 > 216.58.209.133.443: Flags [.], ack 329, win 4088, options [nop,nop,TS val 507317615 ecr 3185588462], length 0

相關問題