Advertisement
Guest User

Untitled

a guest
Apr 10th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.89 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. read -p $'[+] Please enter how many accounts you want to assign with a passwords:\n' ACCOUNTS
  5. read -p  $'[+] Do you want to store the log-in location of your Accounts [y/n]:\n'  CHECK_LOCATION
  6.  
  7. declare -i y=ACCOUNTS
  8. counter=1
  9. function generate () {
  10.     PASS=$(pwgen -n -y -c $PASSLENGHT 1)
  11.     echo $PASS
  12. }
  13.  
  14.  
  15.  
  16.  
  17. if  test $y == 1
  18. then
  19.     read -p $'[+]Please enter the password length:\n'  PASSLENGHT
  20.     read -p $'[+]Please enter email or username to assign the generated password:\n ' USERNAME
  21.     PASSWORD=$(generate)
  22.     if [ "$CHECK_LOCATION" == "y" ]
  23.     then
  24.         read -p $'[+]Please enter the url for the generated pair: \n ' LOCATION
  25.         echo   "[+]The password $PASSWORD is assign to $USERNAME for $LOCATION "
  26.         echo  "Location: $LOCATION      Username: $USERNAME         Password: $PASSWORD" >> Accounts.txt
  27.     else
  28.    
  29.         echo  "[+]The password $PASSWORD is assign to $USERNAME "
  30.         echo  "Username: $USERNAME      Password: $PASSWORD" >> Accounts.txt  
  31.     fi
  32.  
  33. elif  test $y > 1
  34. then
  35.     while [[ $y > 0 ]]; do
  36.        
  37.        
  38.         if [ "$CHECK_LOCATION" == "y" ]
  39.         then
  40.         read -p $'[+]Please enter the password length: \n '  PASSLENGHT ;
  41.         PASSWORD_MORE=$(generate)
  42.         read -p $'[+]Please enter email or username to assign the generated password:\n ' USERNAME
  43.         read -p $'[+]Please enter the url for the generated pair:\n ' LOCATION
  44.         echo  "[+]The password $PASSWORD_MORE is assign to $USERNAME for $LOCATION"
  45.         echo  "Location: $LOCATION      Username: $USERNAME         Password: $PASSWORD_MORE" >> Accounts.txt
  46.         else
  47.         read -p $'[+]Please enter the password length: \n '  PASSLENGHT ;
  48.         PASSWORD_MORE=$(generate)
  49.         read -p $'[+]Please enter email or username to assign the generated password: \n' USERNAME
  50.         echo  "[+]The password $PASSWORD_MORE is assign to $USERNAME "
  51.         echo  "Username: $USERNAME      Password: $PASSWORD_MORE" >> Accounts.txt  
  52.         fi
  53.         ((y--))
  54.         ((counter++))
  55.      done
  56.  
  57. else
  58.     exit
  59. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement