pdf-pycrack


Namepdf-pycrack JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA fast, parallel PDF password cracker written in Python.
upload_time2025-08-10 17:41:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords pdf password cracker security parallel
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# PDF-PyCrack

[![PyPI version](https://badge.fury.io/py/pdf-pycrack.svg)](https://badge.fury.io/py/pdf-pycrack)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)

**A not yet blazing fast, parallel PDF password cracker for Python 3.12+.**

---


## Table of Contents

- [Features](#features)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Usage](#usage)
- [Benchmarking](#benchmarking)
- [Testing & Error Handling](#testing--error-handling)
- [Contributing](#contributing)
- [License](#license)


## Features

- **Multi-core Cracking:** Utilizes all CPU cores for maximum speed.
- **Efficient Memory Usage:** Handles large PDFs with minimal RAM.
- **Resilient Workers:** Worker processes handle errors gracefully; the main process continues.
- **Progress Tracking:** Real-time progress bar and statistics.
- **Customizable:** Tune password length, charset, batch size, and more.
- **Comprehensive Error Handling:** Clear error messages and robust test coverage for all edge cases.


## Installation

Install from PyPI (recommended):

```bash
uv pip install pdf-pycrack
```

For development:

```bash
git clone https://github.com/hornikmatej/pdf_pycrack.git
cd pdf_pycrack
uv sync
```


## Quick Start

```bash
uv run pdf-pycrack <path_to_pdf>
```

For all options:

```bash
uv run pdf-pycrack --help
```

## Usage

**Basic usage:**

```bash
uv run pdf-pycrack tests/test_pdfs/numbers/100.pdf
```

**Custom charset and length:**

```bash
uv run pdf-pycrack tests/test_pdfs/letters/ab.pdf --min-len 2 --max-len 2 --charset abcdef
```

### Using as a Python Library

You can also use pdf-pycrack programmatically in your Python code:

```python
from pdf_pycrack import crack_pdf_password, PasswordFound

result = crack_pdf_password(
    pdf_path="my_encrypted_file.pdf",
    min_len=4,
    max_len=6,
    charset="0123456789"
)

if isinstance(result, PasswordFound):
    print(f"Password found: {result.password}")
```


## Benchmarking

Measure and compare password cracking speed with the advanced benchmarking tool:

```bash
uv run python benchmark/benchmark.py --standard
```

**Custom runs:**

```bash
uv run python benchmark/benchmark.py --pdf tests/test_pdfs/letters/ab.pdf --min-len 1 --max-len 2 --charset abcdef
uv run python benchmark/benchmark.py --processes 4 --batch-size 1000
```

Results are saved in `benchmark/results/` as JSON and CSV. See [`benchmark/README.md`](benchmark/README.md) for full details, options, and integration tips.


## Testing & Error Handling

Run all tests:

```bash
uv run pytest
```

Tests are marked by category:

- `numbers`, `letters`, `special_chars`, `mixed`

Run a subset:

```bash
uv run pytest -m numbers
```

**Error Handling:**

The suite in `tests/test_error_handling.py` covers:
- File not found, permission denied, directory instead of file
- Corrupted/unencrypted PDFs
- Empty charset, invalid parameters
- Memory errors, worker process failures

All errors are reported with clear messages and suggested actions.


## Contributing

Contributions are welcome! Please:

1. Fork the repository
2. Create a feature branch
3. Make your changes and add/update tests
4. Run all tests and pre-commit hooks:
    ```bash
    uv run pre-commit install
    uv run pre-commit run --all-files
    uv run pytest
    ```
5. Open a pull request


## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

**Further documentation:**
- [Benchmarking Guide](benchmark/README.md)
- [Test PDF Generation](scripts/README.md)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pdf-pycrack",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": "Matej Hornik <bachini256@gmail.com>",
    "keywords": "pdf, password, cracker, security, parallel",
    "author": null,
    "author_email": "Matej Hornik <bachini256@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d0/97/e0ef5a7255ecf3abe9d152cefe2d4f56525093c38116250526fc39bc905d/pdf_pycrack-0.1.0.tar.gz",
    "platform": null,
    "description": "\n# PDF-PyCrack\n\n[![PyPI version](https://badge.fury.io/py/pdf-pycrack.svg)](https://badge.fury.io/py/pdf-pycrack)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)\n\n**A not yet blazing fast, parallel PDF password cracker for Python 3.12+.**\n\n---\n\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Usage](#usage)\n- [Benchmarking](#benchmarking)\n- [Testing & Error Handling](#testing--error-handling)\n- [Contributing](#contributing)\n- [License](#license)\n\n\n## Features\n\n- **Multi-core Cracking:** Utilizes all CPU cores for maximum speed.\n- **Efficient Memory Usage:** Handles large PDFs with minimal RAM.\n- **Resilient Workers:** Worker processes handle errors gracefully; the main process continues.\n- **Progress Tracking:** Real-time progress bar and statistics.\n- **Customizable:** Tune password length, charset, batch size, and more.\n- **Comprehensive Error Handling:** Clear error messages and robust test coverage for all edge cases.\n\n\n## Installation\n\nInstall from PyPI (recommended):\n\n```bash\nuv pip install pdf-pycrack\n```\n\nFor development:\n\n```bash\ngit clone https://github.com/hornikmatej/pdf_pycrack.git\ncd pdf_pycrack\nuv sync\n```\n\n\n## Quick Start\n\n```bash\nuv run pdf-pycrack <path_to_pdf>\n```\n\nFor all options:\n\n```bash\nuv run pdf-pycrack --help\n```\n\n## Usage\n\n**Basic usage:**\n\n```bash\nuv run pdf-pycrack tests/test_pdfs/numbers/100.pdf\n```\n\n**Custom charset and length:**\n\n```bash\nuv run pdf-pycrack tests/test_pdfs/letters/ab.pdf --min-len 2 --max-len 2 --charset abcdef\n```\n\n### Using as a Python Library\n\nYou can also use pdf-pycrack programmatically in your Python code:\n\n```python\nfrom pdf_pycrack import crack_pdf_password, PasswordFound\n\nresult = crack_pdf_password(\n    pdf_path=\"my_encrypted_file.pdf\",\n    min_len=4,\n    max_len=6,\n    charset=\"0123456789\"\n)\n\nif isinstance(result, PasswordFound):\n    print(f\"Password found: {result.password}\")\n```\n\n\n## Benchmarking\n\nMeasure and compare password cracking speed with the advanced benchmarking tool:\n\n```bash\nuv run python benchmark/benchmark.py --standard\n```\n\n**Custom runs:**\n\n```bash\nuv run python benchmark/benchmark.py --pdf tests/test_pdfs/letters/ab.pdf --min-len 1 --max-len 2 --charset abcdef\nuv run python benchmark/benchmark.py --processes 4 --batch-size 1000\n```\n\nResults are saved in `benchmark/results/` as JSON and CSV. See [`benchmark/README.md`](benchmark/README.md) for full details, options, and integration tips.\n\n\n## Testing & Error Handling\n\nRun all tests:\n\n```bash\nuv run pytest\n```\n\nTests are marked by category:\n\n- `numbers`, `letters`, `special_chars`, `mixed`\n\nRun a subset:\n\n```bash\nuv run pytest -m numbers\n```\n\n**Error Handling:**\n\nThe suite in `tests/test_error_handling.py` covers:\n- File not found, permission denied, directory instead of file\n- Corrupted/unencrypted PDFs\n- Empty charset, invalid parameters\n- Memory errors, worker process failures\n\nAll errors are reported with clear messages and suggested actions.\n\n\n## Contributing\n\nContributions are welcome! Please:\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes and add/update tests\n4. Run all tests and pre-commit hooks:\n    ```bash\n    uv run pre-commit install\n    uv run pre-commit run --all-files\n    uv run pytest\n    ```\n5. Open a pull request\n\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n**Further documentation:**\n- [Benchmarking Guide](benchmark/README.md)\n- [Test PDF Generation](scripts/README.md)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A fast, parallel PDF password cracker written in Python.",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/hornikmatej/pdf_pycrack/issues",
        "Homepage": "https://github.com/hornikmatej/pdf_pycrack"
    },
    "split_keywords": [
        "pdf",
        " password",
        " cracker",
        " security",
        " parallel"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "df6bf4992164d4599ec854e20ca252ac2dfc0537f2c3b202d84988a24ad35c71",
                "md5": "9424987d3a3c2d68e259fba9fe3f2b64",
                "sha256": "013488f1e5b32fafe76ba6ed97ba1c9b88b365b298794eb219ae8ec71ccce1fb"
            },
            "downloads": -1,
            "filename": "pdf_pycrack-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9424987d3a3c2d68e259fba9fe3f2b64",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 18063,
            "upload_time": "2025-08-10T17:41:19",
            "upload_time_iso_8601": "2025-08-10T17:41:19.399042Z",
            "url": "https://files.pythonhosted.org/packages/df/6b/f4992164d4599ec854e20ca252ac2dfc0537f2c3b202d84988a24ad35c71/pdf_pycrack-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d097e0ef5a7255ecf3abe9d152cefe2d4f56525093c38116250526fc39bc905d",
                "md5": "461fe9a0e21cb5d15a80c167f97e0b2a",
                "sha256": "7dd6dfdb42a2db1bd96c09ad5411325df5c5c7d3d02d061dd897eb7f31fc4006"
            },
            "downloads": -1,
            "filename": "pdf_pycrack-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "461fe9a0e21cb5d15a80c167f97e0b2a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 25217,
            "upload_time": "2025-08-10T17:41:20",
            "upload_time_iso_8601": "2025-08-10T17:41:20.723092Z",
            "url": "https://files.pythonhosted.org/packages/d0/97/e0ef5a7255ecf3abe9d152cefe2d4f56525093c38116250526fc39bc905d/pdf_pycrack-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-10 17:41:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hornikmatej",
    "github_project": "pdf_pycrack",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pdf-pycrack"
}
        
Elapsed time: 0.42038s