Maven Settings Decoder
A Python tool to decrypt passwords in Maven settings files (settings.xml and settings-security.xml). This tool can help you retrieve encrypted credentials from Maven configuration files, which is particularly useful for debugging or auditing purposes.
Features
- Decrypts master password from
settings-security.xml - Decrypts server passwords from
settings.xml - Support for both default and custom file paths
- Color-coded console output
- Verbose debugging mode
- Clear error messages and handling
Installation
From PyPI (Recommended)
pip install maven_settings_decoder
From Source
git clone https://github.com/svaningelgem/maven_settings_decoder.git
cd maven_settings_decoder
pip install -e .
Usage
Command Line Interface
- Using default paths (
~/.m2/settings.xmland~/.m2/settings-security.xml):
maven-decoder
- Specifying custom file paths:
maven-decoder --settings /path/to/settings.xml --security /path/to/settings-security.xml
- Enable verbose output:
maven-decoder -v
- Disable colored output:
maven-decoder --no-color
Python API
from maven_settings_decoder import MavenPasswordDecoder
# Initialize with default paths
decoder = MavenPasswordDecoder()
# Or specify custom paths
decoder = MavenPasswordDecoder(
settings_path="/path/to/settings.xml",
security_path="/path/to/settings-security.xml"
)
# Get master password
master_password = decoder.get_master_password()
print(f"Master password: {master_password}")
# Get all server credentials
servers = decoder.read_credentials()
for server in servers:
print(f"Server: {server.id}")
print(f"Username: {server.username}")
print(f"Password: {server.decrypted_password}")
Requirements
- Python 3.9+
- cryptography
- loguru
How It Works
The tool implements Maven's password encryption scheme:
- Reads the master password from
settings-security.xml - Decrypts the master password
- Uses the decrypted master password to decrypt server passwords in
settings.xml - Handles various encryption formats and edge cases
Command Line Options
usage: maven-decoder [-h] [-s SETTINGS] [--security SECURITY] [-v] [--no-color]
Decrypt passwords in Maven settings files
optional arguments:
-h, --help show this help message and exit
-s SETTINGS, --settings SETTINGS
Path to settings.xml file (default: ~/.m2/settings.xml)
--security SECURITY Path to settings-security.xml file (default: ~/.m2/settings-security.xml)
-v, --verbose Enable verbose debug output (default: False)
Exit Codes
- 0: Success
- 1: Error (file not found, decoding error, etc.)
- 130: User interrupted (Ctrl+C)
Installation and Usage
Installation
# Install from PyPI
pip install maven_settings_decoder
# Or using Poetry
poetry add maven_settings_decoder
Command Line Usage
After installation, the maven-decoder command will be available in your environment:
# Show help
maven-decoder --help
# Decode with default paths
maven-decoder
# Decode with custom paths
maven-decoder --settings /path/to/settings.xml --security /path/to/settings-security.xml
# Enable verbose output
maven-decoder -v
Development Installation
For development:
# Clone the repository
git clone https://github.com/svaningelgem/maven_settings_decoder
cd maven_settings_decoder
# Install with Poetry in development mode
poetry install
# Run the script
poetry run maven-decoder --help
# Or activate the virtual environment and run directly
poetry shell
maven-decoder --help
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Based on the encryption scheme used in Apache Maven
- Inspired by the Java implementation in plexus-cipher
- Implementation details derived from PBECipher
Security
This tool is meant for legitimate use cases such as debugging and auditing. Please ensure you have the necessary permissions before attempting to decrypt passwords in Maven settings files.
Note: Never commit your encrypted/decrypted/master passwords to version control systems.
Support
If you encounter any issues or have questions, please:
- Search existing issues
- Create a new issue if needed
Changelog
See releases for all changes between versions.
Metadata
Release files for maven_settings_decoder 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maven_settings_decoder-0.1.1.tar.gz | 7.7 kB | Without provenance | Details for maven_settings_decoder-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maven_settings_decoder-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for maven_settings_decoder-0.1.1-py3-none-any.whl |
Total release size: 16.1 kB
Release files / maven_settings_decoder-0.1.1.tar.gz
| Download URL | maven_settings_decoder-0.1.1.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b274a0bb7a978e8401fbfc8ce3c3af529e3eefe0d98629ede7488e6d1eeb0d50
|
|
BLAKE2b-256 checksum How to use checksums |
64cdaefebfef9c2d9ea6b14adcd844f5b010520ededd79e8bb73d3c9376f808a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.9.12 Linux/6.1.0-25-amd64
|
Release files / maven_settings_decoder-0.1.1-py3-none-any.whl
| Download URL | maven_settings_decoder-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65d9d2e35542c9b1039868495fb2f6333a1810148ea58474b6f4005cf95f9e30
|
|
BLAKE2b-256 checksum How to use checksums |
a646e0d7f3f7d68d5b39cc205ba655110737ca6a77f43198c95215c89345697f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.9.12 Linux/6.1.0-25-amd64
|
Security for maven_settings_decoder 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.