[英]How to get properties of Authentification Alias on WAS 7 using wsadmin
I created a script in Jython which extracts some properties of a Data Source from WAS 7. One of theese properties is the Authentification Alias. 我在Jython中创建了一个脚本,该脚本从WAS 7中提取了数据源的某些属性。这些属性之一是Authentification Alias。 I know that the password is crypted, but project has a semididactical purpose so the focus is on retriving the username and password, not to hack something.
我知道密码是加密的,但是项目的目的是半确定性的,因此重点是检索用户名和密码,而不是破解某些东西。
How can I extract the properties of the Authentification Alias, i mean the username and the password? 如何提取身份验证别名的属性,即用户名和密码?
Thanks in advance! 提前致谢!
I solved the problem. 我解决了问题。 :) Let's start with the beginning.
:)让我们从头开始。
You have to find security.xml (WAS_HOME/AppServer/profiles/ Profile_Name /config/cells/ Cell_Name /security.xml) file and search in it the Authentication Alias. 您必须找到security.xml (WAS_HOME / AppServer / profiles / Profile_Name / config / cells / Cell_Name /security.xml)文件,然后在其中搜索身份验证别名。
Keep the line that contains the Auth Alias in a variable called Line and then extract the username, password and description. 将包含Auth Alias的行保留在名为Line的变量中,然后提取用户名,密码和描述。
After that you have to decrypt your password with a XOR algorithm, and write the variables in a file as a list. 之后,您必须使用XOR算法解密密码,然后将变量作为列表写入文件中。 Ex: AuthDataAlias = [\\ ['AuthAlias', 'username', 'password', 'description'] ]
例如: AuthDataAlias = [\\ ['AuthAlias','用户名','密码','描述']]
Code: 码:
import sys, java, java.io, java.lang, base64, binascii
resFile="resources.res"
def search ( alias, file ):
f=open(file)
lines=f.readlines()
for line in lines:
poz = line.find('/'+alias)
if poz > 0:
Line = line
break
user = Line[Line.find('userId=')+8:Line.find('\" password')]
password = Line[Line.find('password=')+15:Line.find('\" description')]
password = decrypt(password)
description = Line[Line.find('description=')+13:Line.find('\"/>')]
write ( AuthAlias, user, password, description, resFile)
def write ( alias, user, password, desc, file ):
objItemFileOutputStream = java.io.FileOutputStream(file, 1) #apend la sfirsit fisier
objItemFileOutputStream.write('\n')
AuthList = "AuthDataAlias = [\\\n[\'"+alias+"\', \'"+user+"\', \'"+password+"\', \'"+desc+"\'] ]"
objItemFileOutputStream.write(AuthList)
def decrypt ( word ):
if not len(word) > 1: exit()
word = word.replace(':', '')
value1 = binascii.a2b_base64(word)
value2 = '_' * len(value1)
out = ''
for a, b in zip(value1, value2):
out = ''.join([out, chr(ord(a) ^ ord(b))])
return out
#MAIN
search ( AuthAlias, securityFile )
If anyone gets stuck with this issue feel free to post your questions and I will try to answer ASAP. 如果有人对此问题感到困惑,请随时发表您的问题,我将尽快回答。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.