summaryrefslogtreecommitdiff
path: root/usr.bin/nc/scripts/bsh
blob: 808e8f99687bfe9a1f53494263ea4755fba108c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /bin/sh
#	$OpenBSD: bsh,v 1.2 2001/01/29 01:58:12 niklas Exp $

## a little wrapper to "password" and re-launch a shell-listener.
## Arg is taken as the port to listen on.  Define "NC" to point wherever.

NC=nc

case "$1" in
  ?* )
  LPN="$1"
  export LPN
  sleep 1
  echo "-l -p $LPN -e $0" | $NC > /dev/null 2>&1 &
  echo "launched on port $LPN"
  exit 0
  ;;
esac

# here we play inetd
echo "-l -p $LPN -e $0" | $NC > /dev/null 2>&1 &

while read qq ; do
case "$qq" in
# here's yer password
  gimme )
  cd /
  exec csh -i
  ;;
esac
done