Skip to content

mikemoraned/blescan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blescan (Bluetooth Low Energy Scanner)

I was playing about with a different project that uses BLE. I noticed that I was seeing some devices being discovered that I wasn't explictly searching for. So, I was curious what you could passively find out about the devices around you.

Hence, this small project.

a screenshot

There are other projects that look nicer, but I was interested in what I could put together myself with the API's that are available, in the style of a Terminal UI.

How to use

I've only used it on a Mac, so it may not work as follows on other platforms. The underlying libraries it uses should work on other platforms, so it should compile and run. However, I have not tested those other platforms.

It's fairly simple to use:

cargo run

(The first time you run this on a Mac in a Terminal it will ask for permissions to use Bluetooth)

This will then bring up a simple text UI which shows the named devices that have been discovered. It also shows 'anonymous' devices, where the name is derived from a hash of the "manufacturer data" that is in the BLE advertisement.

Each device is shown with:

  • how long ago it was last seen

  • the RSSI (Received Signal Strength Indicator)

  • a change indicator:

    • '↑' = stronger
    • '=' = same strength
    • '⌄' = weaker
    • '*' = newly-discovered (so nothing to compare to)

Scans update every second, and are always sorted by age (newest-first) then by RSSI strength (strongest-first). Anonymous devices are colored arbitrarily, but consistently, to help identify them as they move in the list.

Options

To see all options, do:

cargo run -- -h

Output options

To record all discovery events to a file, do:

cargo run -- --record prefix.suffix

This will save all discovery events (what signatures are seen, when, and with what rssi) to a new file.

The file prefix can be anything you want but suffix must end be one of the following.

.jsonl

Save in jsonl format.

.jsonl.gz

Same as .jsonl except output is gzip-compressed.

.sqlite

Saves events to an SQLite DB. If the file doesn't already exist, this will create the DB file with the correct table schema.

About

Bluetooth Low Energy Scanning

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages