Metadata-Version: 2.4
Name: fz-decrypt
Version: 0.1.1
Summary: A library to decrypt FileZilla-Client passwords protected by a master password.
Author: David Block
License: MIT
Project-URL: Homepage, https://github.com/deinusername/fz-decrypt-lib
Project-URL: Bug Tracker, https://github.com/deinusername/fz-decrypt-lib/issues
Keywords: filezilla,decrypt,password,security,recovery
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: cryptography>=3.0

# FileZilla Decryptor Lib (`fz-decrypt`)

A lightweight, robust Python library for decrypting **FileZilla Server** passwords protected by a master password (`sitemanager.xml`).

This library implements FileZilla's cryptography logic (**PBKDF2**, **X25519 Key Exchange**, **AES-GCM**) in pure Python.

---

## 📋 Prerequisites

* **Python 3.7** or higher
* `cryptography` library

---

## 🚀 Installation

### Via PyPI (Recommended)

You can easily install the library from the Python Package Index (PyPI):

```bash
pip install fz-decrypt
```
*(Note: Replace `fz-decrypt` with your actual package name if different)*

### From Source (Development)

If you want to modify the code or install a local version:

1.  Clone the repository or download the source.
2.  Navigate to the directory containing `pyproject.toml`.
3.  Run:

    ```bash
    pip install .
    ```

For development (changes are reflected immediately):

```bash
pip install -e .
```

---

## 💻 Usage

The library provides a main class `FileZillaDecryptor`. It requires no instantiation; the `decrypt` method is a static/class method.

### Simple Example

```python
from fz_decrypt import FileZillaDecryptor, DecryptionError, InvalidDataError

# 1. Data from FileZilla sitemanager.xml
# These strings can be found in the <PubKey> and <Pass> tags
xml_pubkey = "..."       # Base64 String from <PubKey>
xml_pass_blob = "..."    # Base64 String from <Pass>

# 2. The user's master password
master_password = "MySecretMasterPassword"

try:
    # Attempt decryption
    cleartext_password = FileZillaDecryptor.decrypt(
        master_password,
        xml_pubkey,
        xml_pass_blob
    )
    print(f"The decrypted password is: {cleartext_password}")

except DecryptionError:
    print("Error: The master password is incorrect or the data is corrupt.")

except InvalidDataError as e:
    print(f"Error: Invalid data format (Base64 error, etc.): {e}")

except Exception as e:
    print(f"An unexpected error occurred: {e}")
```

---

## 📖 API Reference

### `FileZillaDecryptor.decrypt(master_password, xml_pubkey, xml_pass)`

Decrypts a password using the FileZilla algorithm.

#### Parameters:
* **`master_password`** (*str*): The master password entered when starting FileZilla.
* **`xml_pubkey`** (*str*): The content of the `<PubKey>` tag from the XML file (Base64 encoded).
* **`xml_pass`** (*str*): The content of the `<Pass>` tag from the XML file (Base64 encoded).

#### Returns:
* **`str`**: The decrypted password in cleartext.

#### Exceptions:
* **`DecryptionError`**: Raised if the master password is incorrect (AES-GCM Tag Mismatch).
* **`InvalidDataError`**: Raised if the Base64 strings are invalid or the blobs have an incorrect length.

---

## 🔒 Security Note

This tool is intended for recovering your **own** passwords. Please handle decrypted credentials responsibly. Never store passwords unencrypted in text files if it can be avoided.

---

## 📄 License

This project is licensed under the **MIT License**.
