[comp.unix.questions] Trapping yourself in csh.

flee@gondor.cs.psu.edu (Felix Lee) (02/15/88)

Here's something I cobbled together one day, when I discovered that csh would
let you alias 'alias'.  It's a script you 'source' that traps you in csh.
Works on 4.[23] Berkeleyish systems.

Be prepared to:
- kill yourself from another terminal.
- disconnect your physical/telnet/rlogin connection.
- crash csh.  (I don't know any fatal csh errors)
- start up an assassin before you source this script.

Did I miss anything?
--
Felix Lee	flee@gondor.cs.psu.edu	*!psuvax1!gondor!flee

--------------------cut here--------------------
unalias *			# clear the air
unset *				#

set prompt = '(locked) /% '	# niceties
set noclobber			#

/bin/stty new eof u lnext u	# clear the terminal
/bin/stty werase '\\'		#
/bin/stty quit '\!'		#
/bin/stty rprnt "'" intr '"'	#

alias nope 'echo /-0:0": nope"'	# generic alias

set histchars = '//'		# no execution
alias exec	nope		#

alias logout	nope		# no exit
alias login	nope		#
alias exit	nope		#
alias kill	nope		#
alias suspend	nope		#
alias stop	nope		#

alias set	nope		# no repair
alias unset	nope		#
alias setenv	nope		#

alias limit	nope		# no limit

alias 'unalias'	nope		# make it final
alias 'alias'	nope		#

maeder@symcom.math.uiuc.EDU (02/16/88)

At least on a Sun (OS 3.4) the line

	/bin/stty werase '\\'

did not have the intended effect. So to get out, simply say

	\/bin\/csh



Roman E. Maeder
Dept. of Mathematics			UUCP:       ...!uiucuxc!symcom!maeder
Univ. of Illinois at Urbana-Champaign	Internet: maeder@symcom.math.uiuc.edu
---------------------------------------------------------------------------

It is now pitch dark. If you proceed you are likely to be eaten by a grue.

dunc%moria@Sun.COM (duncs home) (02/16/88)

In article <3282@psuvax1.psu.edu> flee@gondor.cs.psu.edu (Felix Lee) writes:
>Here's something I cobbled together one day, when I discovered that csh would
>let you alias 'alias'.  It's a script you 'source' that traps you in csh.
>Works on 4.[23] Berkeleyish systems.
>
>Be prepared to:
>- kill yourself from another terminal.
>- disconnect your physical/telnet/rlogin connection.
>- crash csh.  (I don't know any fatal csh errors)
>- start up an assassin before you source this script.
>
>Did I miss anything?
>--
>Felix Lee	flee@gondor.cs.psu.edu	*!psuvax1!gondor!flee
>                           ...

Under SunOS 3.4, this got me out.

cd /
cd bin
echo /
$cwd/{$}stty eof ^D
^D

jonl@sco.COM (ScoMole #192-1232A) (02/20/88)

+-I seem to recall flee@gondor.cs.psu.edu (Felix Lee) writing:
|
| Here's something I cobbled together one day, when I discovered that csh would
| let you alias 'alias'.  It's a script you 'source' that traps you in csh.
| Works on 4.[23] Berkeleyish systems.
| 
| Be prepared to:
| - kill yourself from another terminal.
| - disconnect your physical/telnet/rlogin connection.
| - crash csh.  (I don't know any fatal csh errors)
| - start up an assassin before you source this script.
| 
| Did I miss anything?
| --
| Felix Lee	flee@gondor.cs.psu.edu	*!psuvax1!gondor!flee
| 

there are a number of ways to get yourself out of this "trap".
you could just execute another csh for one thing. (\/bin\/csh)
you can also create another shell script which could do various things
that would be an escape. but one thing for sure about that script....
imagine installing it in a few of your friends accounts without telling
them. reminds me of the time when i put a false message in a friend's
account over xmas break while he went home... at the time he was possibly
goign to loose his account for various reasons (i still think the 
administration doesn't like the idea of having an account called "horny"
around..) so i added a few lines into his .login to the effect of
"Your account has been closed due to....." making it sound very official
and then had a false port selector message come up. scared him quite
a bit as i remember.. sometimes the best jokes are the simpliest..

there is no point, this is BoFf!
===============================================================================
jon luini || WORK: 408-425-7222    || HOME: 408-423-2917
Work:     || jonl@sco.com          || ...!{uunet, ihnp4, ucbvax!ucscc}!sco!jonl
Evil:     || niteowl@ssyx.ucsc.edu || ...!{ucbvax}!ucscc!ssyx!niteowl
===============================================================================

ugfailau@sunybcs.uucp (Fai Lau) (02/21/88)

In article <221@scovert> jonl@sco.COM (ScoMole #192-1232A) writes:
>
  [practical joke about putting a scary message into a friend's .login file]
>and then had a false port selector message come up. scared him quite
>a bit as i remember.. sometimes the best jokes are the simpliest..

	A Unix machine I used to work with had very loose securities.
But it really wasn't a problem because everything terminals to
the machine was hard wired and the company had a security system
that check everybody that comes into the building. But then
there was me.
	Anyway, once I found out that all the devices in /dev
was sccessable to everybody, I started doing things like writting
pseudo system messages to other terminals and monitoring their
activities. One thing though, the response of the system to a terminal
for some reason slowed down noticeably when I monitored inputs from
that terminal. I never found out although it might be because
there was heavy I/O between the terminal and the program it was
running. Unfortunately I wasn't smart enough so the idea of figuring
out the password to root never passed my mind. 8-)

Fai Lau
SUNY at Buffalo (The Arctic Wonderland)
UU: ..{rutgers,ames}!sunybcs!ugfailau
BI: ugfailau@sunybcs INT: ugfailau@joey.cs.buffalo.EDU