Skip to content

Commit bde3baa

Browse files
committed
project update
1 parent c71c7a6 commit bde3baa

13 files changed

Lines changed: 956 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -e .
30+
pip install pytest pytest-cov flake8 black mypy
31+
32+
- name: Lint with flake8
33+
run: |
34+
# stop the build if there are Python syntax errors or undefined names
35+
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics
36+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37+
flake8 src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38+
39+
- name: Format check with black
40+
run: |
41+
black --check src/
42+
43+
- name: Type check with mypy
44+
run: |
45+
mypy src/ --ignore-missing-imports
46+
47+
- name: Test with pytest
48+
run: |
49+
pytest tests/ -v --cov=src/gpp_decrypt --cov-report=xml --cov-report=term
50+
51+
- name: Upload coverage reports to Codecov
52+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
53+
uses: codecov/codecov-action@v3
54+
with:
55+
file: ./coverage.xml
56+
flags: unittests
57+
name: codecov-umbrella
58+
fail_ci_if_error: false

.github/workflows/publish.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.11'
18+
19+
- name: Install build dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install build twine
23+
24+
- name: Build package
25+
run: python -m build
26+
27+
- name: Check package
28+
run: twine check dist/*
29+
30+
- name: Upload artifacts
31+
uses: actions/upload-artifact@v3
32+
with:
33+
name: dist
34+
path: dist/
35+
36+
test-pypi:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: test-pypi
41+
url: https://test.pypi.org/project/gpp-decrypt/
42+
43+
steps:
44+
- uses: actions/download-artifact@v3
45+
with:
46+
name: dist
47+
path: dist/
48+
49+
- name: Publish to Test PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1
51+
with:
52+
repository-url: https://test.pypi.org/legacy/
53+
skip-existing: true
54+
verbose: true
55+
56+
pypi:
57+
needs: test-pypi
58+
runs-on: ubuntu-latest
59+
environment:
60+
name: pypi
61+
url: https://pypi.org/project/gpp-decrypt/
62+
63+
steps:
64+
- uses: actions/download-artifact@v3
65+
with:
66+
name: dist
67+
path: dist/
68+
69+
- name: Publish to PyPI
70+
uses: pypa/gh-action-pypi-publish@release/v1
71+
with:
72+
verbose: true

.github/workflows/release.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
create-release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Generate changelog
20+
id: changelog
21+
run: |
22+
# Get the previous tag
23+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
24+
25+
if [ -z "$PREV_TAG" ]; then
26+
echo "CHANGELOG=Initial release" >> $GITHUB_OUTPUT
27+
else
28+
# Generate changelog between tags
29+
CHANGELOG=$(git log --pretty=format:"- %s (%h)" $PREV_TAG..HEAD)
30+
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
31+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
32+
echo "EOF" >> $GITHUB_OUTPUT
33+
fi
34+
35+
- name: Create Release
36+
uses: actions/create-release@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
tag_name: ${{ github.ref }}
41+
release_name: Release ${{ github.ref_name }}
42+
body: |
43+
## Changes in this Release
44+
45+
${{ steps.changelog.outputs.CHANGELOG }}
46+
47+
## Installation
48+
49+
### From PyPI
50+
```bash
51+
pip install gpp-decrypt
52+
```
53+
54+
### From Source
55+
```bash
56+
git clone https://github.com/t0thkr1s/gpp-decrypt.git
57+
cd gpp-decrypt
58+
pip install .
59+
```
60+
61+
## Usage
62+
63+
```bash
64+
# Decrypt from XML file
65+
gpp-decrypt -f groups.xml
66+
67+
# Decrypt single cpassword
68+
gpp-decrypt -c <encrypted_password>
69+
```
70+
draft: false
71+
prerelease: false

.gitignore

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
### VirtualEnv template
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# VirtualEnv
210
.Python
311
[Bb]in
412
[Ii]nclude
@@ -30,11 +38,18 @@ share/python-wheels/
3038
*.egg
3139
MANIFEST
3240

41+
# PyInstaller
42+
*.manifest
43+
*.spec
44+
3345
# Installer logs
3446
pip-log.txt
3547
pip-delete-this-directory.txt
3648

3749
# Unit test / coverage reports
50+
htmlcov/
51+
.tox/
52+
.nox/
3853
.coverage
3954
.coverage.*
4055
.cache
@@ -44,10 +59,35 @@ coverage.xml
4459
*.py,cover
4560
.hypothesis/
4661
.pytest_cache/
62+
cover/
63+
64+
# Translations
65+
*.mo
66+
*.pot
67+
68+
# Sphinx documentation
69+
docs/_build/
70+
71+
# PyBuilder
72+
.pybuilder/
73+
target/
74+
75+
# Jupyter Notebook
76+
.ipynb_checkpoints
77+
78+
# IPython
79+
profile_default/
80+
ipython_config.py
4781

4882
# pyenv
4983
.python-version
5084

85+
# pipenv
86+
Pipfile.lock
87+
88+
# PEP 582
89+
__pypackages__/
90+
5191
# Environments
5292
.env
5393
env/
@@ -56,4 +96,27 @@ ENV/
5696
env.bak/
5797
venv.bak/
5898

99+
# mypy
100+
.mypy_cache/
101+
.dmypy.json
102+
dmypy.json
103+
104+
# Pyre type checker
105+
.pyre/
106+
107+
# pytype static type analyzer
108+
.pytype/
109+
110+
# IDEs
59111
.idea/
112+
*.iml
113+
*.iws
114+
*.ipr
115+
.vscode/
116+
*.code-workspace
117+
118+
# OS
119+
.DS_Store
120+
Thumbs.db
121+
ehthumbs.db
122+
Desktop.ini

CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [2.0.0] - 2024-01-XX
9+
10+
### Added
11+
- Complete project restructure for modern Python packaging
12+
- PyPI package support with proper metadata
13+
- Comprehensive test suite with pytest
14+
- GitHub Actions CI/CD pipelines for automated testing and releases
15+
- Type hints throughout the codebase
16+
- Support for both User and Group XML elements
17+
- Verbose output option
18+
- No-banner option for script automation
19+
- Better error handling and reporting
20+
- Cross-platform compatibility improvements
21+
- API access - can be imported as a library
22+
- Docker support
23+
24+
### Changed
25+
- Migrated from pycrypto to pycryptodome for better maintenance
26+
- Improved CLI with better formatting and colors
27+
- Updated minimum Python version to 3.7
28+
- Restructured code into proper package format (src layout)
29+
- Enhanced XML parsing to handle more GPP formats
30+
- Better decryption error messages
31+
32+
### Fixed
33+
- Unicode handling issues
34+
- XML parsing edge cases
35+
- Padding issues with certain cpassword values
36+
37+
### Security
38+
- Updated all dependencies to latest secure versions
39+
- Added security warnings about MS14-025
40+
41+
## [1.0.0] - Initial Release
42+
43+
### Added
44+
- Basic GPP password decryption functionality
45+
- Support for Groups.xml files
46+
- Command-line interface
47+
- Basic colored output

Dockerfile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
FROM python:3.9-buster
2-
RUN pip3 install pycrypto colorama
3-
ADD gpp-decrypt.py .
4-
ENTRYPOINT [ "python3", "gpp-decrypt.py" ]
1+
FROM python:3.11-slim
2+
3+
# Set working directory
4+
WORKDIR /app
5+
6+
# Copy project files
7+
COPY pyproject.toml README.md ./
8+
COPY src/ ./src/
9+
10+
# Install the package
11+
RUN pip install --no-cache-dir .
12+
13+
# Create a non-root user
14+
RUN useradd -m -u 1000 gppuser && chown -R gppuser:gppuser /app
15+
USER gppuser
16+
17+
# Set entrypoint
18+
ENTRYPOINT ["gpp-decrypt"]

0 commit comments

Comments
 (0)