Sunday, February 10, 2019

Decrypt weblogic administrator password

1- Copy the following script to a file with name "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(domainHomeAbsolutePath)
    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  "
  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

2-  Open the CMD 
go to weblogic home bin folder andwrite: setDomainEnv.cmd:
cd C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\bin
setDomainEnv.cmd
 then navigate to the location of the file then write the following line:
java  weblogic.WLST decryptPassword.py <DOMAIN_HOME> <ENCRYPTED_PASSWORD>
java weblogic.WLST decryptPassword.py C:\Users\mahmoud\AppData\Roaming\JDeveloper\system11.1.2.4.39.64.36.1\DefaultDomain {AES}eNW4AD06XvWrYzirznFc1QfKreE6c4Wxn8de7xCsQw8=



No comments:

Post a Comment

java - fill distinct objects in ArrayList

If you have a list that contains some objects that it is considered as duplication when two or three fields of these objects are equal. How ...