简体   繁体   English

如何使用wsadmin在WAS 7上获取身份验证别名的属性

[英]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.

相关问题 如何使用带有非英文字符值的 wsadmin 自定义 WebSphere 的定制属性 - How to customize customized properties for WebSphere using wsadmin with values in non-English characters 使用wsadmin将定制属性添加到资源环境条目 - Adding custom properties to resource environment entries using wsadmin IBM wsadmin-如何获取每个应用程序服务器的应用程序状态 - IBM wsadmin - How to get the status of an application per application server 如何从WebSphere 7.0的wsadmin控制台获取当前应用程序状态 - How to get current application state from wsadmin console for WebSphere 7.0 在jacl和wsadmin中使用变量 - using variables in jacl and wsadmin 使用wsadmin时如何在MapWebModToVH中设置包含空格的字符串值 - How to set a string value containing spaces into MapWebModToVH when using wsadmin 如何使用wsadmin将应用程序安装到WebSphere 7.0集群? - How to install applications to a WebSphere 7.0 cluster using wsadmin? 如何使用wsadmin Jython脚本确定应用程序是否正在运行? - How do I determine if an application is running using wsadmin Jython script? 如何使用 wsadmin jython 脚本启动所有应用服务器? - How to start all the appservers using wsadmin jython script? IBM WebSphere:如何使用wsadmin脚本编写将应用程序映射到多个集群? - IBM WebSphere: How to map an application to multiple clusters using wsadmin scripting?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM