What's New!

Chat with
Hackers

How to Defend
Your Computer 

The Guides
to (mostly) 
Harmless Hacking

Happy Hacker 
Digests (old stuff) 

Hacker Links 

Hacker
Wargames 

Meet the 
Happy Hacksters 

Help for 
Beginners 

Hacker 
Bookstore 

Humor 

It Sucks 
to Be Me!

How to Commit
Computer Crime (not)! 

What Is a 
Hacker, Anyhow? 

Have a 
Great Life! 

News from the 
Hacker War Front

Shell Programming: an Exploit Explained, continued...

HOW TO CUSTOMIZE YOUR LOGIN SHELL SCRIPT

        BOFH points out that in the world of vanilla Unix, different shells have
different startup files.  For example:

  bash: .profile
  sh:   .profile
  csh:  .cshrc
  tcsh: .cshrc
  zsh:  $ZDOTDIR/.zprofile and/or $ZDOTDIR/.zshrc

        I [BOFH] could go on with the different shells out there, but these are
the most common.
  
        btw...
        There's even an lsh which emulates a doslike environment.  It sorta kinda
sucks because if you're on a *nix ("*nix" stands for all the kinds of
Unixes) system you want to use a *nix like shell but it's fun to use as a prank.

        Most all of these startup files read the files .login and .logout.

        Let's assume you have tcsh. The first thing you may wish to do is customize
it.  It would be really shameful for a hacker like you or me to have an
ordinary shell. Here's how you can see how your shell is set up.  The
settings for tcsh are in a file named ".cshrc".  This is a shell script, a
program consisting of a series of Unix shell commands. To read what is in
it, give the command:

->cat .cshrc|more

(Or give the command "more .cshrc".  The Unix motto is "There's more than
one way to do it.")

        This will display the contents of this script on your monitor. Following is
an example of the commands in a good .cshrc script:


        
echo "-------------------------------------------"
echo "To err is human..."
echo "    To get caught is just plain stupid..."
echo "                                Fatal Error"
echo "-----------Big brother is watching----------"

if (! ${?hostname} ) setenv hostname 'fubar'

umask 076

set path=( ~/bin /usr/local/bin /bin /usr/bin /usr/local/sbin )
set path=( $path /usr/openwin/bin /usr/X11/bin /usr/local/X11/bin )
set path=( $path /usr/ucb /usr/libexec /usr/etc /etc /usr/games )
set path=( $path /usr/sbin )

setenv host `uname -n`
setenv WWW_HOME http://www.fubar.com/
setenv LD_LIBRARY_PATH "/usr/openwin/lib:/usr/local/X11/lib:/usr/X11/lib"
setenv MANPATH "/usr/man:/usr/share/man:/usr/local/man"
setenv VISUAL pico
setenv EDITOR pico
setenv PGPPATH ~/.pgpdir

mesg y

#set autologout=(0 40)

set exinit 
set history=40
set implicitcd
set listjobs
set listlinks
set listjobs=long
set noclobber
set prompt="%U\n(`whoami`) fubar:%u \n%~ %# "
set tperiod=1
set rmstar
set watch=(1 friend1 any friend2 any enemy1 any enemy2 any)

unset autologout

if ($?USER == 0 || $?prompt == 0) exit

alias a                 'alias | more'
alias cd                'cd  \!*'
alias check             'last | grep -v fubar.com | grep -v ftp | grep -v "^U"'
alias cp                'cp -i -p'
alias cls               'clear'
alias dd                'ls -lgF \!* | more'
alias ddm               'ls -lgF \!* | more'
alias elm               'pine'
alias jobs              'jobs -l'
alias ld                'ls -ld $1'
alias ls                'ls -F'
alias pico              'pico -w -z'
alias port              'ps -aux | grep $1'
alias quit              'exit'
alias scr               'source .cshrc;rehash'
alias su                "ksu"
alias sz                'sz -w 2048'
alias w                 'w|sort|more'
alias who               'who|sort|more'
alias whois             'whois -h rs.internic.net'
alias viman             'man \!$ | col -b > /tmp/myman$$;vi /tmp/myman$$;rm
/tmp/myman$$'
/usr/lib/sendmail x@cmeinel.com < .junk=======================

More shell programming --->>


Carolyn's most
popular book,
in 4th edition now!
For advanced
hacker studies,
read Carolyn's
Google Groups
Subscribe to Happy Hacker
Email:
Visit this group

 

Return to the index of Guides to (mostly) Harmless Hacking!

 © 2013 Happy Hacker All rights reserved.