• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

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

 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"?
 
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Happily living in the valley of the dried frogs with a few tiny ads.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic