<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Multibit钱包私钥提取工具</title>
<script src="
https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
<style>
body { font-family: Arial, sans-serif; max-width: 600px; margin: 20px auto; padding: 20px; }
.container { background: #f5f5f5; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
input, button, textarea { width: 100%; padding: 10px; margin: 10px 0; border: 1px solid #ccc; border-radius: 4px; }
button { background: #4CAF50; color: white; cursor: pointer; }
#result { margin-top: 20px; white-space: pre-wrap; word-break: break-all; }
</style>
</head>
<body>
<div class="container">
<h2>Multibit钱包私钥提取工具</h2>
<input type="file" id="fileInput" accept=".json" placeholder="选择wallet.aes.json文件">
<input type="password" id="password" placeholder="输入解密密码">
<button onclick="decryptFile()">解密并提取私钥</button>
<textarea id="result" rows="10" readonly placeholder="解密结果将显示在这里..."></textarea>
</div>
<script>
function decryptFile() {
const fileInput = document.getElementById('fileInput');
const password = document.getElementById('password').value;
const result = document.getElementById('result');
if (!fileInput.files.length) {
result.value = "请先上传文件";
return;
}
const file = fileInput.files[0];
const reader = new FileReader();
reader.onload = function(e) {
try {
const encryptedData = e.target.result;
const wordArray = CryptoJS.enc.Base64.parse(encryptedData);
const decrypted = CryptoJS.AES.decrypt(wordArray, password);
const decryptedStr = decrypted.toString(CryptoJS.enc.Utf8);
try {
const jsonData = JSON.parse(decryptedStr);
if (jsonData.private_key) {
result.value = "提取的比特币私钥:
" + jsonData.private_key;
} else {
result.value = "未找到private_key字段,请检查文件结构
原始数据:
" + decryptedStr;
}
} catch (e) {
result.value = "解密成功但数据格式错误,请检查文件结构
内容:
" + decryptedStr;
}
} catch (e) {
result.value = "解密失败,请检查密码是否正确
错误信息:
" + e.message;
}
};
reader.onerror = function() {
result.value = "文件读取失败";
};
reader.readAsText(file);
}
</script>
</body>
</html>