zoukankan      html  css  js  c++  java
  • weblogic 11g 12c 找回控制台密码

    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package javaapplication1;
    
    
    
    import java.util.*;
    import java.io.*;
    import javax.xml.parsers.*;
    import javax.xml.xpath.*;
    import org.w3c.dom.*;
     
    import weblogic.security.internal.*; // requires weblogic.jar in the class path
    import weblogic.security.internal.encryption.*;
    
    /**
     * 
     * weblogic密码忘记破解方法
     * 获取到weblogic安装目录下的两个文件 SerializedSystemIni.dat、 boot.properties
     * (weblogic8上面两个文件在的bea/user_projects/domains/mydomain 目录下)
     * (welogic10 SerializedSystemIni.dat在bea/user_projects/domains/base_domain/security中)
     * (welogic10 boot.properties在bea/user_projects/domains/base_domain/servers/AdminServer/security中)
     * 加入weblogic.jar (weblogic安装目录中寻找,不同版本有可能不同)文件添加至构建路径,
     * welogic10以上版本如果运行还缺少别的类可以把weblogic的/wlserver_10.3/server/lib下的jar都添加到构建路径
     * @author
     *
     */
    public class JavaApplication1 {
     
        private static final String PREFIX = "{AES}";//查看boot.properties文件 加密方式{3DES}或者{AES}
        private static final String XPATH_EXPRESSION
            = "//node()[starts-with(text(), '" + PREFIX + "')] | //@*[starts-with(., '" + PREFIX + "')]";
     
        private static ClearOrEncryptedService ces;
     
        public static void main(String[] args) throws Exception {
          
        	//E:/weblogic10 中的SerializedSystemIni.dat存放目录
            ces = new ClearOrEncryptedService(SerializedSystemIni.getEncryptionService(new File("/Users/z/Desktop/").getAbsolutePath()));
            File file = new File("/Users/z/Desktop/boot.properties");
            if (file.getName().endsWith(".xml")) {//有些可能是xml文件来的?
                processXml(file);
            }
            else if (file.getName().endsWith(".properties")){
                processProperties(file);
            }
        }
     
        private static void processXml(File file) throws Exception {
            Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file);
            XPathExpression expr = XPathFactory.newInstance().newXPath().compile(XPATH_EXPRESSION);
            NodeList nodes = (NodeList)expr.evaluate(doc, XPathConstants.NODESET);
            for (int i = 0; i < nodes.getLength(); i++) {
                Node node = nodes.item(i);
                print(node.getNodeName(), node.getTextContent());
            }
        }
     
        private static void processProperties(File file) throws Exception {
            Properties properties = new Properties();
            properties.load(new FileInputStream(file));
            for (Map.Entry p : properties.entrySet()) {
                if (p.getValue().toString().startsWith(PREFIX)) {
                    print(p.getKey(), p.getValue());
                }
            }
        }
     
        private static void print(Object attributeName, Object encrypted) {
            System.out.println("Node name: " + attributeName);
            System.out.println("Encrypted: " + encrypted);
            System.out.println("Decrypted: " + new String( ces.decryptBytes(encrypted.toString().getBytes())) + "
    ");
        }
    }
    

      

  • 相关阅读:
    python之路面向对象2
    [C#]扩展方法
    [UGUI]Text文字效果
    [UGUI]修改顶点
    [UGUI]帧动画
    [UGUI]图文混排(二):Text源码分析
    [UGUI]图文混排(一):标签制定和解析
    [Unity基础]镜头管理类
    [Unity工具]批量修改Texture
    323 XAMPP软件
  • 原文地址:https://www.cnblogs.com/6324/p/9168095.html
Copyright © 2011-2022 走看看