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())) + "
    ");
        }
    }
    

      

  • 相关阅读:
    微信公众号-框架业务
    微信公众号-加解密数据demo坑
    JS进制转换,浮点数相加,数字判断
    lamp环境-编译安装
    批量解压目录下的文件
    设置用户sudo -s拥有root权限
    CentOS 6.5-默认没开启网络连接:开启网络连接
    检查一下是否安装了环境,安装则卸载
    负载均衡-多台机子session不起效:把php.ini中file改为memcache存储
    由json生成php配置文件
  • 原文地址:https://www.cnblogs.com/6324/p/9168095.html
Copyright © 2011-2022 走看看