您的位置:首页 > 其它

破解WebLogic密码和配置文件

2011-12-10 17:55 267 查看
忘记WebLogic的管理员帐号和密码可以使用此方法简单破解出来.

配置文件config.xml里的数据库连接信息加密也可以使用此方法简单破解还原出来.

因为这是一个牛人写的一个小破解程序,能还原3DES加密的字符串:WebLogicDecryptor





代码和使用方法:

原文在:http://gustlik.wordpress.com/2008/08/06/decryption-of-configuration-passwords-in-weblogic/

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.*;

public class WebLogicDecryptor {
private static final String PREFIX = "{3DES}";
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 {
if (args.length < 2) {
throw new Exception("Usage: [domainDir] [configFile]");
}

ces = new ClearOrEncryptedService(
SerializedSystemIni.getEncryptionService(new File(args[0])
.getAbsolutePath()));
File file = new File(args[1]);
if (file.getName().endsWith(".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");
}
}


需要weblogic.jar包

原则上对WebLogic 8/9/10都可以使用

运行需要传两个参数:Usage: [domainDir] [configFile]

例如:

C:\bea\weblogic81\server\lib\WebLogicDecryptor C:\bea\user_projects\dmblog C:\bea\user_projects\dmblog\boot.properties
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: