#!/usr/bin/perl -w # #resets wi0 every second. #first second we check for non-encrypted network, #next second for encrypted network, and so on use strict; $|=1; my $wicomm = '/sbin/wicontrol'; my $resetcomm = '/sbin/wicontrol -p1 -e0'; my $resetcomme = '/sbin/wicontrol -p1 -e1'; my $n = 0; while (1) { print time(), "\t"; open(WICO, "$wicomm|") or die "$wicomm Error: $!"; while () { chomp; print $1,"\t" if /^Current netname \(SSID\):\s+\[(.*)\]$/; print $1,"\t" if /^Current BSSID:\s+\[(.*)\]$/; print $1,"\t" if /^Comms.*\[(.*)\]$/; } close (WICO); print $n%2 ? "Y" : "N"; print "\n"; if ($n%2) { system($resetcomm); } else { system($resetcomme); } sleep 1; $n++; }