Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
push:
# Use ["main", "master"] for CI only on the default branch.
# Use ["**"] for CI on all branches.
branches: ["main", "master"]
pull_request:
branches: ["main", "master"]
workflow_dispatch: # Enable manual trigger.

permissions:
contents: read

jobs:
build:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.12", "3.13"]

runs-on: ${{ matrix.os }}
timeout-minutes: 5

steps:
# Generally following uv docs:
# https://docs.astral.sh/uv/guides/integration/github/

- name: Checkout (official GitHub action)
uses: actions/checkout@v5
with:
# Important for versioning plugins:
fetch-depth: 0

- name: Install uv (official Astral action)
uses: astral-sh/setup-uv@v5
with:
# Update this as needed:
version: "0.9.5"
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Set up Python (using uv)
run: uv python install

- name: Install all dependencies
run: uv sync --all-extras

- name: Run linting
run: |
uv run ruff check .
uv run ruff format --check .

- name: Run type checking
run: uv run pyright

- name: Run tests
run: uv run pytest
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish to PyPI

on:
release:
types: [published]
workflow_dispatch: # Enable manual trigger.

jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
id-token: write # Mandatory for OIDC.
contents: read
steps:
- name: Checkout (official GitHub action)
uses: actions/checkout@v4
with:
# Important for versioning plugins:
fetch-depth: 0

- name: Install uv (official Astral action)
uses: astral-sh/setup-uv@v5
with:
version: "0.9.5"
enable-cache: true
python-version: "3.12"

- name: Set up Python (using uv)
run: uv python install

- name: Install all dependencies
run: uv sync --all-extras

- name: Run tests
run: uv run pytest

- name: Build package
run: uv build

- name: Publish to PyPI
run: uv publish --trusted-publishing always
160 changes: 160 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"[python]": {
"editor.formatOnSave": true,
},
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
keyhunter
=========
# keyhunter

A tool to recover lost bitcoin private keys from dead harddrives.
A tool to recover lost bitcoin private keys from dead hard drives.

chmod +x keyhunter.py
## Usage

./keyhunter.py /dev/sdc
```bash
python3 keyhunter.py -i /dev/sdX --log ./sdX_log.log -o ./sdX_found_keys_list.txt
```

output should list found private keys in base58 key import format.
The output file lists found private keys, in base58 key WIF (wallet import format).

bitcoind importprivkey 5K????????????? yay
To import into bitcoind, use the following command for each key:

```bash
bitcoind importprivkey 5KXXXXXXXXXXXX
bitcoind getbalance
```

DONATIONS --> 1YAyBtCwvZqNF9umZTUmfQ6vvLQRTG9qG
## Features and Limitations

* Supports both pre-2012 and post-2012 wallet keys.
* Supports logging to a file.
* Cannot find encrypted wallets.

## Credits

This project is a maintained fork of [pierce403/keyhunter](https://github.com/pierce403/keyhunter).
Loading