[转帖]WebLogic密码恢复(二)_ 3_Tomcat, WebLogic及J2EE讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  Tomcat, WebLogic及J2EE讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3321 | 回复: 0   主题: [转帖]WebLogic密码恢复(二)_ 3        下一篇 
songjian
注册用户
等级:上尉
经验:711
发帖:60
精华:0
注册:2012-11-8
状态:离线
发送短消息息给songjian 加好友    发送短消息息给songjian 发消息
发表于: IP:您无权察看 2012-11-12 10:17:17 | [全部帖] [楼主帖] 楼主

简单编写一个客户端即可调用之,例如:

北京联动北方科技有限公司北京联动北方科技有限公司代码

import java.util.*;
import java.io.*;
public class Main {
      public static void main(String args[]) {
            try{
                  if ( args== null || args.length<2 ) {
                        System.out.println("Usage:" );
                        System.out.println("arg1 = Server/lib or the Directory which has the requried JAR files");
                        System.out.println("arg2 = App Domain or the Directory which has SerializedSystemIni.dat");
                        System.out.println("[arg3] = 3DES hashed password");
                        System.exit(0);
                  }
                  if (! new File(args[0]).exists()) {
                        System.out.println("Path ["+args[0]+"] does not exists");
                        System.exit(0);
                  }
                  if (! new File(args[1]).exists()) {
                        System.out.println("Path ["+args[1]+"] does not exists");
                        System.exit(0);
                  }
                  String beaDir= args[0];
                  String appDir= args[1];
                  String hashedPassword= null;
                  if (args.length>= 3) {
                        hashedPassword= args[2];
                  }
                  Weblogic81Utils weblogic81Utils= new Weblogic81Utils(beaDir, appDir);
                  String configXML= weblogic81Utils.getConfigXML();
                  Properties bootProperties= (Properties) weblogic81Utils.getBootProperties();
                  System.out.println("---------------------------------------------------------------------");
                  System.out.println("boot.properties" + " <username>" + bootProperties.getProperty("username"));
                  System.out.println("boot.properties" + " <password>" + bootProperties.getProperty("password"));
                  if (hashedPassword!= null) {
                        String plainTextPassword= weblogic81Utils.decryptString(hashedPassword);
                        System.out.println(hashedPassword+ " ==" + plainTextPassword);
                  }
                  System.out.println("---------------------------------------------------------------------");
            }
            catch (Exception e) {
                  throw (RuntimeException)new IllegalArgumentException("Unable to initialize encryption routines from provided ar guments").initCause(e);
            }
      }//end of main
}


    注意decryptString()本来不是public的。运行时,第一个参数是server/lib对应的目录路径,如C:beawls816weblogic81serverlib;第二个参数是域目录;第三个参数是可选的,你可以从boot.properties或者其他xml里拿到密码片段然后作为这个参数,如{3DES}g+uYFmHnzJ7jojlRd+SOwg==,注意在boot.properties文件中,有时用=代表一个=,这是由于.properties文件的格式要求,你运行以上程序(Main.java)时输入的第三个参数不应该包含号。

    另外还有知道,这些程序解密时都需要读取域目录下的一个文件SerializedSystemIni.dat,以作为解密的key使用,因此,不能把一个域中的加密后的字符片段拿到另一个域中去解,那样是解不出来的。




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论