Difference between revisions of "Talk:Random Strong Password Generator"

From SME Server
Jump to navigationJump to search
(Undo revision 32253 by RequestedDeletion (talk))
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Original code (/usr/bin/randpw)==
+
==Original code (/usr/bin/randpw) and changelog==
 
  #!/bin/bash
 
  #!/bin/bash
ARG=$1
+
  if [[ ! $1 =~ ^[0-9]+$ ]]; then
  if [[ ! $ARG =~ ^[0-9]+$ ]]; then
 
 
   echo "Invalid argument. Argument must be a positive number.";echo
 
   echo "Invalid argument. Argument must be a positive number.";echo
 
   echo "Usage: randpw [n]";echo
 
   echo "Usage: randpw [n]";echo
 
   logger -i ERROR: no positive integer provided, no password generated -t randpw
 
   logger -i ERROR: no positive integer provided, no password generated -t randpw
 
  else
 
  else
   < /dev/urandom tr -dc '_A-Z-a-z-0-9!?@+[](){}~<>*%^&#+=\.$:;,-' | head -c${1:-$1};echo;
+
   < /dev/urandom tr -dc '_A-Z-a-z-0-9!?@+[](){}"|_~<>*%^&#+=/\.$:;,-' | head -c${1:-$1};echo;
 
   exit 0
 
   exit 0
 
  fi
 
  fi
 
  exit 0
 
  exit 0
 +
 +
==Changelog==
 +
* Nov 7. 2016 - Removed debug ARG variable, added /,| and _ to the list of characters.

Latest revision as of 21:27, 7 November 2016

Original code (/usr/bin/randpw) and changelog

#!/bin/bash
if [[ ! $1 =~ ^[0-9]+$ ]]; then
  echo "Invalid argument. Argument must be a positive number.";echo
  echo "Usage: randpw [n]";echo
  logger -i ERROR: no positive integer provided, no password generated -t randpw
else
  < /dev/urandom tr -dc '_A-Z-a-z-0-9!?@+[](){}"|_~<>*%^&#+=/\.$:;,-' | head -c${1:-$1};echo;
  exit 0
fi
exit 0

Changelog

  • Nov 7. 2016 - Removed debug ARG variable, added /,| and _ to the list of characters.