1

I'm messing around with a program to track my internet browsing habits and I'm trying to think of the best way to do it. I have some ideas but I'm not sure how feasible they are.

  1. Somehow hook into firefox. I don't think there's an API that I can hook java into firefox with. I heard something about a firefox java rmi add on that I can access from java but I can't find anything. This would restrict me to firefox, which is fine because I only use firefox.
  2. Emulate Windows "netstat" somehow. I don't want to call netstat because that limits me to Windows. This would be a last case scenario
  3. Socket programming. I can set up a ServerSocket to listen on port 80 but not if there is already something using that port, so it doesn't do what I want it to do, listen to what's already going on on port 80.
  4. Use a packet capture library. This seems like overkill.

Any other ideas?

JPC
  • 8,096
  • 22
  • 77
  • 110
  • 1
    A different approach to this problem might be to simply look at the title of the foreground window at regular intervals. I know this is easy to do in Win32, for example. – Greg Hewgill Dec 04 '10 at 22:08
  • Sure but I might as well just use the netstat command if I want to use Win32 calls – JPC Dec 04 '10 at 22:12
  • Why does using netstat limit you to Windows? – Greg Hewgill Dec 04 '10 at 22:14
  • Wouldn't I have to call it via Runtime.exec? Isn't that windows call? – JPC Dec 04 '10 at 22:17
  • netstat exists on pretty much all modern operating systems (Windows, Mac OS X, Linux, etc). However, I'm not sure what the output of netstat would give you anyway, since it only shows *active* connections (and reading a page in a browser doesn't generally hold an active connection to the server after the page has loaded). – Greg Hewgill Dec 04 '10 at 22:19
  • good point, might be something to try out though. – JPC Dec 04 '10 at 22:33

2 Answers2

1

Use a java local proxy to monitor any request from any browser

Joe pillot
  • 11
  • 1
1

Sure

Check rabbit a java proxy with monitoring,sniffing and filtering capabilities http://www.khelekore.org/rabbit/

Joe pillot
  • 26
  • 1
  • You can edit your previous posts to clarify your answer. SO is not like regular forums ;-) – Camilo Díaz Repka Dec 04 '10 at 23:40
  • I'll try that out. Have you used it with any success? – JPC Dec 05 '10 at 17:40
  • it's pretty simple to use and very robust and fast, tanx to its nio implementation. you can grab the source where u can find out some examples to filter,block/redirect with many configurations options. – Joe pillot Dec 05 '10 at 19:34
  • Whatever your exact project is, i assume it's better than other solution since u are not dependant of platform or presence and installation of low level network library. – Joe pillot Dec 05 '10 at 19:42