Code:
#!/usr/bin/perl
# the script will require some editing...
# sigq.pl
# Copyright 2001 Greg Hamerly (ghamerly@cs.ucsd.edu)
# License: GPL (http://www.gnu.org/copyleft/gpl.html)
# This script logs gps locations and wireless signal strength concurrently
# to make it easy to map the locations of wireless access.
use strict;
my $device = "eth0";
my $iwconfig = "/usr/local/sbin/iwconfig";
my $gpsPort = "/dev/ttyS0";
# set the serial port settings: 9600 baud, ignore carriage returns
system("/bin/stty -F $gpsPort 9600 igncr");
open(GPS, "<$gpsPort") or die("couldn't open serial port");
my $gps = <GPS>;
my $utc_time = substr($gps, 1, 12);
open(OUTPUT, ">data/sigstrength_$utc_time");
while (1) {
$gps = <GPS>; # block on the GPS (the garmin etrex writes once a second)
chomp($gps);
open(QUAL, "$iwconfig $device |") or die("couldn't open iwconfig");
my ($signal, $noise, $network, $accesspt) = (0, 0, "", "");
foreach my $line (<QUAL>) {
if ($line =~ /Link Quality/) {
($signal, $noise) = ($line, $line);
$signal =~ s/.*Signal level:(-\d+).*/\1/;
$noise =~ s/.*Noise level:(-\d+).*/\1/;
} elsif ($line =~ /ESSID/) {
$network = $line;
$network =~ s/^.*ESSID:"([^"]*)".*$/\1/;
} elsif ($line =~ /Access Point/) {
$accesspt = $line;
$accesspt =~ s/.*Access Point: (..:..:..:..:..:..).*/\1/;
}
}
close(QUAL);
chomp($signal, $noise, $network, $accesspt);
print(OUTPUT "$gps $signal $noise \"$network\" $accesspt\n");
print("$gps $signal $noise \"$network\" $accesspt\n");
}
close(OUT);
close(GPS);
Full explanation: http://lists.groogroo.com/mailman/ar...il/000292.html
I just had to share this one... I've been looking for a good open source copy of wifi Scanner for a while now