: # trak@cyberdude.com # cgi_exp.sh # usage ./cgi_exp.sh host port # Viva Apogeus!!!!!!!!! # connect_http() { (echo ${cgi_exp} ; echo ) | nc ${host} ${port} > ${tmp_file} } check_answer() { grep "^HTTP/" ${tmp_file} | awk '/./ {print $0}' >> ${host}.result.$$ output_line=`grep "^HTTP/" ${tmp_file} | awk '/./ { print $2 }' ` if [ "${output_line}" = "200" ] then echo Found ${name_exp} fi } host=${1:-www.cocos.ru} port=${2:-80} tmp_file=/tmp/tmp.$$ name_exp= cgi_exp= stat_line= output_line= while read do stat_line=`echo ${REPLY} | awk '/\[*\]/ {print "NAME";exit } /;/ {print "REM";exit} /GET./ {print "EXP";exit}' ` if [ ${stat_line} = "NAME" ] then name_exp=${REPLY} cgi_exp= fi if [ ${stat_line} = "EXP" ] then cgi_exp=${REPLY} fi if [ "${name_exp}" -a "${cgi_exp}" ] then connect_http check_answer fi done < CGI-EXP.DAT rm -f ${tmp_file}