![](/img/trans.png)
[英]How to customize customized properties for WebSphere using wsadmin with values in non-English characters
[英]How to get properties of Authentification Alias on WAS 7 using wsadmin
我在Jython中創建了一個腳本,該腳本從WAS 7中提取了數據源的某些屬性。這些屬性之一是Authentification Alias。 我知道密碼是加密的,但是項目的目的是半確定性的,因此重點是檢索用戶名和密碼,而不是破解某些東西。
如何提取身份驗證別名的屬性,即用戶名和密碼?
提前致謝!
我解決了問題。 :)讓我們從頭開始。
您必須找到security.xml (WAS_HOME / AppServer / profiles / Profile_Name / config / cells / Cell_Name /security.xml)文件,然后在其中搜索身份驗證別名。
將包含Auth Alias的行保留在名為Line的變量中,然后提取用戶名,密碼和描述。
之后,您必須使用XOR算法解密密碼,然后將變量作為列表寫入文件中。 例如: AuthDataAlias = [\\ ['AuthAlias','用戶名','密碼','描述']]
碼:
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 )
如果有人對此問題感到困惑,請隨時發表您的問題,我將盡快回答。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.