How can I listen to a socket opened by another program? Let's say I just logged on BNET with JavaOP2 and I received the ENTERCHAT packet. I want to view the contents of that packet in my program x3
There is no way to do this through the Java API. You could write a JNI library to utilize a packet logging library such as WinPcap (http://www.winpcap.org/) (for Windows) or similar.
Other than that, you can do a man-in-the-middle attack, where you write a program that acts as a proxy for the BNCS connection.
Or just modify JavaOP since you have the source ;)
Quote from: SarCaSTiC on July 14, 2008, 12:58:04 PM
...
If the purpose of your account is to post technical questions, then I have to question how you came up with your username ;)
Quote from: Chavo on July 14, 2008, 07:18:46 PM
Or just modify JavaOP since you have the source ;)
Yeah, I believe this would be the quickest way. If you want the information dynamically, I suppose you could set up a port on localhost to which you forward the stuff that you want from JavaOp, and then listen to that port on localhost with your program. Of course if it's just a single packet then you could write to a file.
Though I wonder why you're doing this in the first place... and I wonder why I'm posting four days later...