Page 1 of 1
Simple windows batch script to limit speed based if u r home
Posted: November 13th, 2012, 11:54 pm
by discosrule
Wrote a little windows batch script that limits the SAB download speed when I am home and thought I would share it, not sure if there is a simple function elsewhere, but I use it for other uses as well.
How it works....
It does this by pinging my smartphone (static ip!!) on my wifi network and if it responds with a successful ping then it will limit the download queue via the api. If not it will try again after a 1 minutes. When 10 minutes has passed and it hasn't heard from the device it will set SAB to unlimited download speed.
https://github.com/matbor/SAB-Windows-speedlimit
Enjoy and please be nice, new to coding and windows batch files is all I know.... for now
Matt.
Re: Simple windows batch script to limit speed based if u r
Posted: November 14th, 2012, 1:00 am
by sander
Cool.
FWIW: I've written a tool to detect who's at home based on:
- ARP-table in my routermodem. ARP shows the link between IP address and MAC address, see below. So no need for a static IP address
- bluetooth vicinity, measured from my Raspi
Code: Select all
ZySH> show arp
IP address HW type Flags HW address Mask Device
===============================================================================
192.168.1.52 Ether CM B8:27:EB:87:A0:A2 * br0
192.168.1.54 Ether C B8:27:EB:96:C4:2F * br0
192.168.1.38 Ether C 28:37:37:54:0E:8D * br0
Re: Simple windows batch script to limit speed based if u r
Posted: November 14th, 2012, 2:28 am
by discosrule
Mumm.... Might play with arp on my modem.
Interested in your Bluetooth setup? If u care to share? (Here or offline). I have another setup that I'm working on that uses the GPS location of my phone to do things x distance from home.
Re: Simple windows batch script to limit speed based if u r
Posted: November 14th, 2012, 5:07 am
by sander
See the bluetooth commands below. FYI: this is on Linux. I don't what's available on Windows.
Code: Select all
pi@raspberrypi ~ $ hcitool scan
Scanning ...
F0:08:F1:32:8E:26 Sander
pi@raspberrypi ~ $
pi@raspberrypi ~ $ sudo l2ping -c 20 F0:08:F1:32:8E:26
Ping: F0:08:F1:32:8E:26 from 00:1F:81:00:02:00 (data size 44) ...
44 bytes from F0:08:F1:32:8E:26 id 0 time 177.79ms
44 bytes from F0:08:F1:32:8E:26 id 1 time 9.72ms
44 bytes from F0:08:F1:32:8E:26 id 2 time 36.84ms
44 bytes from F0:08:F1:32:8E:26 id 3 time 11.84ms
44 bytes from F0:08:F1:32:8E:26 id 4 time 10.83ms
44 bytes from F0:08:F1:32:8E:26 id 5 time 26.84ms
44 bytes from F0:08:F1:32:8E:26 id 6 time 10.01ms
^C7 sent, 7 received, 0% loss
pi@raspberrypi ~ $
From the back of my head: unconnected and/or hidden iOS devices *do* react to one of the two commands. I believe the l2ping. So that's good news: as long as you know the 6-byte-BT-address, you can check for it's presence ...
HTH
Re: Simple windows batch script to limit speed based if u r
Posted: November 14th, 2012, 5:14 am
by discosrule
Thx