Hacking and opening Garagedoors using a Raspberry Pi


Software part:

Setting up Raspberry Pi:

 

Download and install the latest Raspbian Release for your Pi.
The latest release has Bluetooth already installed.
https://www.raspberrypi.org/software/operating-systems/#raspberry-pi-os-32-bit
For this guide I downloaded Raspberry Pi OS with desktop and recommended software,
filename: 2021-05-07-raspios-buster-armhf-full.zip

Unzip the downloaded file and use Win32DiskImager to transfer the image to a SD Card.

Put SD Card in your Pi and start your PI.

Pi will start up with a desktop, asking you to set your local preferences, and give you the option to add a wireless network, and will start downloading updates, which will take some time.

After the update is finished, start a shell on the pi, and start the raspi-config with:

sudo raspi-config

Go into the Interface Options and enable SSH, so you can access your Pi with your PC and Putty.
If you want to use a CC1101 Module, then also enable the SPI Interface.

Now you can use a SSH Client like Putty on your PC, and perform further settings using your PC.
Connect to your Pi using SSH, and login with:

user: pi
password: raspberry


Now install RPITX as follows:

mkdir rpitx
cd rpitx
mkdir src
cd src

git clone https://github.com/F5OEO/librpitx
cd librpitx/src
make

cd ~

Now install some needed blootooth libraries:

sudo apt-get install libbluetooth-dev

Now we need the rtl-sdr libraries:

sudo apt-get install librtlsdr-dev rtl-sdr build-essential autoconf cmake pkg-config

We have to fix an issue with blootooth startup, so lets edit the bluetooth.service file:

sudo nano /lib/systemd/system/bluetooth.service

go to the line: ExecStart=/usr/lib/bluetooth/bluetoothd
and append -C at the end:

ExecStart=/usr/lib/bluetooth/bluetoothd -C

Save and exit with:

Ctrl+o -> Enter -> Ctrl+x

The changes will take effect after a reboot or by using these commands:

systemctl daemon-reload
sudo /etc/init.d/bluetooth restart

Install Soapy:

git clone https://github.com/pothosware/SoapySDR.git
cd SoapySDR && mkdir build && cd build && cmake ..
make -j4
sudo make install
sudo ldconfig #needed on debian systems

cd ~

If you have a HackRF One, install the HackRF library:

sudo apt-get install hackrf libhackrf-dev
git clone https://github.com/pothosware/SoapyHackRF.git
cd SoapyHackRF
mkdir build
cd build
cmake ..
make
sudo make install

cd ~

Now download and install my module from my server:

mkdir rf
cd rf
wget http://www.ifoedit.com/rfcomm-server.tar
tar xvf rfcomm-server.tar

Now you can start it with:
sudo ./rfcomm-server

If you have a RTL-SDR Stick or HackRF One connected, you can also specifiy a listening frequency like this for 433.92 Mhz:

sudo ./rfcomm-server -f 433920000

If the module is starting without major errors, the first step is done.
Quit the program with CTRL-C, because we need to pair the Pi with the Android Phone.

 

Pairing the Raspberry Pi with the Phone:

On the Pi, start the bluetooth helper tool bluetoothctl:
sudo bluetoothctl
agent on
default-agent
scan on

Now start the Android App, and choose from the Main Menu: Pair BT:
Click the Button: Enable Discoverable,

and wait until your Pi shell is showing your phone as new device.



Once it shows your phone device, you can see the MAC address in the same line. Copy the MAC address of your phone, and use it in following lines and replace the xx:xx:xx:xx:xx:xx with your phones MAC address:

pair xx:xx:xx:xx:xx:xx
trust xx:xx:xx:xx:xx:xx
exit

On your phone you will have to accept the pairing request.

It may happen that the pairing was successfull, but the Pi still doesn't show up on the Anroid Phone in the paired devices list.
In such cases keep repeating the pairing process, until your Pi is visible in your Phone.



Now you can connect to my module using your phone, so lets start up the module again:

sudo ./rfcomm-server

In the Android App, go to Grab Signal, and hit the connect button.
Then choose the Pi you just paired, and it should connect without problem.
If your Pi does not appear in the list of paired devices, repeat the pairing process as above.



To automatically start my module on powering up the Pi, lets edit the autostart by doing this:

sudo nano /etc/rc.local

You will see this:


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi

exit 0






add your script to start, before the exit line like this:




#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi


sudo /home/pi/rf/rfcomm-server >> /home/pi/rf/autosniffrf.txt

exit 0



Save and exit with:

Ctrl+o -> Enter -> Ctrl+x
 

If you want to start my module manually using a SSH Shell, you'll need first to quit the auto started module, by using the Android App, connecting to the Pi, and then choose the menu entry: Pi->Exit Server:



Please give me a feedback if you like this page. Thank you.

For suggestions or comments send an email to Derrow@yahoo.com


Copyright 1997-2017 Decision Developments.
All rights reserved. Unauthorized usage of shown material is prohibited.

Free Web Hosting