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
- 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.
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.1.tar.gz
.
File metadata
- Download URL: maven_settings_decoder-0.1.1.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 | b274a0bb7a978e8401fbfc8ce3c3af529e3eefe0d98629ede7488e6d1eeb0d50 |
|
MD5 | f3b42b10ecf708d3d4666446e7c1d7dc |
|
BLAKE2b-256 | 64cdaefebfef9c2d9ea6b14adcd844f5b010520ededd79e8bb73d3c9376f808a |
File details
Details for the file maven_settings_decoder-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: maven_settings_decoder-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.5 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 | 65d9d2e35542c9b1039868495fb2f6333a1810148ea58474b6f4005cf95f9e30 |
|
MD5 | 45bd594aab28457b762bb85e06bfc67f |
|
BLAKE2b-256 | a646e0d7f3f7d68d5b39cc205ba655110737ca6a77f43198c95215c89345697f |