Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwarehouse authored Dec 30, 2016
1 parent c2fae4b commit c483a4c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
51 changes: 51 additions & 0 deletions ble_finder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env python

#----------------------------------------------
# ble_finder.py
# Authors: Troy Brown (@waveguyd) and Garrett Gee (@ggee)
# Developed for:
# http://hackerwarehouse.com / @hackerwarehouse
# http://hackerwarehouse.tv
#
# requirements:
# run from blue_hydra directory and rssi file output option enabled
# tailer module
#
# todo:
# foxhunting
# change last seen to dd:hh:mm:ss
#----------------------------------------------

import datetime, os
from time import sleep

import tailer

devices = [
['D5:3D:F4:CO:FF:EE', 'Ronalds tile tag', ''],
['CF:19:F8:0X:DE:AD', 'Gerrards tile tag', ''],
['FF:FF:C0:0X:BE:EF', 'Jasons iTAG', ''],
]

# threshold for reporting in seconds
#seenthreshold = 10
seenthreshold = 45

for line in tailer.follow(open("blue_hydra_rssi.log")):
for idx, (mac, name, lastseen) in enumerate(devices):
if mac in line:
currentseen = float(line.split()[0])
if lastseen:
lastseen = float(lastseen)
tdelta = datetime.datetime.fromtimestamp(currentseen) - datetime.datetime.fromtimestamp(lastseen)
tsec = tdelta.total_seconds()
if tsec >= seenthreshold:
print name + ' (' + mac + ') is nearby - last seen ' + str(tsec) + ' seconds ago'
# os.system('aplay ping.wav &')
else:
# first time seen
print name + ' (' + mac + ') is nearby'
# os.system('aplay ping.wav &')

# update last seen field with current timestamp
devices[idx][2] = currentseen
9 changes: 9 additions & 0 deletions blue_hydra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
log_level: info
bt_device: hci0
info_scan_rate: 60
status_sync_rate: 86400
btmon_log: false
btmon_rawlog: false
file: false
rssi_log: true
aggressive_rssi: false

0 comments on commit c483a4c

Please sign in to comment.