This provides a step-by-step guide on how to control your server using the Signal messaging app.
Currently, you can send a message containing a torrent link, and the server will download the torrent. Additionally, you can check the status and perform other operations on the torrent application. In addition, you can send LaTeX files in a zip file and convert them to a PDF.
First Download the Github repository and enter it:
git clone git@github.com:fridolinvii/SignalCommander.git
cd SignalCommander
I follwed the description to install it from this GitHub repository: signal-cli and https://oren.github.io/articles/signal-terminal/. There are two option you can use signal-cli. Either you register a new phone number or you add it to your Linked devices on your phone.
You can register your number:
signal-cli -a [YOUR_NUMBER] register
You will recive a CODE per SMS and you can verify it with the command:
signal-cli -a [YOUR_NUMBER] verify [CODE]
If you want to link signal-cli instead of register a new number run the following command
signal-cli link -n "[NAME]"
This will generate a link. Create a QR-Code from this link and scan it with you mobile device. Do not generate the QR-Code online, but rather generate it on your local machine if possible.
Create a signal Group. You can check all the groups you have access to with:
signal-cli listGroups
Find your Group name, and copy the Id into
nano .env
under the variable name
TARGET_GROUP_ID='["Id"]'
If you have multiple groups: TARGET_GROUP_ID='["Id1","Id2",...]'
To install the torrent client use
sudo apt install transmission-cli transmission-daemon
Enable and start transmission-daemon
sudo systemctl enable transmission-daemon
sudo systemctl start transmission-daemon
sudo service transmission-daemon start
To check the status and error of transmission-daemon
systemctl status transmission-daemon
You need to do some additional changes. To do so stop the transmission-daemon
sudo systemctl stop transmission-daemon
Edit the file
sudo nano /etc/transmission-daemon/settings.json
find "rpc-authentication-required" and set it to false:
"rpc-authentication-required": false,
and start the transmission-daemon
sudo systemctl start transmission-daemon
Install LaTeX on the server (and any additional packages you want and need).
sudo apt install texlive-latex-base texlive-fonts-recommended -y
sudo apt install texlive-fonts-extra texlive-xetex texlive-science -y
sudo apt install texlive-lang-german texlive-latex-extra texlive-font-utils -y
sudo apt install latexmk -y
sudo apt install biber -y
If you send a message in the Group, you can run the script:
./signal_listening.sh
This will check for new Signal messages, filter the ones which were used in the Group, and are further processed. See further down for the commands.
If you want to automate the process:
crontab -e
and add a following line:
*/5 * * * * /[PATH]/signal_listening.sh >> /[PATH]/signal_listening_crontab.log 2>&1 &
Change the PATH accordingly. A logfile is created under the name signal_listening_crontab.log
. Every 5min the bash-script is executed.
It is possible to download files. These are generated by a random link. In addition, the files are compressed into a 7z file with a random password. The Signal-Bot will send you the link and the password.
Note: The link and the 7z file are only available for a limited time.
- Local Download (no additional settings needed)
- Global Download with no SSH tunnel (
PORT_LOCAL
needs to be opened on your router, not recommended) - Global Download with SSH tunnel (external server required, see installation guide here)
- Be sure that you are using the same
PORT_SSH
andPORT_GLOBAL
on your server!
- Be sure that you are using the same
Install 7z
sudo apt install p7zip-full
Enter the folder where your Signal-Bot is located. Create a virtual environment:
python -m venv venv
activate it:
source venv/bin/activate
and install the required packages
pip install flask gunicorn
In the Signal Group you created, you can send commands, which will be read and executed. You will recieve a txt file with with the report. Each message should only contain one command, or an error may arrise. If you don't recieve a message, either the command is unvalid or there is an error.
Command | Description |
---|---|
help |
Display available commands. |
Command | Description |
---|---|
magnet:?xt=... |
Download torrent using a magnet link. |
status |
Check the status of current torrents. |
delete_all |
Delete all torrents. |
delete_1-3,5 |
Delete torrents 1-3, and 5. |
Only one zip file can be converted to a PDF at a time. Attach the zip file to the message and specify which file should be converted, e.g., main.tex
.
Attachment | Text | Description |
---|---|---|
file.zip | main.tex | Convert main.tex from file.zip into a pdf |
file.zip | main.tex log | Converts main.tex to pdf and sends log file |
Command | Description |
---|---|
files_ |
Show your files and folders. |
files_delete_1 |
Delete file/folder number 1. |
files_delete_1-3,5 |
Delete file/folder number 1-3, and 5. |
files_delete_all |
Delete all files and folders. |
Through an ssh tunnel, a download link is created.
Command | Description |
---|---|
download_1 |
Download file/folder number 1. |
download_1-3,5 |
Download file/folder number 1-3, and 5. |
download_status |
Check Status of SSH and Gunicorn |
download_stop |
Stop sharing the link |