Decrypt password in Weblogic with WLST
Márcio Zampiron ????
Márcio Zampiron ????
Head Cloud|OCI|AWS|GCP|FinOps|CKA|CKAD|DevSecOps|SysAdmin |SRE|Cloud Architect|SOA Architect|Integration Architect|Oracle Middeware Consultant
Estava efetuando a migra??o de uma aplica??o no Weblogic e na cria??o dos DATA SOURCE me deparei que o cliente n?o tinha nada documentando sobre o password do banco "Uma fato nada comum. rsrs". Como a necessidade é a M?e das cria??es, desenvolvi este script que decrypt.
#Execute:
#wlst.sh decrypt.py /home/bmc/Oracle/Middleware/homeOracle12c/user_projects/domains/domainSoa12c/ "{AES}JhaKwt4vUoZ0Pz2gWTvMBx1laJXcYfFlMtlBIiOVmAs="
import os
import weblogic.security.internal.SerializedSystemIni
import weblogic.security.internal.encryption.ClearOrEncryptedService
def decrypt(pathDomain, encryptedPassword):
pathDomainPath = os.path.abspath(pathDomain)
encryptSrv = weblogic.security.internal.SerializedSystemIni.getEncryptionService(pathDomainPath)
ces = weblogic.security.internal.encryption.ClearOrEncryptedService(encryptSrv)
password = ces.decrypt(encryptedPassword)
print "Plaintext password is:" + password
try:
if len(sys.argv) == 3:
decrypt(sys.argv[1], sys.argv[2])
else:
print "Please input arguments as below"
print " Usage 1: java weblogic.WLST decryptWLSPwd.py "
print " Usage 2: decryptWLSPwd.cmd "
print "Example:"
print " wlst.sh decrypt.py /home/bmc/Oracle/Middleware/homeOracle12c/user_projects/domains/domainSoa12c/ {AES}JhaKwt4vUoZ0Pz2gWTvMBx1laJXcYfFlMtlBIiOVmAs="
print " decryptWLSPwd.cmd {AES}JhaKwt4vUoZ0Pz2gWTvMBx1laJXcYfFlMtlBIiOVmAs="
except:
print "Exception: ", sys.exc_info()[0]
dumpStack()
raise
Boa sorte.