---
title: "破解WebSphere Application Server加密密码的方法"
author: "bravewu"
date: "2009-02-27T00:56:32Z"
tags: []
categories: ["企业架构"]
slug: "websphere-application-server"
draft: false
lastmod: "2009-02-27T11:42:19Z"
id: 339706
url: "https://bradoo.iteye.com/blog/339706"
---

在使用WebSphere Application Server时，难免会碰到忘记密码的情况。对于一些WAS新手而言，遇到这样的问题，肯定只能选择重装WAS了，但很多时候如果你的WAS是使用其他的LDAP服务器走用户认证，或者连接的数据库在远程服务器密码忘了，这种情况下“重装”也是没用的。好了不说废话了，相信凡是看这篇文章的人都是很想知道怎么破解这个密码的方法。那我们还是尽快切入正题吧！

首先说一下存储密码的文件路径：\profiles\\config\cells\\security.xml

例如我本及安装的WebSphere Portal Server所用的WAS密码存储文件就在这个路径下：

C:\IBM\WebSphere\profiles\wp_profile\config\cells\IBM-L\security.xml


然后来看一下密码怎么找：

目前为止我在WAS只用过以下两种密码：

(1) 管理员密码：这个一般都是和管理员的用户名放在一块的。像我这个文件里的管理员用户名是：bradoo 而密码则是:xor}PS0+OzAw


```java
...<userRegistries xmi:type="security:CustomUserRegistry" xmi:id="CustomUserRegistry_1" serverId="bradoo" serverPassword="{xor}PS0+OzAw" ignoreCase="true" customRegistryClassName="com.ibm.websphere.wmm.registry.WMMUserRegistry">
    <properties xmi:id="Property_1234689183734" name="WMMUR_LOGGING" value="false" required="false"/>
    <properties xmi:id="Property_1234689184391" name="WMMUR_CONFIG" value="C:/PROGRA~1/IBM/SDP70/runtimes/PORTAL~3/wmm/wmmur.xml" required="true"/>
    <properties xmi:id="Property_1234689184906" name="WASUSER_REGISTRY_TYPE" value="wmmFileRegistry" required="true"/>
    <properties xmi:id="Property_1234689185234" name="wmmUserSecurityNameAttr" value="uid" required="true"/>
    <properties xmi:id="Property_1234689185875" name="wasAdminFileLoc" value="C:/PROGRA~1/IBM/SDP70/runtimes/PORTAL~3/wmm/wmmWASAdmin.xml" required="true"/>
  </userRegistries>...
```


(2) J2C 密码：这个也是J2C用户名放在一起。以下是"db2admin"的密码：{xor}DTovMz48Ogg2KzcGMCotGz0eOzI2MQ8oOw==


```java
...<authDataEntries xmi:id="JAASAuthData_1234685624344" alias="wpdbDSJAASAuth" userId="db2admin" password="{xor}DTovMz48Ogg2KzcGMCotGz0eOzI2MQ8oOw==" description="JAAS Alias for DataSource wpdbDS"/>..
```


最后到了最重要的一步了:破解密码。

其实这个破解方法就是使用WAS自己的加密的API,本来是需要调用好多jar文件才能完成破解的，我为了大家使用方便，花了一些时间，将本来大概10M的jar文件整理了一下，变成本文附件中不到100k的一个jar文件:"password.jar"。为了使用方便，我还写两个可以传参数的bat文件：
encoder.bat 用于加密 使用方法是：encoder ""，如下图所示：

![](/upload/attachment/79323/c6dd71b6-9437-3ee7-a740-9e9d732a587d.png)

decoder.bat 用于解密 使用方法是：decoder ""，如下图所示：

  
![](/upload/attachment/79325/30598068-e26b-3041-ae1f-9a5904bb1854.png)


到这儿，相信大家都知道怎么用了吧! 以上提到文件都可以在本文的附件中[下载](http://bradoo.iteye.com/topics/download/68fa2525-cd67-3245-9b77-396f01720b47)。