Thursday, 6 October 2016

Decrypting Weblogic Password


If you forget your weblogic password , you can recover it as it is stored in boot.properties file in encrypted format .
NOTE : You have to make boot.properties file in AdminServer/security folder first, it is not automatically present .


Step 1 : 
  Create a script decrypt.py in $DOMAIN_HOME/security directory and paste the following code into it:

from weblogic.security.internal import *
from weblogic.security.internal.encryption import *

#This will prompt you to make sure you have SerializedSystemIni.dat file under #current directory from where you are running command

raw_input("Please make sure you have SerializedSystemIni.dat inside the current directory, if yes press ENTER to continue.")


# Encryption service

encryptionService = SerializedSystemIni.getEncryptionService(".")

clearOrEncryptService = ClearOrEncryptedService(encryptionService)


# Take encrypt password from user

pwd = raw_input("Please enter encrypted password (Eg. {3DES}Bxt5E3...): ")


# Delete unnecessary escape characters

preppwd = pwd.replace("\\", "")


# Decrypt password


print "Your password is: " + clearOrEncryptService.decrypt(preppwd)

-------------------------------------------------------------------------------------------------------------------------

Step 2 :
 
Go to $WL_HOME/server/bin folder
Run the below command to set environment
. ./setWLSEnv.sh ( make sure you have two dots separated by a space)

Step 3:
Goto $DOMAIN_HOME/servers/AdminServer/security/boot.properties file and copy the encrypted username 
Step 4 :
Run the script in $DOMAIN_HOME/security folder as 
java weblogic.WLST decrypt.py 
and enter the encrypted password when prompted and then press enter .
You will get the original password !!



No comments:

Post a Comment