Password decryption in Weblogic

来源:互联网 发布:淘宝内部群是真的吗 编辑:程序博客网 时间:2024/06/13 07:54

Weblogic stores the credentials in an encrypted format in configuration files, like the password in JDBC xml files. Sometimes we want to know what's the plain text of those encryptions. This is this purpose of the following WLST script.

# Decrypt an AES password that is encrypted by Weblogic# This script must be run in the same machine as Weblogic# server which encrypted the text is running from.## ScriptName    : decrytp.py# Author        : Peng Zhang # CreatedDate    : 9/15/2011import osimport weblogic.security.internal.SerializedSystemIniimport weblogic.security.internal.encryption.ClearOrEncryptedServicedef 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 "RESULT: " + cleartry:    if len(sys.argv) == 3:        decrypt(sys.argv[1], sys.argv[2])    else:        print "INVALID ARGUMENTS"        print " Usage: java weblogic.WLST decrypt.py DOMAIN_HOME ENCRYPTED_PASSWORD"        print " Example:"        print " java weblogic.WLST decrypt.py D:/Oracle/Middleware/user_projects/domains/base_domain {AES}819R5h3JUS9fAcPmF58p9Wb3syTJxFl0t8NInD/ykkE="except:    print "Unexpected error: ", sys.exc_info()[0]    dumpStack()    raise


原创粉丝点击