Skip to main content

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

  1. Using default paths (~/.m2/settings.xml and ~/.m2/settings-security.xml):
maven-decoder
  1. Specifying custom file paths:
maven-decoder --settings /path/to/settings.xml --security /path/to/settings-security.xml
  1. Enable verbose output:
maven-decoder -v
  1. 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:

  1. Reads the master password from settings-security.xml
  2. Decrypts the master password using the default key "settings.security"
  3. Uses the decrypted master password to decrypt server passwords in settings.xml
  4. 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

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

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:

  1. Check the FAQ
  2. Search existing issues
  3. Create a new issue if needed

Changelog

See CHANGELOG.md for all changes between versions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maven_settings_decoder-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

maven_settings_decoder-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

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

Hashes for maven_settings_decoder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bef843a9d0f99624683640809bad8fa39ca3ec611f94642630aecf50f1b69f31
MD5 f0103049c4fab020832970fd1c37f74e
BLAKE2b-256 7e2b1ab4b656ad86d0ca87b88638396e9d2dcd6304ae5daa3130ab9baebdcc6f

See more details on using hashes here.

File details

Details for the file maven_settings_decoder-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for maven_settings_decoder-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9b1d90687f398d98746e407f1c139c8b5e2a8a721d11647f9b30c5025b7467e
MD5 7f1fae9fc8548773cff4cc537aac6773
BLAKE2b-256 5a93e3eb61d35d1d786bfa987cd1ab3ecc6ba9c4625689cd5839ed8365f9ee3e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page