Decode mavens settings.xml file
Project description
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.xml
and~/.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 using the default key "settings.security"
- 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)
--no-color Disable colored 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
# Disable colored output
maven-decoder --no-color
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
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/svaningelgem/maven_settings_decoder.git
cd maven_settings_decoder
# Create and activate virtual environment (optional)
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
.\venv\Scripts\activate # Windows
# Install development dependencies
pip install -e ".[dev]"
Running Tests
pytest
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 Maven Settings Builder
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 decrypted passwords or master passwords to version control systems.
Support
If you encounter any issues or have questions, please:
Changelog
See CHANGELOG.md for all changes between versions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file maven_settings_decoder-0.1.0.tar.gz
.
File metadata
- Download URL: maven_settings_decoder-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.12 Linux/6.1.0-25-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bef843a9d0f99624683640809bad8fa39ca3ec611f94642630aecf50f1b69f31 |
|
MD5 | f0103049c4fab020832970fd1c37f74e |
|
BLAKE2b-256 | 7e2b1ab4b656ad86d0ca87b88638396e9d2dcd6304ae5daa3130ab9baebdcc6f |
File details
Details for the file maven_settings_decoder-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: maven_settings_decoder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.12 Linux/6.1.0-25-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9b1d90687f398d98746e407f1c139c8b5e2a8a721d11647f9b30c5025b7467e |
|
MD5 | 7f1fae9fc8548773cff4cc537aac6773 |
|
BLAKE2b-256 | 5a93e3eb61d35d1d786bfa987cd1ab3ecc6ba9c4625689cd5839ed8365f9ee3e |