Misc info

Really just for fun, of no practical value I think….

Bash cgi-bin

Why you would want to do this I don't know, but it seemed to fun at the time to write cgi in some obscure ways.

hello.sh

#!/bin/bash
printf "Content-Type: Text/HTML\n"
printf "\n\n"
 
printf "<html>\n"
printf "<title>BASH cgi script</title>\n"
printf "<body>\n<h1>This is `hostname` </h1>\n</body>\n"
printf "</html>\n"

DOS cgi-bin

Run this under windows and make your system even more insecure!(If that's possible)

hello.bat

@echo off
 
echo content-type: text/html;
 
echo.
echo.
echo ^<html^>
echo ^<head^>
echo ^<title^>Test for DOS batch file CGI-script^</title^>
echo ^</head^>
echo ^<body^>
echo Hello World
echo.
echo ^<pre^>
nbtstat -A 172.25.0.20
echo ^</pre^>
echo ^</body^>
echo ^</html^>

BASH traceroute

Not mine, copied.

# cat traceroute.sh
#!/bin/sh
 
# cgi-bin for traceroute - v1.4b - new links added Apr 17th 1996
# July,Dec 1995 by Laurent Demailly - dl@hplyot.obspm.fr
# infos,... on http://hplyot.obspm.fr/~dl/wwwtools.html
# Free software - GNU GPL - AS IS, NO WARRANTY...
# please keep author's (my) reference...
 
# note: using ncsa server, it is recommended to name the script
# "nph-something", like nph-traceroute so outputs come as it is
# done and not at the end.
 
# configure the following according to your place :
# place name:
PLACENAME="Observatoire de Paris &agrave; Meudon (France)"
# traceroute full path (unix path):
TRACEROUTE=/usr/local/bin/traceroute
# this script relative url (absolute would work too)
SCRIPTURL=/cgi-bin/nph-traceroute
# an icon to use as back to your home page
BACK2TOPICON=/icons/house.gif
# the icon width
ICONWIDTH=48
# the icon height (use xv for instance to check sizes)
ICONHEIGHT=48
 
 
# you are going to use this script, please drop a mail to <dl@hplyot.obspm.fr>
# so I can add you to the directory
# (I'm planning for version 2.0 some sort of auto database, etc...)
 
 
# no changes shall be needed below, but have a look :
echo HTTP/1.0 200 OK
echo Content-type: text/html
echo Server: $SERVER_SOFTWARE
echo
 
cat << EOM
<HTML><HEAD><TITLE>Traceroute</TITLE>
<link rev="made" href="mailto:dl@hplyot.obspm.fr">
</HEAD><BODY>
<H1>Traceroute</H1>
EOM
 
if [ -x $TRACEROUTE ]; then
        if [ $# = 0 ]; then
 
cat << EOM
Typein the name of a machine (or follow here <a href="$SCRIPTURL?$REMOTE_HOST">
for trace to your place ($REMOTE_HOST)</a>) you want to trace from <a href="/">$PLACENAME</a>:
<ISINDEX>
 
You can also try the following traceroute services
<ul>
<li>Full traceroute provided by :<br>Services in
<dir>
<li> France
 <dir>
 <li><A href="http://hplyot.obspm.fr/cgi-bin/nph-traceroute">Obs. Paris Meudon</a>
 <li><A href="http://web.cnam.fr/bin.html/traceroutename.html">Cnam (Paris)</a>
 <li><A href="gopher://gopher.urec.fr:4320/7traceroute">Urec (Jussieu, Paris)</a>
 <li><A href="http://www.fr.net/trace.html">Fr.net's at Paris</a>
 <li><A href="http://dafne.mines.u-nancy.fr/~souabmce/nph-traceroute.html">Mine's school at Nancy</a>
 <li><a href="http://www.efrei.fr/cgi-bin/nph-cgiwrap/parmelan/nph-traceroute"> Efrei's, Paris</a>
 <li><a href="http://www.freenix.fr/cgi-bin/nph-traceroute">Freenix (Angers)</a>
 </dir>
<li> Misc. Europe
 <dir>
 <li><a href="http://www.sanet.sk/~vajda/cgi-bin/trac.cgi">Technical  University Zvolen, Slovakia</A>
 <li><a href="http://www.nap.roma.it/cgi-bin/tracer">UniNet IP  Services, Rome, Italy</a>
 <li><a href="http://www.ping.be/user/Kristoff.Bonne/web-traceroute/"> A multi traceroute's index page in belgium</a>
 </dir>
<li> USA
 <dir>
 <li><a href="http://bs.mit.edu:8001/cgi-bin/traceroute">MIT's</a>
 <li><a href="http://www.brownell.edu/cgi-bin/traceroute.bt">Brownell Univ.</a>
 <li><a href="http://www.net.cmu.edu/bin/traceroute">Carnegie Mellon Univ.   in Pittsburgh</a>
 <li><a href="http://hookomo.aloha.net/hol/docs/trace.html"> Aloha Net's, Hawaii</a>
 <li><a href="http://www.euromail.com/cgi-bin/traceroute.html">Euromail, Philadelphia</a>
 </dir>
<li>Other countries
<dir>
  <li><a href=" http://Julia.NetVision.Net.Il/cgi-bin/nph-traceroute">NetVision - ISP  Haifa (Israel)</a>
</dir>
</dir>
<li>Traceroute to your host only, provided by :
<dir>
 <li><a href="http://www.laas.fr/cgi-bin/trace-EXT">LAAS, France</a>
 <li><a href="http://cnct.com/cgi-bin/gobills2/traceroute.pp">Jason P Schanuel's (New-York)</a>
 <li><a href="http://www.wiskit.com/cgi-bin/tracecon">wiskit.com's</a>
</dir>
</ul>
If you know a web traceroute not listed above (like if you install a copy
of this script at your site), please mail me
(<a href="mailto:dl@hplyot.obspm.fr">dl@hplyot.obspm.fr</a>), so I can
add a link here for the benefit of everybody.
EOM
        else
                echo "Result for <b>$1</b>:"
                echo \<PRE\>
                nice $TRACEROUTE "$1" 2>&1
                echo \</PRE\>
        fi
else
        echo Cannot find traceroute on this system.
fi
cat << EOM
<HR>
<ADDRESS>
Idea stolen from S.Bortzmeyer.<br>
This <a href="http://hplyot.obspm.fr/~dl/wwwtools.html">implementation
(1.4b)</a> is <a href="http://hplyot.obspm.fr/~dl/disclaimer.html">&copy;</a>
by <A HREF="http://hplyot.obspm.fr/~dl/">Laurent Demailly</A>
</ADDRESS>
<P>
<A HREF="/"><IMG SRC="$BACK2TOPICON" height=$ICONHEIGHT width=$ICONWIDTH
 alt="[top]"></A>
</BODY></HTML>
EOM
 
linux/misc-bash-cgi.txt · Last modified: 16/02/2024 10:58 by andrew