From 09090b537b4d666c6cdaab15c2cd64d0bcf13b3b Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Mon, 20 May 2024 23:16:28 -0400 Subject: [PATCH 1/9] pypush: prepare for PyPI! --- README.md | 15 ++++++++++----- pyproject.toml | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1a7d237..06b8b59 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,21 @@ > [!WARNING] -> `pypush` is undergoing a major rewrite. The current version is not stable and may not work as expected. +> `pypush` is undergoing a major rewrite. The current version is not stable and may not work as expected. Many features have been temporarily removed. +> +> Versioning starts at 2.0.0 due to conflicts with the original package to have the `pypush` name. Do not expect stability until 3.0.0. # pypush -`pypush` is a POC demo of my recent iMessage reverse-engineering. -It can currently register as a new device on an Apple ID, set up encryption keys, and ***send and receive iMessages***! +`pypush` was originally a POC demo of my recent iMessage reverse-engineering. +It is now being developed into a community library aiming to cover all of Apple's internal API surface. -`pypush` is completely platform-independent, and does not require a Mac or other Apple device to use! +Currently, the rewritten version supports using the client side of Apple's internal APNs API, meaning it can activate as an +Apple device and receive push notifications. Stay tuned for future updates as we bring back the iMessage API and more! + +`pypush` is completely platform-independent, though it may require device identifiers to use some APIs. ## Installation Simple installation: ```bash -pip install git+https://github.com/JJTech0130/pypush +pip install pypush[cli] ``` Editable installation (for development): ```bash diff --git a/pyproject.toml b/pyproject.toml index 287497e..555a5d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,22 @@ build-backend = "setuptools.build_meta" [project] name = "pypush" dynamic = ["version"] +authors = [ + { name = "JJTech", email = "jjtech@jjtech.dev" }, +] +description = "Interact with Apple Private API" + +readme = "README.md" +requires-python = ">=3.9" +classifiers = [ + "Programming Language :: Python :: 3", + "Development Status :: 3 - Alpha", + "Operating System :: OS Independent", + "License :: Other/Proprietary License", +] +license = {text = "Server Side Public License (SSPL)"} +keywords = ["apple", "api", "reverse engineering", "imessage", "apns"] + dependencies = [ "anyio", "httpx", @@ -14,6 +30,10 @@ dependencies = [ 'importlib_metadata; python_version>="3.9"', ] +[project.urls] +Homepage = "https://github.com/JJTech0130/pypush" +Issues = "https://github.com/JJTech0130/pypush/issues" + [project.scripts] pypush = "pypush.cli:main" From bdb744d25a4199733598dbe5590d40a54570ede0 Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Tue, 21 May 2024 12:43:33 -0400 Subject: [PATCH 2/9] ci: refactor lints and tests --- .github/workflows/lint.yml | 44 +++++++++++++++++++++++++++++++++++ .github/workflows/pyright.yml | 18 -------------- .github/workflows/ruff.yml | 8 ------- 3 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/pyright.yml delete mode 100644 .github/workflows/ruff.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..dab06ae --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,44 @@ +name: Lint +on: [push, pull_request] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: chartboost/ruff-action@v1 + + pyright: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + cache: 'pip' + + - run: | + python -m venv .venv + source .venv/bin/activate + pip install -e '.[test,cli]' + + - run: echo "$PWD/.venv/bin" >> $GITHUB_PATH + - uses: jakebailey/pyright-action@v2 + + tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.9, 3.10, 3.11, 3.12] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + cache: 'pip' + python-version: ${{ matrix.python-version }} + + - run: | + python -m venv .venv + source .venv/bin/activate + pip install -e '.[test,cli]' + + - run: echo "$PWD/.venv/bin" >> $GITHUB_PATH + - run: pytest \ No newline at end of file diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml deleted file mode 100644 index bfad777..0000000 --- a/.github/workflows/pyright.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Pyright -on: [push, pull_request] -jobs: - pyright: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - cache: 'pip' - - - run: | - python -m venv .venv - source .venv/bin/activate - pip install -e '.[test,cli]' - - - run: echo "$PWD/.venv/bin" >> $GITHUB_PATH - - uses: jakebailey/pyright-action@v2 diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml deleted file mode 100644 index b268138..0000000 --- a/.github/workflows/ruff.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: Ruff -on: [push, pull_request] -jobs: - ruff: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: chartboost/ruff-action@v1 From 3addca4f1f4687a9dfa9cccd2514012cc4eb0c11 Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Tue, 21 May 2024 13:11:17 -0400 Subject: [PATCH 3/9] ci: steal lints from pymobiledevice3 --- .github/workflows/lint.yml | 59 ++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index dab06ae..ce2ea0f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,44 +1,41 @@ -name: Lint -on: [push, pull_request] -jobs: - ruff: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: chartboost/ruff-action@v1 +name: Lints - pyright: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - cache: 'pip' +on: + pull_request: + branches: [ "master" ] + paths: + - '.github/workflows/python-app.yml' + - 'pypush/**' + - 'tests/**' + - 'pyproject.toml' - - run: | - python -m venv .venv - source .venv/bin/activate - pip install -e '.[test,cli]' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true - - run: echo "$PWD/.venv/bin" >> $GITHUB_PATH - - uses: jakebailey/pyright-action@v2 +jobs: + build: + if: '! github.event.pull_request.draft' + runs-on: ${{ matrix.os }} - tests: - runs-on: ubuntu-latest strategy: matrix: - python-version: [3.9, 3.10, 3.11, 3.12] + python-version: [ 3.9, "3.10", "3.11", "3.12" ] + os: [ ubuntu-latest, macos-latest, windows-latest ] + steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 with: - cache: 'pip' python-version: ${{ matrix.python-version }} - - - run: | + - uses: chartboost/ruff-action@v1 + - name: Test install + run: | + python -m pip install --upgrade pip python -m venv .venv source .venv/bin/activate - pip install -e '.[test,cli]' - + pip install -e '.[test,cli]' -U - run: echo "$PWD/.venv/bin" >> $GITHUB_PATH - - run: pytest \ No newline at end of file + - name: Tests + run: pytest \ No newline at end of file From 76b2eb4b4e06a9c1701480d1afcc00596ad67842 Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Tue, 21 May 2024 13:12:13 -0400 Subject: [PATCH 4/9] ci: fix path error so it actually activates --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ce2ea0f..0df1b70 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,7 +4,7 @@ on: pull_request: branches: [ "master" ] paths: - - '.github/workflows/python-app.yml' + - '.github/workflows/lint.yml' - 'pypush/**' - 'tests/**' - 'pyproject.toml' From 67c8377d3037367135e607ebe382ec8918a3ae89 Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Tue, 21 May 2024 13:12:57 -0400 Subject: [PATCH 5/9] ci: fix branch name so it activates... --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0df1b70..073b50a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,7 +2,7 @@ name: Lints on: pull_request: - branches: [ "master" ] + branches: [ "main" ] paths: - '.github/workflows/lint.yml' - 'pypush/**' From 60dc902560e636fbca3560f3ba7f47529ec0aff0 Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Tue, 21 May 2024 13:14:04 -0400 Subject: [PATCH 6/9] apns: fix httpx dependency --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 555a5d2..be431c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ keywords = ["apple", "api", "reverse engineering", "imessage", "apns"] dependencies = [ "anyio", - "httpx", + "httpx[http2]", "cryptography", "typing-extensions", "exceptiongroup", From 56be1368b1884f207c3d7dc88a2ce8b614943c36 Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Tue, 21 May 2024 13:24:43 -0400 Subject: [PATCH 7/9] ci: upgrade setup-python --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 073b50a..a11300c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - uses: chartboost/ruff-action@v1 From eaf5ae1e4b31ce0e9fcf4dfb631ac33451be7bd7 Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Tue, 21 May 2024 13:31:26 -0400 Subject: [PATCH 8/9] ci: don't use a venv --- .github/workflows/lint.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a11300c..18c4433 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,9 +33,6 @@ jobs: - name: Test install run: | python -m pip install --upgrade pip - python -m venv .venv - source .venv/bin/activate - pip install -e '.[test,cli]' -U - - run: echo "$PWD/.venv/bin" >> $GITHUB_PATH + python -m pip install -e '.[test,cli]' -U - name: Tests run: pytest \ No newline at end of file From c1814e0ba2a8364c67e1c9b75b747a135078c67c Mon Sep 17 00:00:00 2001 From: JJTech Date: Wed, 22 May 2024 08:28:57 -0400 Subject: [PATCH 9/9] ci: create upload.yml --- .github/workflows/upload.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/upload.yml diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml new file mode 100644 index 0000000..74c4099 --- /dev/null +++ b/.github/workflows/upload.yml @@ -0,0 +1,26 @@ +name: Upload + +on: + release: + types: [ created ] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -U build setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python -m build + twine upload dist/*