home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / dada / lock < prev    next >
Text File  |  1986-02-27  |  4KB  |  124 lines

  1.                              LOCK                            March 19, 1985
  2.                             ~~~~~~
  3.  
  4. Lock is a simple Xenix/Unix shell script program that allows the user to
  5. lock up his or her terminal. It can also be used to keep snoops out of your
  6. personal files, or use it to lock up a program that you don't want others
  7. to use.
  8.  
  9. It's strongest feature is that only the correct password will break
  10. the program loop, (or a complete system shutdown). No amount of key hitting
  11. will break it.
  12.  
  13. Lock could even be put in /etc/rc to prevent unauthorized users from
  14. reactivating multiuser mode. I personally have not explored all the 
  15. applications open to this type of program. I'm sure there are many more.
  16.  
  17. This program should work well for all Xenix/Unix users since it is
  18. a straight forward shell program with no hidden goodies in it.
  19.  
  20. For users of other systems it should be fairly simple to alter the
  21. commands to fit your systems requirements.
  22.  
  23.  
  24.  
  25. Let's look at the program structure;
  26. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27.  
  28.  
  29. :  " Dave's Terminal Lock Program       (revision 1.1)     March 19, 1985  "
  30.  
  31. echo
  32. echo ":Lock On:"
  33. echo
  34. while true
  35. do
  36. stty -echo
  37. if test wow = "$password"
  38. then echo ; echo ; echo ":Lock Off:" ; reset ; exit
  39. else echo ; trap "continue" 2
  40. echo -n "Password? "
  41. read password
  42. fi
  43. done
  44.  
  45.  
  46.  
  47. Line by line Summary of commands;
  48. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49.  
  50. (echo)              Tells the interpreter to display the following data
  51.                     on the CRT, (echo) on a line by itself is the same as
  52.                     a carriage return.
  53.  
  54. (while true)        Is the start of a loop cycle.
  55.  
  56. (do)                Starts the loop.
  57.  
  58. (stty -echo)        Stops characters from being echoed back to the
  59.                     terminal, (characters that you type on your keyboard 
  60.                     will not be displayed at your terminal).
  61.  
  62. (if-then-else)      Most processors have some sort of (if-then-else) clause.
  63.  
  64. (test)              Should be self explanatory.
  65.  
  66. (reset)             Is a terminal reset program, hopefully your system
  67.                     will have the equivalent of some such command.
  68.  
  69. (exit)              Obvious isnt it?
  70.  
  71. (trap "continue" 2) Tells the program not to accept anything but the correct
  72.                     password. No amount of key hitting or "phreaking" will
  73.                     break the loop, only a correct password or a complete
  74.                     system shutdown.
  75.                     The "2" means start the program over again at line #2.
  76.  
  77. (echo -n)           Tells the interpreter to keep the cursor on this line.
  78.  
  79. (read)              Tells the interpreter to "read" what you typed at the
  80.                     keyboard upon reciept of the next carriage return.
  81.  
  82. (fi)                Closes the (if-then-else) statements.
  83.  
  84. (done)              Ends loop.
  85.  
  86. The symbol (;) is a mnemonic for a new line.
  87.            ($) sets up a variable.
  88.  
  89.  
  90. Notes;
  91. ~~~~~
  92. -When you first try this program some care should be used. Instead of
  93.  using ; trap "continue" 2
  94.  use   ; echo "Nope, that's not it"
  95.  When the program is executing properly then you can put in the correct
  96.  statement.
  97.  
  98. -After typing up the program and checking it out, for terminal locking
  99.  change the permissions accordingly and put the program in your home
  100.  directory or in /usr/bin. Don't forget to make the program executable!
  101.        
  102. -To use the program for text file or program access, simply insert
  103.  the text or program right after the "done" statement.
  104.  
  105. -The password can be any word or combination of words and can be any
  106.  combination of alpha or numeric data.
  107.  
  108. Summary: 
  109. ~~~~~~~
  110.  
  111. As stated previously this little program can be used in a variety
  112. of applications. One of it's strongest features is the fact that
  113. ONLY the CORRECT password will break the program loop and reset
  114. the system back to normal status. This includes the rub-out key,
  115. the delete key, any and all control keys, etc.
  116.  
  117. If you choose not to use the program itself so be it, but notice
  118. (if your familiar with Xenix/Unix) how to prevent users from 
  119. interrupting a program execution, including using the delete key,
  120. by having the "read" command at the bottom of the script instead
  121. of at the top or middle of the program.
  122.  
  123.  
  124. he delete key,