File: randpass

package info (click to toggle)
bacula 15.0.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 29,780 kB
  • sloc: ansic: 194,276; cpp: 41,177; sh: 28,258; python: 6,669; makefile: 5,275; perl: 3,666; sql: 1,371; java: 345; xml: 196; awk: 51; sed: 25
file content (27 lines) | stat: -rwxr-xr-x 689 bytes parent folder | download | duplicates (14)
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
#! /bin/sh
#
#   Generate a random password, written to standard output
#   By John Walker
#
LANG=C
if test "x$1" = "x" ; then
   PWL=48      # Password length in characters
else
   PWL=$1
fi 
tmp=`mktemp randpass.XXXXXXXXXX`
if test x$tmp = x; then
   tmp=/tmp/p.tmp.$$    
   if test -f $tmp; then
      echo "Temp file security problem on: $tmp"
      exit 1
   fi
fi
cp autoconf/randpass.bc $tmp
ps | sum | tr -d ':[:alpha:] ' | sed 's/^/k=/' >>$tmp
date | tr -d ':[:alpha:] ' | sed 's/^/k=k*/' >>$tmp
ls -l /tmp | sum | tr -d ':[:alpha:] ' | sed 's/^/k=k*/' >>$tmp
echo "j=s(k); for (i = 0; i < $PWL; i++) r()" >>$tmp
echo "quit" >>$tmp
bc $tmp | awk -f autoconf/randpass.awk
rm $tmp