dburr / linux-ibeacon

Python script that creates an iBeacon-compatible Bluetooth LE beacon using Linux and a Bluetooth LE adapter
BSD 3-Clause "New" or "Revised" License
162 stars 48 forks source link

Need pin code for iBeacon #2

Open gexqin opened 8 years ago

gexqin commented 8 years ago

Hi your script very good. I test it and I find security issues. Since no pin code so I can use LightBlue app connect to ibeacon and when I connect it the script crash until I run script again.

cinaeds commented 6 years ago

The code line

if 'SUDO_UID' in os.environ.keys():

should be changed to

if 'SUDO_UID' in os.environ.keys() or os.geteuid() == 0:

In fact you may be able to get to get rid of SUDO_UID - and test for both sudo and root with just os.geteuid() == 0 - I don't know. I don't use sudo. But I would presume sudo is just setting the euid to be root in a manner similar to su.