Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

HTTP spy ?

 [1/5] from: rebol665:ifrance at: 8-May-2002 16:41


Hi rebollers, Exploring how CGI works I am in need of an HTTP spy. I mean a rebol program that could listen to what a web server is getting but without interfering (always the first directive "do not interfere"). For now I am using this code that works but is blocking the web server. 8< - - - - - - - - - - - - - - - - - - - - - - - - - - Rebol [] pt: open tcp://:80 forever [ wait pt print "Data coming ..." connexion: first pt buffer: copy "" until [ data: copy "" read-io connexion data 255 append buffer data found? find data "^/" ] ; until print buffer close connexion ] ; forever close pt 8< - - - - - - - - - - - - - - - - - - - - - - - - - - Does anyone have something for me ? Patrick

 [2/5] from: tomc:darkwing:uoregon at: 9-May-2002 0:27


For debugging cgi and building bots I have an "echo-server" running. it just sits on a port and echos back what it is sent (or at least the first 10k or less of what it is sent) to use it, I go the the page the cgi form is on I change the browsers proxy to point at the (running) echo-server and hit the forms submit button. echo-server returns a simple html page with _exactly_ what the browser sent. Its not fancy but it has been very useful to me. to try the one I'm running you can set your browsers proxy to bionix.cs.uoregon.edu port 3776 feel free to use it occasionaly for unimportant data (if it starts getting hammered I'll have to pull it) if you are interested in running it yourself or need to run it alot please modify the following to suit your needs (watch the linewraps) % cat bin/echoserv #! /private/bin/rebol -sqw REBOL [ Title: "ECHO SERVER" Date: [13-Jan-2002 19-July-1999] Author: ["Tom Conlin" "Sterling Newton"] Purpose: {to echo back what your browser sends. which may be slightly different than what the webserver says it hears. helps to debug forms, cgis and to build bots I am also capturing a copy in a log but you may not care or have a place to store it so just comment those lines out } usage: { typicaly you go the the page of interest in your browser then point the browsers http proxy at the machine and port this script is running on then push the pages submit button and see what the browser intended to say to the server. (to go back to surfing, stop pointing your browsers proxy here) } note: {based on a script called bogus-proxy.r Sterling helped me with} ] header: {HTTP/1.0 200 OK Content-Type: text/html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html><pre> } tailer: {</pre></html>} ; this func is only used to timestamp the log file with net style dates http-date: func[/local weekdays months gmt][ gmt: now - now/zone rejoin [pick system/locale/days gmt/weekday ", " gmt/day " " pick system/locale/months gmt/month " " gmt/year " " gmt/time GMT^/ ] ] serv: open/lines tcp://:3776 ;EC0 in hex but use what you want size: 10240 ; ... or whatever you want forever [ stream: make string! size wait conn: pick serv 1 read-io conn stream size insert/only conn rejoin[header stream tailer] close conn ; comment out the next lines if you do not need a log write/append %/tmp/echoserv.log rejoin[ newline "# " conn/host tab http-date stream newline ] ] close serv ; not that we are apt to get here ------------------------------------------------------------------------------ On Wed, 8 May 2002, pat665 wrote:

 [3/5] from: rebol665:ifrance at: 9-May-2002 14:09


Thanks Tom, Pretty cool ! Now I can see what is sent by the browser. On the same subject, in order to know what the browser is getting back, I am using the following dialog at the rebol console :
>>pt: open tcp://192.168.1.51:80 >>insert pt "GET /cgi-bin/cgi-txt.r HTTP/1.0^/^/" >>print copy pt
HTTP/1.1 200 OK Date: Wed, 08 May 2002 13:36:30 GMT Server: Apache/1.3.24 (Win32) ...
>> close pt
I am wondering if it is possible to have both what is send by the browser and what the browser is getting back without interfering with the browser. A sort of tunneling that lets data go thru in and out. Patrick

 [4/5] from: mike:yaunish:shaw:ca at: 9-May-2002 16:35


At 02:09 PM 09/05/02 +0200, you wrote: I found proxy.r usefull for all this type of thing. See: http://www.reboltech.com/library/html/proxy.html

 [5/5] from: rebol665::ifrance::com at: 10-May-2002 13:21


Thanks Mike, I haven't try it yet but it seems to fit my needs. Patrick