Sunday, 1 April 2018

How to Decrypt password of Weblogic 11g Admin Console from any path in the terminal?

Steps to create a script and decrypt the password encrypted(AES)


1. Copy the password from the boot.properties file in the path $WLS_MIDDLEWARE_DOMAIN/user_projects/domains/Domain_Name/servers/AdminServer/security/boot.properties

2. Change the directory in the terminal to the weblogic domain directory of which password is to be decrypted

"cd $WLS_MIDDLEWARE_DOMAIN/user_projects/domains/Domain_Name/

3. Create a python script file using the vi editor command "$vi DecryptTest.py" 

Copy and paste the below code 

*********************************************
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 DecryptTest.py <{AES}lS2Fkjs0z5pXl9FgAj/hQvmhP59Pdyj27QdWWFWIsPM\=>"
        print " Example:"
        print "java weblogic.WLST DecryptTest.py
<{AES}lS2Fkjs0z5pXl9FgAj/hQvmhP59Pdyj27QdWWFWIsPM\=>"

except:
    print "Unexpected error: ", sys.exc_info()[0]
    dumpStack()
    raise
**************************************************

4. Execute the below command and then enter the encrypted password copied from boot.properties file 

$java weblogic.WLST decrypttest.py <absolute path of Weblogic domain>


Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Output:-
Decrypted Password:xxxxxxxx


No comments:

Post a Comment

All about WebLogic t3 and t3s Protocol

WebLogic's  implementation of the RMI specification uses a proprietary protocol known as T3. You can think of T3 (and secure T3S) as a l...