Created
November 19, 2020 22:55
-
-
Save phi1ipp/5460903d58d62ea17be0774c331f27aa to your computer and use it in GitHub Desktop.
WLST password recovery for WebLogic datastores
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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