Created
April 2, 2015 20:31
-
-
Save hgn/485f6c5c1b5ac69719db to your computer and use it in GitHub Desktop.
OpenWRT New Client Signal Generator for Arduino LED
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Nexus 4 | |
$db{'10:68:ff:ff:ff:ff'} = 0; | |
# Nexus 5 | |
$db{'c4:43:ff:ff:ff:ff'} = 0; | |
sub worker { | |
$scan=`(iw dev wlan1 station dump; iw dev wlan0 station dump) | grep Station`; | |
foreach $key (keys(%db)) { | |
if (index($scan, $key) != -1) { | |
print "found " . $key . "\n"; | |
if (not $db{$key}) { | |
print "new key\n"; | |
system("curl http://led.local/arduino/signal/alarm"); | |
$db{$key} = 1; | |
} | |
} else { | |
$db{$key} = 0; | |
} | |
} | |
} | |
while (1) { | |
worker(); | |
sleep(5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment