A small tool for HDD firmware-module repair. Compares two binary dumps of the same module (or system file) sector-by-sector and produces a clean merged copy by:
- Taking the good sector from whichever copy has it when only one is DEAD
- Zero-filling any sector that is DEAD in both copies
- Flagging conflicts where both copies are readable but differ — output is produced in two versions (prefer-A and prefer-B) so the operator can compare
A "DEAD" sector is a 512-byte sector entirely filled with the repeating pattern DE AD DE AD ... — the standard fill an imager writes when a sector can't be read off the platter.
pip install -r requirements.txt
streamlit run streamlit_app.pyOpen the URL Streamlit prints (typically http://localhost:8501).
This is a single-file Streamlit app — drop it on Streamlit Community Cloud, Hugging Face Spaces, or any host that runs streamlit run streamlit_app.py.
requirements.txt only needs streamlit; everything else is in the Python standard library (zipfile, re, io).
- Enter the password at the gate.
- Upload two binary dumps. Three ways:
- Drop a ZIP containing exactly two files
- Pick two files at once in the multi-file uploader
- Upload them separately into the File A / File B slots
- When uploading as a pair or ZIP, the app auto-assigns A and B by filename pattern. The detection priority is:
copy1/copy2(lower number = A)_a/_bsuffix (case-insensitive)- Common-prefix files differing only by a trailing number
- Lowest standalone digit anywhere in the filename
- Case-insensitive alphabetical fallback Use the Swap A ↔ B button if it guessed wrong.
- Click Process Files.
- Review the summary stats, download
merged_preferA.binand/ormerged_preferB.bin, and inspect specific sectors in the hex viewer.
The hex viewer color-codes each sector by its status (match / recovered / zeroed / conflict). Conflict sectors highlight the bytes that actually differ between A and B in yellow.
- Both files must be exactly the same size in bytes
- File size must be a multiple of 512 (sector-aligned)
- ZIPs must contain exactly two files (hidden files and
__MACOSX/metadata are ignored) - All processing happens on the server hosting the Streamlit app — files are not persisted after the session ends
streamlit_app.py— the apprequirements.txt— Python depsdead-sector-merger.html— standalone browser version (no server required; opens directly in any browser; client-side processing only)test_a.bin,test_b.bin— synthetic test fixtures (8 sectors each, exercising every code path)test_pair.zip— the same fixtures bundled into a ZIP renamedmodule_copy1.bin/module_copy2.binto demo the pattern detectionexpected_preferA.bin,expected_preferB.bin— what the merged downloads should look like for the test fixtures (bytewise diff = 512 bytes, the one conflict sector)checksum-research.md— notes on which drive architectures use module checksums and where their algorithms are (or are not) documented
The app is gated by a single shared password defined at the top of streamlit_app.py as the PASSWORD constant. To change it, edit the constant. For production use you may prefer to read it from st.secrets instead.
Built for $300 Data Recovery.