tags:

views:

251

answers:

2

I need to intercept all HTTP requests on a Mac OS X client and record the request url in it. I know on Windows machine, I can implement a Winsock LSP and have it intercept all winsock calls. Is there a equivalent on Mac OS X? Thanks.

If you don't have the direct answer, I'll appreciate if you can point me to where these Max system programming questions are usually asked/answered.

+1  A: 

You can use divert sockets but you need root access.

diciu
Thanks. Forgive my ignorance on Mac programming, but if I understand correctly, that python script looks like a one-time thing. You have to run that script every time your OS reboots. What I need is something like a Windows service, which runs automatically every time your OS boots.
Tong Wang
@Tong If you want something that runs every time your OS boots, look into launchd http://developer.apple.com/macosx/launchd.html . If this is something that only needs to be run as part of your application, then you can just re-implement that in your application, and make sure your application is run as root.
Brian Campbell
@Brian - Thanks for your info, it's really helpful to me. As for implementing the above suggested divert sockets, what language/sdk/ide should I use?
Tong Wang
A: 

If you just want to monitor the http requests of your application, I suggest dtrace, or possibly just printf.

Alex Brown
Actually, I need to monitor all http requests made by all the browsers.
Tong Wang