#!/usr/bin/perl -w # stupid hack to walk wireless channels. # # Feel free to not find this useful. # # Jon use strict; $SIG{INT} = \&quit; sub quit { die "\n"; } my $IWCONFIG="/usr/sbin/iwconfig"; my $iface = $ARGV[0]; my $range_string = $ARGV[1]; my $sleep = $ARGV[2]; my @range; if (!(defined($iface) || defined($range_string) || defined($sleep))) { die "$0 \n"; } foreach (split(/,/, $range_string)) { if (/(\d+)-(\d+)/) { for (my $i = $1; $i <= $2; $i++) { my $k = $i; if (0 <= $k && $k <= 9) { $k = 0 . $k; } push(@range, $k); } } elsif (/(\d+)/) { my $j; if (0 <= $j && $j <= 9) { $j = 0 . $_; } push(@range, $j); } else { die "Incorrect range specification!\n"; } } while(1) { foreach (@range) { `$IWCONFIG $iface channel $_`; print ("Now on channel $_\n"); `sleep $sleep`; } }