From b97e849e5c13200fc57dc5bee8e9f1312b978cd8 Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Tue, 21 Mar 2023 14:20:14 +0000 Subject: [PATCH] Prepare project for public release --- .github/workflows/release.yml | 11 +++-------- .github/workflows/test.yml | 7 +++---- Dockerfile | 7 +++---- README.md | 28 +++++++++++++++++++--------- montlhery.py => villefort.py | 4 ++-- 5 files changed, 30 insertions(+), 27 deletions(-) rename montlhery.py => villefort.py (93%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7305366..9d3ecd4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,19 +8,14 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/github-script@v4 - with: - script: core.setOutput('version', context.ref.replace(/refs\/tags\/v?/, '')) - id: version - - uses: docker/login-action@v1 + - uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ github.token }} - - uses: docker/build-push-action@v2 + - uses: docker/build-push-action@v4 with: push: true tags: | - ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }} + ghcr.io/${{ github.repository }}:${{ github.ref_name }} ghcr.io/${{ github.repository }}:latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff62f8d..22a1ca2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,8 +3,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: docker/build-push-action@v2 + - uses: docker/build-push-action@v4 id: image - run: >- docker run ${{ steps.image.outputs.digest }} @@ -14,13 +13,13 @@ jobs: --date=1970-12-31T23:59:59 --reference=255 --status=INBOUND_NOT_READ | - diff - <(printf "$RESULT") + diff - <(printenv RESULT) env: MESSAGE: | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. - RESULT: | + RESULT: |- 0307910121436587F9400B919178563412F0000007211332959500A0050003FF0201986F79B90D4AC3E7F53688FC66BFE5A0799A0E0AB7CB741668FC76CFCB637A995E9783C2E4343C3D1FA7DD6750999DA6B314F33219447E83CAE9FABCFD2683E8E536FC2D07A5DDE334394DAEBBE9A03A1DC40E8BDFF232A84C0791DFECB7BC0C6A87CFEE3028CC4EC7EB6197A24A0795DDE936284C06B5D3EE741B642FBBD3E1360B14AFA7E7 0307910121436587F9400B919178563412F000000721133295950056050003FF020240EEF79C2EAF9341657C593E4ED3C3F4F4DB0DAAB3D9E1F6F8AD6087C56F797A0E72A7E769509D0E0AB3D3F17A1A0E2AE341E53068FC6EB7DFE43768FC76CFCBF17A98EE5200 diff --git a/Dockerfile b/Dockerfile index e98aae4..0e59b74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ FROM python:2.7-alpine -WORKDIR /opt/montlhery -COPY requirements.txt . -COPY montlhery.py montlhery +WORKDIR /opt/villefort +COPY requirements.txt villefort.py . RUN pip install --requirement requirements.txt -ENTRYPOINT ["python", "montlhery"] +ENTRYPOINT ["python", "villefort.py"] diff --git a/README.md b/README.md index 00301a3..9d94f44 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# Montlhéry +# Villefort -Tool to generate concatenated SIM card SMS records in the EFSMS format. Named after the telegraph of Montlhéry from [Le Comte de Monte-Cristo](https://fr.wikisource.org/wiki/Le_Comte_de_Monte-Cristo/Chapitre_61). +Generate concatenated SIM card SMS records in the EFSMS format. -## Example +## Generate -Message `HELLO` with `INBOUND_NOT_READ` status, sent from `+1 987 654 3210` to `+1 012 345 6789` with reference `255` and date/time 1970-12-31 23:59:59. +_Message `HELLO` with `INBOUND_NOT_READ` status, sent from `+1 987 654 3210` to `+1 012 345 6789` with reference `255` and date/time 1970-12-31 23:59:59._ ```console -$ montlhery \ +$ docker run --rm ghcr.io/montlhery/villefort \ > --message=HELLO \ > --recipient=10123456789 \ > --sender=19876543210 \ @@ -17,12 +17,22 @@ $ montlhery \ 0307910121436587F9400B919178563412F00000072113329595000C050003FF0101904526F309 ``` -## Installation +## Write -This project only supports Python 2 [(obsolete)](https://www.python.org/doc/sunset-python-2) because of the [`smspdu`](https://pypi.org/project/smspdu) package. Use the provided container images to avoid [XKCD 1987](https://xkcd.com/1987). +Use [osmocom/pysim](https://github.com/osmocom/pysim) to write SMS records to a physical SIM card. ```console -$ docker run --rm ghcr.io/0x2b3bfa0/montlhery --help +$ pySim-shell.py --pcsc-device=0 +Using PC/SC reader interface +... +Welcome to pySim-shell! +% pySIM-shell (MF)> verify_chv 1234 # SIM primary PIN +CHV verification successful +% pySIM-shell (MF)> select DF.TELECOM +... +% pySIM-shell (MF/DF.TELECOM)> select EF.SMS +... +% pySIM-shell (MF/DF.TELECOM/EF.SMS)> update_record 001 0307910121436587F9400B919178563412F00000072113329595000C050003FF0101904526F309 ``` ## References @@ -31,4 +41,4 @@ $ docker run --rm ghcr.io/0x2b3bfa0/montlhery --help * [3GPP TS 24.011 V17.0.0 (2020-12) 8.2.5.2](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1017) * [3GPP TS 23.040 V17.1.0 (2021-06) 9.2.2.1](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=747) * [3GPP TS 23.040 V17.1.0 (2021-06) 9.2.3.24.1](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=747) -* [UNDERSTANDING SMS: Practitioner's Basics](https://mobileforensics.files.wordpress.com/2007/06/understanding_sms.pdf) +* [UNDERSTANDING SMS: Practitioner's Basics](https://web.archive.org/web/20130717141618/https://mobileforensics.files.wordpress.com/2007/06/understanding_sms.pdf) diff --git a/montlhery.py b/villefort.py similarity index 93% rename from montlhery.py rename to villefort.py index fb0bca0..b3e8669 100644 --- a/montlhery.py +++ b/villefort.py @@ -19,7 +19,7 @@ @click.option('--reference', type=int, default=0) @click.option('--limit', type=int, default=153) @click.option('--status', type=click.Choice(STATUSES.keys())) -def montlhery(sender, recipient, message, date, reference, limit, status): +def main(sender, recipient, message, date, reference, limit, status): """ Create SMS records in the EF.SMS SIM card format. """ @@ -43,5 +43,5 @@ def montlhery(sender, recipient, message, date, reference, limit, status): if __name__ == '__main__': - montlhery() + main()