Recently I had the entrust to get the admin account password of weblogic, so after a little bit searching in oracle documentation and web I used the following code:
The steps:
1.- Build script get_password.py
from weblogic.security.internal import *
from weblogic.security.internal.encryption import *
encryptionService = SerializedSystemIni.getEncryptionService(".")
clearOrEncryptService = ClearOrEncryptedService(encryptionService)
# Take encrypt password from user
pwd = raw_input("Paste encrypted password ({AES}fk9EK...): ")
# Delete unnecessary escape characters
preppwd = pwd.replace("\\", "")
# Display password
print "Decrypted string is: " + clearOrEncryptService.decrypt(preppwd)
2.- Set the environmental variables
sh $DOMAIN_HOME/bin/setDomainEnv.sh | source $DOMAIN_HOME/bin/setDomainEnv.sh
3.- Get the username and password
grep username $DOMAIN_HOME/servers/AdminServer/security/boot.properties | sed -e "s/^username=\(.*\)/\1/"
|
grep password $DOMAIN_HOME/servers/AdminServer/security/boot.properties | sed -e "s/^password=\(.*\)/\1/"
4.- cd $DOMAIN_HOME/security
java weblogic.WLST get_password.py
bash-3.2$ java weblogic.WLST get_password.py
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Paste encrypted password ({AES}fk9EK...):
(OR USERNAME)
Decrypted string is: admin
Voilá!
Resources:
https://blogs.oracle.com
Update:
If your environment doesn't recognize your wlst command do the following:
sh /$ENV/fmw/product/111/soa_111/common/bin/wlst.sh get_password.py
You must be located in $DOMAIN_HOME/security.