crack password protected excel worksheet

import React, { useState, useRef, useEffect } from 'react'; import { Shield, Unlock, Key, FileSpreadsheet, Terminal, UploadCloud, CheckCircle2, AlertC

import React, { useState, useRef, useEffect } from ‘react’;
import { Shield, Unlock, Key, FileSpreadsheet, Terminal, UploadCloud, CheckCircle2, AlertCircle, X, Download } from ‘lucide-react’;

// Dynamically load JSZip for client-side Excel manipulation
const loadJSZip = () => {
return new Promise((resolve, reject) => {
if (window.JSZip) {
resolve(window.JSZip);
return;
}
const script = document.createElement(‘script’);
script.src = ‘https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js’;
script.onload = () => resolve(window.JSZip);
script.onerror = () => reject(new Error(‘Failed to load JSZip’));
document.head.appendChild(script);
});
};

export default function App() {
const [activeTab, setActiveTab] = useState(‘unprotect’);
const [file, setFile] = useState(null);
const [isProcessing, setIsProcessing] = useState(false);
const [logs, setLogs] = useState([]);
const [downloadUrl, setDownloadUrl] = useState(null);
const [downloadName, setDownloadName] = useState(”);
const [jsZipLoaded, setJsZipLoaded] = useState(false);

// Brute force simulation state
const [bfConfig, setBfConfig] = useState({ length: 4, type: ‘numbers’ });
const bfInterval = useRef(null);

useEffect(() => {
loadJSZip()
.then(() => setJsZipLoaded(true))
.catch((err) => addLog(`[ERROR] ${err.message}`, ‘error’));
}, []);

const addLog = (msg, type = ‘info’) => {
setLogs(prev => […prev, { time: new Date().toLocaleTimeString(), msg, type }]);
};

const handleFileChange = (e) => {
const selected = e.target.files[0];
if (selected) {
if (!selected.name.endsWith(‘.xlsx’)) {
addLog(‘[WARNING] Please select a valid .xlsx file.’, ‘warn’);
return;
}
setFile(selected);
setDownloadUrl(null);
setLogs([]);
addLog(`[SYSTEM] Loaded file: ${selected.name} (${(selected.size / 1024).toFixed(2)} KB)`);
}
};

const clearFile = () => {
setFile(null);
setDownloadUrl(null);
setLogs([]);
};

// — FEATURE 1: REAL WORKSHEET UNPROTECTION —
const handleUnprotect = async () => {
if (!file) {
addLog(‘[ERROR] No file selected.’, ‘error’);
return;
}
if (!jsZipLoaded) {
addLog(‘[ERROR] Compression library not loaded yet. Please wait.’, ‘error’);
return;
}

setIsProcessing(true);
setDownloadUrl(null);
addLog(`[INFO] Starting protection removal process for ${file.name}…`);

try {
const JSZip = window.JSZip;
const zip = new JSZip();

addLog(‘[INFO] Reading archive structure…’);
const loadedZip = await zip.loadAsync(file);
let modifiedSheets = 0;
let workbookModified = false;

// Iterate through all files in the zip (Excel files are just zips)
const filePromises = [];

loadedZip.forEach((relativePath, zipEntry) => {
// Check for worksheet XML files
if (relativePath.match(/^xl/worksheets/sheetd+.xml$/)) {
filePromises.push(async () => {
let content = await zipEntry.async(“string”);
const originalLength = content.length;
// Strip self-closing or full sheetProtection tags
content = content.replace(/]*/>/g, ”);
content = content.replace(/]*>.*?/gi, ”);

if (content.length !== originalLength) {
loadedZip.file(relativePath, content);
modifiedSheets++;
addLog(`[SUCCESS] Removed protection from ${relativePath}`, ‘success’);
}
});
}

// Check for workbook XML (structure protection)
if (relativePath === ‘xl/workbook.xml’) {
filePromises.push(async () => {
let content = await zipEntry.async(“string”);
const originalLength = content.length;
content = content.replace(/]*/>/g, ”);
content = content.replace(/]*>.*?/gi, ”);

if (content.length !== originalLength) {
loadedZip.file(relativePath, content);
workbookModified = true;
addLog(`[SUCCESS] Removed structural protection from workbook.xml`, ‘success’);
}
});
}
});

// Execute all reads/modifications
await Promise.all(filePromises.map(fn => fn()));

if (modifiedSheets === 0 && !workbookModified) {
addLog(‘[INFO] No protection tags found. The sheets might already be unlocked, or it uses an Open Password.’, ‘warn’);
} else {
addLog(`[INFO] Total sheets unlocked: ${modifiedSheets}. Repackaging archive…`);
}

// Generate new file
const blob = await loadedZip.generateAsync({ type: “blob” });
const url = URL.createObjectURL(blob);
setDownloadUrl(url);
setDownloadName(`unlocked_${file.name}`);

addLog(‘[SUCCESS] File successfully repackaged and ready for download!’, ‘success’);

} catch (error) {
addLog(`[ERROR] Processing failed: ${error.message}`, ‘error’);
} finally {
setIsProcessing(false);
}
};

// — FEATURE 2: BRUTE FORCE SIMULATION —
const startBruteForceSim = () => {
if (!file) return;
setIsProcessing(true);
setLogs([]);
addLog(`[SYSTEM] Initializing Brute-Force Engine…`);
addLog(`[SYSTEM] Target: ${file.name}`);
addLog(`[INFO] Attack Vector: Dictionary + Pattern (${bfConfig.type}, Max Len: ${bfConfig.length})`);

let attempts = 0;
const maxSimAttempts = 45; // Stop simulation after this many logs
const fakePasswords = [‘1234’, ‘admin’, ‘password’, ‘test’, ‘excel123’, ‘secret’, ‘data’];

bfInterval.current = setInterval(() => {
attempts++;
const randomGuess = Math.random().toString(36).substring(2, 6);

if (attempts % 5 === 0) {
addLog(`[ATTEMPT] Trying bulk batch #${attempts * 1000}… hashes per sec: 45,210`);
} else {
// simulate individual checks just for visual effect
addLog(`[TESTING] Key derived from: ${randomGuess}… FAILED`, ‘error’);
}

if (attempts >= maxSimAttempts) {
clearInterval(bfInterval.current);
const found = fakePasswords[Math.floor(Math.random() * fakePasswords.length)];
addLog(`[SUCCESS] KEY FOUND! Password is: “${found}”`, ‘success’);
addLog(`[SYSTEM] Decryption complete. Simulation ended.`, ‘info’);
setIsProcessing(false);
}
}, 200);
};

const stopBruteForceSim = () => {
if (bfInterval.current) {
clearInterval(bfInterval.current);
addLog(`[WARNING] Brute-force attack aborted by user.`, ‘warn’);
setIsProcessing(false);
}
};

return (

{/* Header */}

Excel Rescue Pro

Advanced workbook recovery toolkit

{/* Left Column: Controls */}

{/* Module Selector */}


{/* Action Panel */}

{/* File Dropzone */}


{!file ? (


Drop .xlsx file here

or click to browse

) : (

{file.name}

{(file.size / 1024).toFixed(2)} KB

{!isProcessing && (

)}

)}

{/* Tab Specific Controls */}
{activeTab === ‘unprotect’ ? (

This tool instantly removes editing restrictions (Sheet/Workbook protection) entirely within your browser. No server upload required.

{downloadUrl && (

Download Unlocked File

)}

) : (

Open Password Recovery attempts to decrypt files that require a password just to open. (UI Simulation)



{!isProcessing ? (

) : (

)}

)}

{/* Right Column: Console/Logs */}

{/* Terminal Header */}


System Output Logs

{/* Terminal Body */}

{logs.length === 0 ? (

Awaiting system input…

) : (
logs.map((log, index) => {
let colorClass = ‘text-slate-300’;
if (log.type === ‘error’) colorClass = ‘text-red-400’;
if (log.type === ‘success’) colorClass = ‘text-green-400’;
if (log.type === ‘warn’) colorClass = ‘text-amber-400’;

return (

[{log.time}]
{log.msg}

);
})
)}
{/* Auto-scroll anchor */}

{ el?.scrollIntoView({ behavior: ‘smooth’ }); }} />

);
}

COMMENTS

WORDPRESS: 0
DISQUS: