No description
Find a file
danipoak f205e86bdf
Merge pull request #78 from Cypheriel/timezone-fix
Fix time issue with cronreg
2023-12-09 13:03:32 -05:00
emulated New serial 2023-10-30 14:30:19 -04:00
ids Daemon flag addition (#41) 2023-11-01 20:59:13 -04:00
proxy Iterate over references instead of indexes for identities 2023-08-20 17:15:45 -06:00
.gitignore incorporate most of June's changes 2023-08-19 15:25:21 -04:00
albert.py incorporate most of June's changes 2023-08-19 15:25:21 -04:00
apns.py incorporate most of June's changes 2023-08-19 15:25:21 -04:00
bags.py more refactoring 2023-07-27 17:34:38 -04:00
demo.py actually fix the timezone bug 2023-12-08 09:47:34 -07:00
exceptions.py Fix ignoring gateway parameter (#34) 2023-10-23 19:28:36 -04:00
gateway_fetch.py Add gateway_fetch code 2023-09-22 15:44:25 -04:00
imessage.py refactoring and cleanup 2023-08-25 22:26:37 -04:00
LICENSE Add licensing information 2023-08-02 11:42:06 -04:00
README.md Merge pull request #63 from mtalexan/sms-registration-termux 2023-12-07 18:10:53 -05:00
requirements.txt Add trio to requirements.txt 2023-09-01 13:54:00 +01:00
sms_registration.py Fix ignoring gateway parameter (#34) 2023-10-23 19:28:36 -04:00
termux_installer.sh Termux: Add termux_installer.sh and include README instructions 2023-12-05 21:34:00 -05:00
unix_installer.sh fixed some more links in the scripts 2023-11-20 21:46:24 -05:00
windows_installer.ps1 fixed phone ip variable bug 2023-12-07 21:03:10 -05:00
windows_reregister.ps1 removed daemon execution, added new script to execute daemon 2023-11-17 19:05:43 -05:00

Overview

This is the Pypush sms-registration branch. This branch allows you to register your phone number to your Apple account as an iMessage alias.

sms-registration is not fully developed yet, and still contains bugs! If you encounter any sort of bug, please join our Discord, however please note we cannot get to everyone, so try to figure out any errors yourself before asking.

Please note: You will have to use a client to send messages from your phone. We recommend Beeper, which is the best solution to keep all your chat apps inside one place, including iMessage! You can also use BlueBubbles (which requires you to have a server Mac running 24/7). One of our community members is also currently working on a BlueBubbles fork that implements a version of Pypush within it, so no server is needed and number reregistration is automatically ran. Additionally, Beeper has a more complete proprietary paid Android app solution derived from this Pypush PoC named Beeper Mini (details) that includes both the messaging app and the registration.

However, Beeper is completely free and easy to use, and comes packed with multiple features that rivals native apps. Beeper is currently in the process of removing the waitlist, so you will have to use an invite link shared to you in order to skip the waitlist until this change is made. This app is what most testing is done on, and is by far the most popular in the Android and iMessage community.

Installation

You will first install Pypush onto your machine. Please keep in mind that you will have to have a script running on a home server or PC 24/7 to keep your number active! See below for instructions.

PNRgateway

In order for Apple to verify your number, a specialized message has to be sent from your phone to Apple's "gateway number" and have the response captured. This number is different for each carrier, however the newest app version should automatically find your gateway number. If PNRgateway cannot find your gateway number, see below for help.

  1. Install the APK. The message link containing the APK is located here, and the GitHub repository is here.
  2. Open the app.
  3. Grant SMS permissions by clicking the button and approving the permissions.
  4. Connect your phone to the same WiFi network as your host PC, and open the app (unless using Android: Termux, then it doesn't matter what network)

Pypush

Once you have the PNRgateway app installed on your phone, open it so it is displaying your IP address as you will need it for the next steps.

Use one of the automated installers for your operating system: Windows, MacOS/Linux, or Android Termux.

If you need help or run into errors please reach out on our Discord server.

Windows

  1. Open up Powershell and navigate to your downloads folder
cd Downloads
  1. Execute the installer
.\windows_installer.ps1
  1. Follow the prompts
  2. Once initial registration has completed successfully, execute the reregistration setup file
windows_reregistration.ps1

This file will re-register your number 5 minutes before registration expires.

  1. Leave the Powershell window open permanently

The length of your registration will gradually increase the longer the reregistration process runs.

MacOS/Linux
  1. Open up your temrinal and navigate to your downloads folder
cd Downloads
  1. Make the script executable
chmod +x unix_installer.sh
  1. Execute the script
./unix_installer.sh
  1. Once initial registration has completed successfully, a reregister.sh script is created.
  2. Execute the reregistration script
./reregister.sh

This will reregister your number 5 minutes before registration expires.

  1. Leave the terminal window open permanently

The length of your registration will gradually increase the longer the reregistration process runs.

Android Termux

This solution should be run on the same mobile device as the PNRGateway, and greatly simplifies the Pypush to PNRGateway connection required during initial setup.

  1. Ensure you have Termux and Termux: API apps installed from F-Droid.
    The Google Play Termux app is not updated, and is incompatible with the Termux: API app that's only available on F-Droid.
  2. Download the termux_installer.sh script above onto your phone.
  3. Open Termux
  4. Grant storage permissions to Termux
termux-setup-storage

And accept the permissions prompt for all files.

  1. Open the PNRGateway app on a split screen.
    The PNRGateway app must be open in the foreground at the same time as Termux for it to function correctly.

  2. Set the permissions on the script

chmod +x /storage/emulated/0/Download/termux_installer.sh
  1. Execute the script
/storage/emualted/0/Download/termux_installer.sh
  1. You will be walked thru the steps to register your phone number, create ~/pypush/reregistration.sh, and setup a persistent system job to run the reregistration automatically.
  2. If the registration indicates Apple has given you an expiration time of less than 15 minutes, you will need to manually run the ~/pypush/reregistration.sh script about 5 minutes before expiration. Android system jobs are not able to be run more frequently than 15 minutes.

The length of your registration will gradually increase the longer the reregistration process runs.

Pypush Manual Installation

Make sure you have git and Python installed.

  1. git clone -b sms-registration https://github.com/JJTech0130/pypush
  2. cd pypush

Number Registration on Linux/MacOS

It is strongly recommended to use a Python virtual environment to setup Pypush. This ensures changes in your system's Python installation does not break compatibility with Pypush with system updates.

  1. If you do not already have a directory where Python virtual environments are located then create a directory for your Python virtual environment. If you already have one then skip this step. Virtual environments are traditionally placed in a hidden folder in your home directory on Linux/MacOS. It can be created anywhere you wish. These instructions will assume you created it in your home directory.
$ mkdir ~/.venv
  1. Create a virtual environment using Python 3.10:
$ python -m venv ~/.venv/pypush
  1. Activate the virtual environment:
$ source ~/.venv/pypush/bin/activate
  1. Install the required packages using pip:
$ pip install -r requirements.txt
  1. Run the demo script, replacing [ip] with your phone's local IP address:
$ python demo.py --phone [ip]

Number reregistration option 1, automatic reregistration

Automatic reregistration is handled by determining when your imessage registration certificate expires and reregistering 5 minutes before expiration. Put the following in a text file and save as pypush_reregister.sh in your home directory:

#!/bin/bash
cd ~/pypush
source ~/.venv/pypush/bin/activate
while true
do
	python ./demo.py --daemon
# If it disconnects, wait 5 minutes before reconnecting to avoid spamming servers
  	sleep 300
done
  1. Make the reregistration script executable:
$ chmod +x ~/pypush_reregister.sh
  1. Execute the script
$ ./pypush_reregister.sh

Number reregistration option 2, registration using crontab

Put the following in a text file and save as pypush_reregister.sh in your home directory:

#!/bin/bash
cd ~/pypush
source ~/.venv/pypush/bin/activate
python ./demo.py --cronreg
  1. Make the reregistration script executable:
$ chmod +x ~/pypush_reregister.sh
  1. To automatically reregister every 30 minutes, execute the following:
$ crontab -e
  1. Add the following to your crontab file, replacing "user" with your username:
*/25 * * * * ~/pypush_reregister.sh > ~/pypush_log.out

Please note: This last script is the script you will be running continuously. We recommend every 30 minutes.

Good to Know

You will have to reregister your number every so often. This can last anywhere between 10 minutes to 48 hours, and usually the longer you run the script, the longer it takes to deregister. We may implement a feature to automatically detect deregistration in the future.

If you ever have any type of error, delete the config.json file and run steps 3-4 again. This is really important.

Issues

This is still in the development stage, so expect issues and bugs. Here is a list of possible errors:

Timeout waiting for response from gateway

This means it took too long for Apple to respond from the gateway number, PNRgateway is not sending the message to the correct gateway, or the response is in an incorrect encoding. This is common, please reach out for help.

Connection Closed

This means the app crashed or could not parse the response data from the gateway. This is also common, and a recent bug has caused this error to happen excessively with non-Verizon carriers.

Failed to resolve host

This error occurs when you are not connected to the same network, the all is closed, or you are not using the correct IP.

Automatic gateway detection failed

This is because PNRgateway could not detect the correct gateway corresponding to your carrier. Please report this issue if you find it. To fix this issue, when you are on step 1 of number registration, append --gateway [number] after the --ip argument, and replace number with the gateway number. (You can find your gateway number here)

Failed to load the dynamic library

This is a Unicorn error. We do not yet know exactly what causes this error, but on MacOS try to run sudo brew install unicorn. This error usually occurs in MacOS VMs.

Failed to register

Delete config.json and retry.

If you encounter any other errors, please try to find answers online for help.

Resources