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

      

  • 相关阅读:
    docker 安装镜像
    Vagrant+Oracle VM VirtualBox创建linux虚拟机(centos7)
    idea配置git,github , gitee
    idea连接数据库
    idea基本设置
    git基础命令
    mybatis中的where
    重学 Java 设计模式:实战桥接模式(多支付渠道「微信、支付宝」与多支付模式「刷脸、指纹」场景)
    HTTPS加密原理
    优惠券数据库设计
  • 原文地址:https://www.cnblogs.com/6324/p/9168095.html
Copyright © 2020-2023  润新知