• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How grab/listen to all outgoing data (on a socket?)?

 
Dan Bizman
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this is a broad question and I'm not even sure I'm stating it properly, but basically here's what I want to do:

1. There will be programs that attempt to open a connection to outside sources (like an email client)

2. I want all data that they send over that line to be readable by my program without need to alter those programs

Is it possible to listen on outgoing ports? For example, if I'm at 111.111.111.1 and they try to send something to an outside computer at 222.222.222.2:25, how would I grab that "conversation"?
 
Henry Wong
author
Marshal
Pie
Posts: 21427
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In terms of tools, you can use a commandline tool call "tcpdump" which will provide and filter all the traffic going on with a network card. The windows version of that tool is "windump". There is also a higher level tool, called "ethereal", which provides a GUI interface to "tcpdump" and "windump".

Now... In terms of APIs, these packages also have lower level libraries for applications to use. And I have seen some mention of a Java API around these libraries. I have *never* used "tcpdump" in a programmatic fashion, so don't have an opinion on the libraries.

But the "tcpdump", "windump", and "ethereal" tools, works as advertised and is great for debugging network programs.

Henry
[ November 02, 2006: Message edited by: Henry Wong ]
 
Michael McHugh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tools listed above are all based on the same packet capture library, Libpcap (and it's Windows port, Winpcap). There are Java wrappers available for these libraries that you can use. The two that I know of are jpcap and Jpcap (same name, different projects). These provide an API to let you grab all traffic on the network, or filter based on destination address, port, protocol, etc.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic