twitter
    !! Tell us what you want to Learn / Know !!

How to Decrypt a WebLogic Password ?

Sooner or later you may face a situation where you do not remember any of the WebLogic server passwords stored in the configuration files.

Let us see how to decrypt the password.

Step1:
    Open a command prompt and navigate to the domain bin

user_projects/DOMAIN_HOME/bin

and enter the following command setDomainEnv.cmd


Step2:
       Copy the following into a file and save it as decrypt.py (click here to download the file)

import os
import weblogic.security.internal.SerializedSystemIni
import weblogic.security.internal.encryption.ClearOrEncryptedService

def decrypt(domainHomeName, encryptedPwd):
    domainHomeAbsolutePath = os.path.abspath(domainHomeName)
    encryptionService = weblogic.security.internal.SerializedSystemIni.getEncryptionService(domainHomeAbsolutePath)
    ces = weblogic.security.internal.encryption.ClearOrEncryptedService(encryptionService)
    clear = ces.decrypt(encryptedPwd)
    print "Decrypted Password:" + clear

try:
    if len(sys.argv) == 3:
        decrypt(sys.argv[1], sys.argv[2])
    else:
        print "INVALID ARGUMENTS"
        print " Usage: java weblogic.WLST decryptPassword.py <DOMAIN_HOME> <ENCRYPTED_PASSWORD>"
        print " Example:"
        print "    java weblogic.WLST decryptPassword.py D:/Oracle/Middleware/user_projects/domains/base_domain {AES}819R5h3JUS9fAcPmF58p9Wb3syTJxFl0t8NInD/ykkE="
except:
    print "Unexpected error: ", sys.exc_info()[0]
    dumpStack()
    raise

Step3:
      Copy the file to domain root directory

user_projects/Sample_Domain/

Step4:
     Execute the following command

Syntax:
    java  weblogic.WLST  decrypt.py  .  encrypted_password_from_boot.properties

Example:
    java  weblogic.WLST  decrypt.py  .  {3DES}H6HVU9HWbD8AD2BHQajnEA==



Enjoy.. :-)

Note:
     It is not a security violation, the encrypted passwords are not accessible to everyone.



5 comments:

Anonymous said...

Thanks a lot dude

Anonymous said...

Excelent. Thanks

Unknown said...

Excelent. Thanks

Surendra said...

Delete the extra spaces and try it.

Unknown said...

Solid. Just what I needed. Thanks!

Post a Comment