#! /bin/ksh -f ############################################################################# # # NOTE: This file under revision control using RCS # Any changes made without RCS will be lost # # $Source: /share/local/bin/RCS/shpass_gen,v $ # $Revision: 1.1 $ # $Date: 1996/05/16 14:21:35 $ # $Author: mhansen $ # $Locker: $ # $State: Exp $ # # # Purpose: Generate random passwords using only the # korn shell with alternating consonants and vowels # to make the passwords easier to remember. Also # include one numeric character. # # Randomly choose one of these four patterns: # c-v-c-v-c-v-c-n # n-c-v-c-v-c-v-c # c-v-c-n-c-v-c-v # c-v-c-v-n-c-v-c # # Leaves out zeros and ones to avoid confusion when # reading passwords, and alpha characters in all # lowercase. # # Directions: Usage: shpass_gen # No args, returns suggested password. # # Default Location: /share/local/bin/shpass_gen # # Invoked by: user # # Copyright (C) 1996 Marc Hansen # # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public # License as published by the Free Software Foundation available at: # http://http://www.gnu.org/copyleft/gpl.html # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # ############################################################################# # # # REVISION HISTORY: # # $Log: shpass_gen,v $ # Revision 1.1 1996-05-18 14:21:35 mhansen # Added four different patterns # # Revision 1.0 1996-05-04 11:48:18 mhansen # Initial revision # # # # Constants # set -A vwl a e i o u set -A con b c d f g h k l m n p r s t v w z set -A num 2 3 4 5 6 7 8 9 TYPE=`expr $RANDOM % 4` case $TYPE in 0) out[1]=${con[RANDOM%17]} out[2]=${vwl[RANDOM%5]} out[3]=${con[RANDOM%17]} out[4]=${vwl[RANDOM%5]} out[5]=${con[RANDOM%17]} out[6]=${vwl[RANDOM%5]} out[7]=${con[RANDOM%17]} out[8]=${num[RANDOM%8]} ;; 1) out[1]=${num[RANDOM%8]} out[2]=${con[RANDOM%17]} out[3]=${vwl[RANDOM%5]} out[4]=${con[RANDOM%17]} out[5]=${vwl[RANDOM%5]} out[6]=${con[RANDOM%17]} out[7]=${vwl[RANDOM%5]} out[8]=${con[RANDOM%17]} ;; 2) out[1]=${con[RANDOM%17]} out[2]=${vwl[RANDOM%5]} out[3]=${con[RANDOM%17]} out[4]=${num[RANDOM%8]} out[5]=${vwl[RANDOM%5]} out[6]=${con[RANDOM%17]} out[7]=${vwl[RANDOM%5]} out[8]=${con[RANDOM%17]} ;; 3) out[1]=${con[RANDOM%17]} out[2]=${vwl[RANDOM%5]} out[3]=${con[RANDOM%17]} out[4]=${vwl[RANDOM%5]} out[5]=${num[RANDOM%8]} out[6]=${con[RANDOM%17]} out[7]=${vwl[RANDOM%5]} out[8]=${con[RANDOM%17]} ;; esac echo "${out[*]}" | tr -d ' '