httptrace - TCP/HTTP trace utility

Listens on a TCP/IP port, redirects data to another port and writes traces.

DOWNLOAD

Download the classes and source code from  Source: httptrace.java.
Author: Thorsten Sprenger (thorsten@3sprenger.de)

SYNOPSIS

java httptrace [ optionsjava httptrace -help for a list of options
For Windows platforms, Microsoft JVM "jview" can be used:
jview.exe httptrace [ options ]
If started without options, httptrace displays a parameter dialog.
 
 

DESCRIPTION

The httptrace utility is a java application that dumps TCP traffic (for example, HTTP requests/responses) to screen or file.
It is called "httptrace" since there are some options which make it suitable for HTTP tracing, but for other protocols, it works fine as well.
httptrace listens on a TCP/IP port, redirects data to another port and writes traces of the data packets.
Example: (In fact, -listenport and -tunnelport can be omitted, since the defaults are 80).

If HTTP headers are not of interest, hide them with -noheader.
A tracefile can be created with -tracefile filename. Note that httptrace will not overwrite, but append to an already existing file.
If the trace output shall go to console, use -nogui -tracefile stdout.

OPTIONS

  -listenport   TCP port on which httptrace listens (default: 80)
  -tunnelhost   hostname to which httptrace redirects data  (default: localhost)
  -tunnelport   port to which httptrace redirects data (default: 80)
  -tracefile    append data to this file.
                use "-tracefile stdout" to write to console.
  -pattern      trace only data containing this text (enclosed in "")
  -nodata       do not trace data
  -noheader     do not trace HTTP header
  -nodialog     do not display parameter dialog on startup
  -nocomments   do not write any comments
  -nogui        do not display graphical user interface
  -help         print this help
  -version      print version

EXAMPLES

  • Listen on port 80 and send requests to www.xyz.com :
  •   java httptrace -tunnelhost www.xyz.com
  • Listen on port 80 and send requests to local port 81, hide HTTP headers :
  •   java httptrace -tunnelport 81 -noheader
  • Listen on port 80 and send requests to local port 81, don't show parameter dialog, write to file data.log :
  •   java httptrace -tunnelport 81 -nodialog -tracefile data.log
  • Listen on port 80 and send requests to localhost port 6714, but don't display window.

  • Print every packet containing "?xml" on console :
      java httptrace -tunnelport 6714 -nogui -pattern "?xml" -tracefile stdout
  • Listen on port 80 and send requests to 211.3.123.124, without any traces (just tunnel the traffic):
  •   java httptrace -tunnelhost 211.3.123.124 -nogui

    CREDITS

    The java source is derived from org.apache.soap.util.net.TcpTunnel.

    COMMENTS

    Please write your comments, wishes or bug reports to Thorsten Sprenger (thorsten@3sprenger.de). Thanks!