破解WebLogic密码和配置文件

 

忘记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

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值