diff options
| author | cvs2svn <admin@example.com> | 1998-10-19 21:47:12 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 1998-10-19 21:47:12 +0000 |
| commit | 5170039cf1df2194faa85741f0733977525cd5c0 (patch) | |
| tree | c667406046ddb1efca5ed4316b02e43494241660 /src/usr.bin/nc/scripts/iscan | |
| parent | 536c76cbb863bab152f19842ab88772c01e922c7 (diff) | |
| download | openbsd-OPENBSD_2_4_BASE.tar.gz openbsd-OPENBSD_2_4_BASE.tar.bz2 openbsd-OPENBSD_2_4_BASE.zip | |
This commit was manufactured by cvs2git to create tag 'OPENBSD_2_4_BASE'.OPENBSD_2_4_BASE
Diffstat (limited to 'src/usr.bin/nc/scripts/iscan')
| -rw-r--r-- | src/usr.bin/nc/scripts/iscan | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/usr.bin/nc/scripts/iscan b/src/usr.bin/nc/scripts/iscan new file mode 100644 index 0000000000..6279bc817f --- /dev/null +++ b/src/usr.bin/nc/scripts/iscan | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | ## duplicate DaveG's ident-scan thingie using netcat. Oooh, he'll be pissed. | ||
| 3 | ## args: target port [port port port ...] | ||
| 4 | ## hose stdout *and* stderr together. | ||
| 5 | ## | ||
| 6 | ## advantages: runs slower than ident-scan, giving remote inetd less cause | ||
| 7 | ## for alarm, and only hits the few known daemon ports you specify. | ||
| 8 | ## disadvantages: requires numeric-only port args, the output sleazitude, | ||
| 9 | ## and won't work for r-services when coming from high source ports. | ||
| 10 | |||
| 11 | case "${2}" in | ||
| 12 | "" ) echo needs HOST and at least one PORT ; exit 1 ;; | ||
| 13 | esac | ||
| 14 | |||
| 15 | # ping 'em once and see if they *are* running identd | ||
| 16 | nc -z -w 9 "$1" 113 || { echo "oops, $1 isn't running identd" ; exit 0 ; } | ||
| 17 | |||
| 18 | # generate a randomish base port | ||
| 19 | RP=`expr $$ % 999 + 31337` | ||
| 20 | |||
| 21 | TRG="$1" | ||
| 22 | shift | ||
| 23 | |||
| 24 | while test "$1" ; do | ||
| 25 | nc -v -w 8 -p ${RP} "$TRG" ${1} < /dev/null > /dev/null & | ||
| 26 | PROC=$! | ||
| 27 | sleep 3 | ||
| 28 | echo "${1},${RP}" | nc -w 4 -r "$TRG" 113 2>&1 | ||
| 29 | sleep 2 | ||
| 30 | # does this look like a lamer script or what... | ||
| 31 | kill -HUP $PROC | ||
| 32 | RP=`expr ${RP} + 1` | ||
| 33 | shift | ||
| 34 | done | ||
| 35 | |||
