#!/bin/sh
# cgiscan.sh by ben-z [3/23/99]
# written for use in fts-rvscan
cnt="0"
rm cgilist 1>/dev/null 2>/dev/null
function testcgi {
cnt=`expr $cnt + 1`
echo -n "[$cnt]: trying http://$1$2 [**] "
cmsg=" timeout [005]"
rm .tmp 1>/dev/null 2>/dev/null
ycgi="0"
(echo "GET $2" ; sleep 1) | nc -w 4 $1 80 1>.tmp 2>.tmp
cat .tmp | grep -i "<" >/dev/null 2>&1
if [ $? -eq 0 ]; then
 cmsg=" found!"
 ycgi="1"
fi
cat .tmp | grep -i "not found" >/dev/null 2>&1
if [ $? -eq 0 ]; then
 cmsg=" not found [000]"
 ycgi="0"
fi
cat .tmp | grep "404" >/dev/null 2>&1
if [ $? -eq 0 ]; then
 cmsg=" not found [404]"
 ycgi="0"
fi
cat .tmp | grep "403" >/dev/null 2>&1
if [ $? -eq 0 ]; then
 cmsg=" forbidden [403]"
 ycgi="0"
fi
cat .tmp | grep "500" >/dev/null 2>&1
if [ $? -eq 0 ]; then
 cmsg=" serv-fail [500]"
 ycgi="0"
fi
cat .tmp | grep "505" >/dev/null 2>&1
if [ $? -eq 0 ]; then
 cmsg=" redirected [505]"
 ycgi="0"
fi
cat .tmp | grep "302" >/dev/null 2>&1
if [ $? -eq 0 ]; then
 cmsg=" unavailable [302]"
 ycgi="0"
fi
echo $cmsg
if [ "$ycgi" = "1" ]; then
 echo "http://$1$2" >>cgilist
fi
}
if [ "$2" != "" ]; then
 testcgi $1 $2
 exit 1
fi

testcgi $1 /cgi-bin/phf
testcgi $1 /cgi-bin/php.cgi
testcgi $1 /cgi-bin/Count.cgi
testcgi $1 /cgi-bin/campas
testcgi $1 /cgi-bin/htmlscript
testcgi $1 /cgi-bin/webgais
testcgi $1 /cgi-bin/websendmail
testcgi $1 /cgi-bin/info2www
testcgi $1 /_vti_pvt/service.pwd
testcgi $1 /cgi-bin/test-cgi
testcgi $1 /cgi-bin/handler
testcgi $1 /cgi-bin/webdist.cgi
testcgi $1 /cgi-bin/cachemgr.cgi
testcgi $1 /_vti_pvt/administrators.pwd
testcgi $1 /_vti_pvt/users.pwd
testcgi $1 /_vti_pvt/authors.pwd
testcgi $1 /cgi-bin/pfdisplay
testcgi $1 /cgi-bin/pfdisplay.cgi
testcgi $1 /cgi-bin/perl.exe
testcgi $1 /cgi-bin/wwwboard.pl
testcgi $1 /cgi-bin/www-sql
testcgi $1 /cgi-bin/aglimpse
testcgi $1 /cgi-bin/man.sh
testcgi $1 /cgi-bin/view-source
testcgi $1 /cgi-bin/nph-test-cgi
testcgi $1 /cgi-bin/wrap
testcgi $1 /cgi-bin/textcounter.pl
testcgi $1 /cgi-bin/environ.cgi
testcgi $1 /cgi-bin/query
testcgi $1 /cgi-bin/rpm_query
testcgi $1 /cfdocs/expeval/openfile.cfm
testcgi $1 /cfdocs/expeval/displayopenedfile.cfm
testcgi $1 /cfdocs/expeval/exprcalc.cfm
testcgi $1 /cgi-bin/finger
testcgi $1 /cgi-bin/bnbform.cgi
testcgi $1 /cgi-bin/survey.cgi
testcgi $1 /cgi-bin/classifieds.cgi
testcgi $1 /cgi-bin/AnyForm2
testcgi $1 /cgi-bin/AT-admin.cgi
testcgi $1 /cgi-bin/unlg1.1
testcgi $1 /cgi-bin/filemail.pl
testcgi $1 /cgi-bin/maillist.pl
testcgi $1 /cgi-bin/jj
testcgi $1 /cgi-bin/files.pl
testcgi $1 /cgi-dos/args.bat
testcgi $1 /cgi-win/uploader.exe
testcgi $1 /search97.vts
testcgi $1 /carbo.dll
testcgi $1 /config/import.txt
testcgi $1 /config/checks.txt
testcgi $1 /orders/import.txt
testcgi $1 /orders/checks.txt
