Merge pull request #49 from danipoak/sms-registration

This commit is contained in:
JJTech 2023-11-30 16:40:45 +01:00 committed by GitHub
commit e0795e8f72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 35 deletions

View file

@ -19,9 +19,20 @@ In order for Apple to verify your number, a specialized message has to be sent f
4. Connect your phone to the same WiFi network as your host PC, and open the app. 4. Connect your phone to the same WiFi network as your host PC, and open the app.
### Pypush ### 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](https://github.com/JJTech0130/pypush/blob/bacefed8b8eb78d5d3f295be5304830665464a04/windows_installer.ps1) or [MacOS/Linux](https://github.com/JJTech0130/pypush/blob/bacefed8b8eb78d5d3f295be5304830665464a04/unix_installer.sh)
For Windows open up PowerShell and navigate to your downloads folder `cd Downloads` and then execute the installer `.\windows_installer.ps1` and follow the prompts. When initial registration has completed execute the file `windows_reregister.ps1` to handle reregistration. This file will reregister your number 5 minutes before registration expires and you must keep the PowerShell window open. Length of registration will gradually increase.
For MacOS/Linux open up your terminal and navigate to your downloads folder `cd Downloads` or similar. Make the script executable by executing `chmod +x unix_installer.sh`. Execute the script `./unix_installer.sh`. Upon completion a shell script is created called `reregister.sh`. Execute this script in your terminal `./reregister.sh`. This file will reregister your number 5 minutes before registration expires and you must keep the terminal window open. Length of registration will gradually increase.
If you need help or run into errors please reach out on our [Discord](https://discord.gg/BtSbcExKJ9) server.
### Pypush Manual Installation
Make sure you have git and Python installed. Make sure you have git and Python installed.
1. `git clone -b sms-registration https://github.com/beeper/pypush` 1. `git clone -b sms-registration https://github.com/JJTech0130/pypush`
2. `cd pypush` 2. `cd pypush`
# Number Registration on Linux/MacOS # Number Registration on Linux/MacOS
@ -37,7 +48,7 @@ mkdir ~/.venv
``` ```
2. Create a virtual environment using Python 3.10: 2. Create a virtual environment using Python 3.10:
``` ```
python3.10 -m venv ~/.venv/pypush python -m venv ~/.venv/pypush
``` ```
3. Activate the virtual environment: 3. Activate the virtual environment:
``` ```
@ -56,35 +67,29 @@ Automatic reregistration is handled by determining when your imessage registrati
and reregistering 5 minutes before expiration. Put the following in a text file and save as `pypush_reregister.sh` in your home directory: 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 #!/bin/bash
cd /path/to/pypush cd ~/pypush
source ~/.venv/pypush/bin/activate source ~/.venv/pypush/bin/activate
python ./demo.py --daemon 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: 1. Make the reregistration script executable:
``` ```
chmod +x ~/pypush_reregister.sh chmod +x ~/pypush_reregister.sh
``` ```
2. Use [Screen](https://www.gnu.org/software/screen/manual/screen.html) to easily monitor reregistration status and set to run on boot, replacing "user" with your username: 2. Execute the script
``` ```./pypush_reregister.sh```
@reboot sleep 60;screen -S pypush -d -m /home/user/pypush_reregister.sh > /dev/null 2>&1
```
3. Reboot
The basics of using screen are outlined below but this is not intended to be a tutorial in using screen. In order to see a more complete # Number reregistration option 2, registration using crontab
guid please visit the following [guide](https://linuxize.com/post/how-to-use-linux-screen/). To monitor the status of registration you can
connect to the virtual screen you created.
```
$ screen -r pypush
```
To disconnect from the virtual screen press ctrl+a d.
# Number reregistration option 2, registration every 30 minutes
Put the following in a text file and save as `pypush_reregister.sh` in your home directory: Put the following in a text file and save as `pypush_reregister.sh` in your home directory:
``` ```
#!/bin/bash #!/bin/bash
cd /path/to/pypush cd ~/pypush
source ~/.venv/pypush/bin/activate source ~/.venv/pypush/bin/activate
python ./demo.py --reregister python ./demo.py --cronreg
``` ```
1. Make the reregistration script executable: 1. Make the reregistration script executable:
``` ```
@ -95,7 +100,7 @@ chmod +x ~/pypush_reregister.sh
``` ```
3. Add the following to your crontab file, replacing "user" with your username: 3. Add the following to your crontab file, replacing "user" with your username:
``` ```
*/30 * * * * /home/user/pypush_reregister.sh */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. ***Please note:*** This last script is the script you will be running continuously. We recommend every 30 minutes.

View file

@ -15,27 +15,39 @@ if [[ "$OS_NAME" == "Darwin" ]]; then
fi fi
brew install cmake brew install cmake
brew install pkgconfig brew install pkgconfig
brew install git
elif [[ "$OS_NAME" == "Linux" ]]; then elif [[ "$OS_NAME" == "Linux" ]]; then
echo "The operating system is Linux." echo "The operating system is Linux."
echo "Installing dependencies: cmake and pkgconfig"
sudo wget -O /usr/local/bin/pacapt https://github.com/icy/pacapt/raw/ng/pacapt
sudo chmod 755 /usr/local/bin/pacapt
sudo ln -sv /usr/local/bin/pacapt /usr/local/bin/pacman || true
sudo /usr/local/bin/pacapt -S cmake pkg-config git
echo "Removing temporary files"
sudo rm /usr/local/bin/pacapt
sudo rm /usr/local/bin/pacman
else else
echo "Unknown operating system: $OS_NAME" echo "Unknown operating system: $OS_NAME"
fi fi
# Create a virtual environment # Create a virtual environment
mkdir -p ~/.venv mkdir -p ~/.venv
python3.10 -m venv ~/.venv/pypush python3 -m venv ~/.venv/pypush
source ~/.venv/pypush/bin/activate source ~/.venv/pypush/bin/activate
# Clone the repo # Clone the repo
cd ~ cd ~
git clone -b sms-registration https://github.com/beeper/pypush git clone -b sms-registration https://github.com/JJTech0130/pypush
cd pypush cd pypush
# Install dependencies
pip install -r requirements.txt
# Prompt the user for the IP address of their phone. # Prompt the user for the IP address of their phone.
read -p "Enter the IP address of your phone: " PHONEIP read -p "Enter the IP address of your phone(displayed in the Android helper app): " PHONEIP
# Execute the `python demo.py` script with the phone IP address passed as a parameter. # Execute the `python demo.py` script with the phone IP address passed as a parameter.
python demo.py --phone $PHONEIP python3 demo.py --phone $PHONEIP
# Create a reregistration script # Create a reregistration script
cat > reregister.sh <<EOF cat > reregister.sh <<EOF
@ -44,7 +56,7 @@ cd ~/pypush
source ~/.venv/pypush/bin/activate source ~/.venv/pypush/bin/activate
while true while true
do do
python ./demo.py --daemon python3 ./demo.py --daemon
# If it disconnects, wait 5 minutes before reconnecting to avoid spamming servers # If it disconnects, wait 5 minutes before reconnecting to avoid spamming servers
sleep 300 sleep 300
done done

View file

@ -47,9 +47,9 @@ Write-Output "Activating virtual environment"
cd "$env:USERPROFILE" cd "$env:USERPROFILE"
# Clone the "sms-registration" branch of the repository located at https://github.com/beeper/pypush using git. # Clone the "sms-registration" branch of the repository located at https://github.com/JJTech0130/pypush using git.
Write-Output "Cloning sms-registration branch" Write-Output "Cloning sms-registration branch"
git clone -b sms-registration https://github.com/beeper/pypush git clone -b sms-registration https://github.com/JJTech0130/pypush
# Change directories to the repository. # Change directories to the repository.
Write-Output "Changing directories" Write-Output "Changing directories"
@ -65,8 +65,3 @@ $phoneIpVariable = Set-Variable -Name phoneIp -Value $phoneIp -Scope Global
# Execute the `python demo.py` script with the phone IP address passed as a parameter. # Execute the `python demo.py` script with the phone IP address passed as a parameter.
Write-Output "Registering" Write-Output "Registering"
python demo.py --phone $phoneIpVariable python demo.py --phone $phoneIpVariable
# Execute the daemon for reregistration
Write-Output "Executing the daemon"
python demo.py --daemon

12
windows_reregister.ps1 Normal file
View file

@ -0,0 +1,12 @@
cd "$env:USERPROFILE\pypush"
# Activate the virtual environment
. "$env:USERPROFILE\AppData\Local\Python\VirtualEnvs\pypush\Scripts\activate.ps1"
# Continuously run the demo script in daemon mode
while ($true) {
python ./demo.py --daemon
# If the script disconnects, wait 5 minutes before restarting
Start-Sleep -Seconds 300
}