How to Decrypt Weblogic Encrypted Password

Weblogic Administrators often faces problem during recover a password which is already encrypted in Weblogic_Domain config file. Today we will see a simple way to get rid of this problem forever. Here is a short demo of using this within UNIX environment. You can use it in Windows platform as well with little modification (provided you have a basic idea of batch file)

1. Go to config directory within $WEBLOGIC_DOMAIN where the config.xml file is hosted.

2. Create a file decryptPassword.py. Paste the following code within it and give the file permission to 755 (chmod 755 decryptPassword.py).

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(domainHomeAbsolu
 tePath)
 ces = weblogic.security.internal.encryption.ClearOrEncryptedService(encryptionService)
 clear = ces.decrypt(encryptedPwd)
 print “RESULT:” + 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:/bea/user_projects/domains/base_domain {3DES}xL/RisZRlxBfjr1jlX5Oeg==”
 except:
 print “Unexpected error: “, sys.exc_info()[0]
 dumpStack()
 raise

3. Create another file decrypt_password

4. Put the below code there:

 #!/bin/bash
printf ‘\e[1;32;22m Please Enter Encrypted Password : \e[m\n’
echo ” “
read decrypted_password
WL_HOME=/opt/weblogic-10.3.6/wlserver_10.3
. ${WL_HOME}/server/bin/setWLSEnv.sh
${WL_HOME}/common/bin/wlst.sh decryptPassword.py /bea/user_projects/domains/base_domain $encrypted_password

5. Give permission to decrypt_password as 755.

6. Also copy the SerializedSystemIni.dat file from $WEBLOGIC_DOMAIN/security to the config directory.

7. BINGO!!!Now you have loaded your gun to shoot. Run decrypt_password script and give the encrypted password it to feed. You will get the original password:

Decryption

Advertisements

About Swapratim

Blog Writer in Medium for Chatbots Magazine - world's biggest chatbot magazine. Also he writes in Bot Publication and Chatbots Journal on regular basis (https://medium.com/@swapratimroy). Experienced in IT development & support pursuing different roles & responsibilities. He has worked on several innovative projects. Apart from this, he likes to share his learning with everyone which he had learned over years. Sole purpose of this blog is to share the author's knowledge in IT, passion for travel and recent trends with you. Hope you will enjoy his contents.
This entry was posted in Various Scripting Tutorials. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s