diff options
Diffstat (limited to 'src/usr.bin/nc/scripts/dist.sh')
-rw-r--r-- | src/usr.bin/nc/scripts/dist.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/usr.bin/nc/scripts/dist.sh b/src/usr.bin/nc/scripts/dist.sh new file mode 100644 index 0000000000..4d2534a0e3 --- /dev/null +++ b/src/usr.bin/nc/scripts/dist.sh | |||
@@ -0,0 +1,23 @@ | |||
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 | |||
8 | PORT=31337 | ||
9 | |||
10 | sleep 1 | ||
11 | SRC=`tail -1 dist.log` | ||
12 | echo "<36>elite: ${SRC}" | ./nc -u -w 1 localhost 514 > /dev/null 2>&1 | ||
13 | echo ";;; Hi, ${SRC}..." | ||
14 | echo ";;; This is a PRERELEASE version of 'netcat', tar/gzip/uuencoded." | ||
15 | echo ";;; Unless you are capturing this somehow, it won't do you much good." | ||
16 | echo ";;; Ready?? Here it comes! Have phun ..." | ||
17 | sleep 8 | ||
18 | cat dist.file | ||
19 | sleep 1 | ||
20 | ./nc -v -l -p ${PORT} -e dist.sh < /dev/null >> dist.log 2>&1 & | ||
21 | sleep 1 | ||
22 | echo "<36>elite: done" | ./nc -u -w 1 localhost 514 > /dev/null 2>&1 | ||
23 | exit 0 | ||