1#! /bin/sh 2## This is a quick example listen-exec server, which was used for a while to 3## distribute netcat prereleases. It illustrates use of netcat both as a 4## "fake inetd" and a syslogger, and how easy it then is to crock up a fairly 5## functional server that restarts its own listener and does full connection 6## logging. In a half-screen of shell script!! 7 8PORT=31337 9 10sleep 1 11SRC=`tail -1 dist.log` 12echo "<36>elite: ${SRC}" | ./nc -u -w 1 localhost 514 > /dev/null 2>&1 13echo ";;; Hi, ${SRC}..." 14echo ";;; This is a PRERELEASE version of 'netcat', tar/gzip/uuencoded." 15echo ";;; Unless you are capturing this somehow, it won't do you much good." 16echo ";;; Ready?? Here it comes! Have phun ..." 17sleep 8 18cat dist.file 19sleep 1 20./nc -v -l -p ${PORT} -e dist.sh < /dev/null >> dist.log 2>&1 & 21sleep 1 22echo "<36>elite: done" | ./nc -u -w 1 localhost 514 > /dev/null 2>&1 23exit 0 24