侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

weblogic密码忘记破解方法,破解破解。

2023-12-17 星期日 / 0 评论 / 0 点赞 / 109 阅读 / 4143 字

一个N久的服务,维护的人换了好几个了,今天突然想进去看看里面datasource,一问没人知道密码。。。于是就上网小抄了一段程序,用于破解weblogic console的用户名和密码。 首先在web

一个N久的服务,维护的人换了好几个了,今天突然想进去看看里面datasource,一问没人知道密码。。。于是就上网小抄了一段程序,用于破解weblogic console的用户名和密码。

首先在weblogic安装目录下找到两个文件SerializedSystemIni.dat、 boot.properties,位置大家可以自己搜索一下。

然后上代码:

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 pathimport 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 WebLogicDecryptor {     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("E:/weblogic10").getAbsolutePath()));        File file = new File("E:/weblogic10/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: " + ces.decrypt((String)encrypted) + "/n");    }}

以上代码来自http://www.cnblogs.com/alfredxiao/archive/2010/09/16/weblogic_lost_password2.html稍加修改。

直接运行代码(注意代码中需加入weblogic.jar包,weblogic版本不一样可能加的jar包不同)

查看打印结果:

 

其实 boot.properties里面存放的就是加密过的用户名密码,SerializedSystemIni.dat里面存放的是加解密的密匙来的。

如果能在weblogic环境下运行上面代码就最好了,如果不能则要注意SerializedSystemIni.dat的拷贝了,特别是从Linux环境下拷贝过来的时候。

上面方法试过weblogic8和10都是没有问题的。

广告 广告

评论区