Skip to content

Instantly share code, notes, and snippets.

@phi1ipp
Created November 19, 2020 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phi1ipp/5460903d58d62ea17be0774c331f27aa to your computer and use it in GitHub Desktop.
Save phi1ipp/5460903d58d62ea17be0774c331f27aa to your computer and use it in GitHub Desktop.
WLST password recovery for WebLogic datastores
#!/prod/app/oracle/iammiddleware/oracle_common/common/bin/wlst.sh
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:", sys.argv[0], "DOMAIN_HOME ENCRYPTED_PASSWORD"
print " Example:"
print sys.argv[0], "D:/Oracle/Middleware/user_projects/domains/base_domain {AES}819R5h3JUS9fAcPmF58p9Wb3syTJxFl0t8NInD/ykkE="
except:
print "Unexpected error: ", sys.exc_info()[0]
dumpStack()
raise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment