Jump to content
2 posts in this topic

Recommended Posts

Hi all, this is my first post here so hello everybody :)

Straight to the problem: i want to write a software that is able to track er process net(up/down link) usage, and show the resulting informations to user through a UI.

To implement this my first idea was to write a proxy lib in order to intercept sys calls like send/recv ecc and obtain full knowledge of the buffers' size of sent/received data per process.

In linux i would do this by, for example, writing a libsocket.so that is linked against the real libsocket.so in order to route methods invocation, placing my lib somewhere and adding the location to $LD_LIBRARY_PATH.

Now in OS X we have dylib and dyld, so the first thing i did was write a very simple program that uses sockets, run it and use otool to track down the info about used libs.

The result was that dyld loaded, in order to install socket, libSystem.B.dylib.

I used nm to see what's inside this and, as expected, there were tons of things, in particular i found

 

/usr/lib/libSystem.B.dylib(socket.So):
9001b600 T _socket
	 U cerror

/usr/lib/libSystem.B.dylib(send.So):
90027820 T _send
	 U _sendto
	 u dyld_stub_binding_helper

 

and more related to functions i'm interested in.

 

So i searched for socket.so or send.so with spotlight but they were nowhere to be found and then i thought that maybe these libs were "packaged" inside the libSystem.B.dylib.

 

After this whole intro, is there a way to implement this in os x without writing a libSystem.B.dylib proxy that would be a huge try?

Otherwise, is there a different way to do what i want?

 

Thanks everybod

×
×
  • Create New...