6 Replies Latest reply on Dec 4, 2015 2:11 AM by GIGI CHEN

    How to decrypted a encrypted password

    GIGI CHEN

      Because we have need use BSA build-in script to create user

      So the password need encrypted

      We can how to know the encrypted password?

      Have any encrypted tools

      1202.png

       

      PASSWORD : ALLWLXNMLWBTQKTPNOBNKALZZOWTPOZWZAOTZNQAXAXLAAZAZKTENXZAQVXLVNXA

       

      As bellow script it build-in Depot:

       

      SERVER=$1

      USER=$2

      PASSWORD=$3

       

      blcli_execute BlValue createEncryptedStringBlValueBean

      if [ $? -ne 0 ]

      then

      echo "BLCLI command execution failed. Refer to logs for details."     

          exit 1

      fi

      blcli_execute EncryptedStringBlValueBean parseFromString $PASSWORD >nul

      if [ $? -ne 0 ]

      then

      echo "Failed to read the encrypted password. Refer to logs for details."    

          exit 1

      fi

      blcli_execute EncryptedStringBlValueBean getClearTextString >nul

      if [ $? -ne 0 ]

      then

      echo "Failed to decrypt the password. Refer to logs for details."

          exit 1

      fi

      blcli_storeenv DECRYPTED_PWD

       

      RESULT=`nexec $SERVER net user $USER >nul 2>&1 && echo User exists || echo User doesnt exist`

      if [ "$RESULT" = "User exists" ]

      then

      echo "User exists. Setting password."

      cd //@/

          echo "net user $USER $DECRYPTED_PWD" > //$SERVER/c/modifyuser.cmd

          RESULT=`nexec -D //$SERVER/c -e /c/modifyuser.cmd`

          EXIT_CODE=$?

          rm -f //$SERVER/c/modifyuser.cmd

          echo $EXIT_CODE

      if [ $? -eq 0 ]

      then        

      RESULT=`nexec $SERVER net localgroup "Remote Desktop Users" $USER /add >nul 2>&1 && echo Not in group || echo In group`         

      if [ "$RESULT" = "In group" ]

      then

      echo "User was already in Remote Desktop Users group."

      else         

      echo "User was added to Remote Desktop Users group."

      fi

      RESULT=`nexec $SERVER net localgroup "Administrators" $USER /add >nul 2>&1 && echo Not in group || echo In group`           

      if [ "$RESULT" = "In group" ]

      then

      echo "User was already in Administrators group."

      else         

      echo "User was added to Administrators group."

      fi

      else

      echo $RESULT

      exit 1

      fi

      else

      echo "User does not exist. Adding user."

      cd //@/

          echo "Setting password for new user"

          echo "net user $USER $DECRYPTED_PWD /add" > //$SERVER/c/adduser.cmd

          RESULT=`nexec -D //$SERVER/c -e /c/adduser.cmd`

          EXIT_CODE=$?

          rm -f //$SERVER/c/adduser.cmd

          echo $EXIT_CODE

      if [ $? -eq 0 ]

      then

      echo "User added.  Adding user to Remote Desktop Users group"

      RESULT=`nexec $SERVER net localgroup "Remote Desktop Users" $USER /add`

      if [ $? -eq 0 ]

      then

      echo "Adding user to Administrators group"

      RESULT=`nexec $SERVER net localgroup "Administrators" $USER /add`

      EXIT_CODE=$?

      echo $EXIT_CODE

      else

      echo $RESULT

      exit 1

      fi

      else

      echo $RESULT

      exit 1

      fi

      fi