- Python 96.9%
- Nix 3.1%
| .envrc | ||
| blue.py | ||
| example-config.toml | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| Pipfile | ||
| Pipfile.lock | ||
| README.org | ||
| requirements.txt | ||
Readme
Rpi Bluetooth
rpi bluetooth allows you to pair your phone to your raspberry pi (or linux computer) to provide a PAN network. 1 I will have to find some way allowing it to run as non root user.
credits for the OG code goes to evilsocket, all i did here was lift the code and strip out pwnagotchi, it worked perfectly in the past so i copied it. 2
Setup and installation
git clone https://github.com/lost-rob0t/pi-ble-network.git
cd pi-ble-network
pipenv run blue.py -c config.toml
you can also install the requirements with pip if you dont use pipenv (you should use it)
pip install -r requirements.txt
Config
The configuration is just like pwnagotchi since. Here is an example config.
devices.android-phone.enabled = true # the name of this entry is android-phone
devices.android-phone.search_order = 1 # in which order the devices should
## be searched. E.g. this is #1
devices.android-phone.mac = "mac" # you need to put your phones
## bt-mac here (settings > status)
devices.android-phone.ip = "192.168.44.2" # this is the static ip of your pwnagotchi
## adjust this to your phones pan-network
## (run "ifconfig bt-pan" on your phone)
devices.android-phone.netmask = 24 # netmask of the PAN
devices.android-phone.interval = 1 # in minutes, how often should
## the device be searched
devices.android-phone.scantime = 10 # in seconds, how long should be searched
## on each interval
devices.android-phone.max_tries = 0 # how many times it should try to find the
## phone (0 = endless)
devices.android-phone.share_internet = true # set to true if you want to have
## internet via bluetooth
devices.android-phone.priority = 1 # the device with the highest
## priority wins (1 = highest)
you can also add other phones by just adding another devices.<name> here
Running
Now i will need to find a better solution but for now just run it as root. 3
sudo blue.py --config example-config.toml
crontab
A easy way to have this run at boot is to use crontab you can also use systemd but crontab is easy
sudo crontab -e # we are editing root's crontab
Then inside the crontab put this line
@reboot /usr/bin/python <path to script> --config <path to config>
And when you reboot it will start the script
Troubleshooting
if for whatever reason it does not connect you can use bluetoothctl to pair and trust your device mac
bluetoothctl
discoverable on
scan on
pair <mac of your phone>
# enter yes for the pair prompts
trust <mac>
disconnect <mac>
it is important that you disconnect. if your phone prompts you to allow internet sharing, hit yes.
Footnotes
Please open a issue if i dont fix this