Getting Network Packets Data

Discussion in 'Mac Programming' started by ruhi, Nov 16, 2009.

  1. ruhi macrumors member

    Joined:
    Jun 17, 2009
    #1
    Hello,

    I want to write a cocoa application which will capture the network packets on a particular port.

    How can i implement that? Any help would me appreciable.

    Thanks,
    Ruhi.
     
  2. savar macrumors 68000

    savar

    Joined:
    Jun 6, 2003
    Location:
    District of Columbia
    #2
    Packet Peeper does exactly that, and its open source.
     
  3. cqexbesd macrumors regular

    Joined:
    Jun 4, 2009
    #3
    libpcap is the usual library used to do it from C. That will work for a Cocoa app though you migth find someone has done an ObjC wrapper already.

    HTH,

    Andrew
     
  4. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #4
    It depends how reliable you want the packet sniffer to be. If you just want to capture TCP packets before they reach the application then you can probably use the solutions provided.

    If you want to capture raw packets as soon as they leave the hardware interface then you need to start mucking around with kernel extensions (which I am currently stuck with :)).
     
  5. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #5
    If you just want to view traffic using an existing app, Interarchy has a Traffic-viewing feature. You can limit it to a port, or it can show traffic on all ports.

    http://www.interarchy.com/

    Interachy does much more than view traffic. You can ignore those features.
     
  6. ehunt123 macrumors newbie

    Joined:
    Dec 7, 2009
    #6
    If you're not a cli friend, going straight for TCPDump, there are quite a few front-ends around this.

    Free ones, and the ones where the developer did a great job are the X11 port (bundled as an OSX app) of Wireshark, that is gigantic and amazing.

    There is another one called CocoaShark or something. A simple search for sniffer on macupdate will get you there
     

Share This Page