Listens on a TCP/IP port, redirects data to another port and writes traces.
Download the classes and source code from Source: httptrace.java.
Author: Thorsten Sprenger (thorsten@3sprenger.de)
java httptrace [ options ] java httptrace -help for a list of optionsFor Windows platforms, Microsoft JVM "jview" can be used:jview.exe httptrace [ options ]If started without options, httptrace displays a parameter dialog.
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).
- The HTTP server works on http://www.xyz.com
- On your client machine, start java httptrace -listenport 80 -tunnelhost www.xyz.com -tunnelport 80.
- Start a browser on http://localhost/ and watch the httptrace window.
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.
-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
Listen on port 80 and send requests to www.xyz.com : java httptrace -tunnelhost www.xyz.comListen on port 80 and send requests to local port 81, hide HTTP headers : java httptrace -tunnelport 81 -noheaderListen 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.logListen 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 stdoutListen 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
The java source is derived from org.apache.soap.util.net.TcpTunnel.
Please write your comments, wishes or bug reports to Thorsten Sprenger (thorsten@3sprenger.de). Thanks!