# PERL script for Pocket Warrior conversion # v.03 11-29-2003 # # This perl script creates a NetStumbler Summary Text file # suitable for import into NetStumbler. # # Copyright (c) 2003 by Francis J. Thornton, Jr. (aka "Thorn") # You may copy and modify this file as you see fit, but may # not claim it as your own work. # # See the README.TXT for more info. # # Send feedback, bug reports, etc. to: # PW_Conv@blackthornsystems.com #------------------------------------------------------------------ open(FILE, 'PW Log.txt'); @file = ; close FILE; open (FILE2, '>>wi-scan.txt'); print FILE2 "# \$Creator: PW Converter Version 0.3\n"; print FILE2 "# \$Format: wi-scan summary with extensions\n"; print FILE2 "# \$Latitude Longitude ( SSID ) Type ( BSSID ) Time (GMT) [ SNR Sig Noise ] # ( Name ) Flags Channelbits BcnIntvl\n"; print FILE2 "# \$DateGMT: $DateGMT \n"; while ($line = shift(@file)) { if ($line =~ /^B/) { print "Found a header line - skipping.\n"; print $line; } else { print "Found a data line - processing...\n"; @line = split(/\t/, $line); print "Found a data line - processing...\n"; @line = split(/\t/, $line); $signal = @line[6] + 149; $noise = @line[7] + 149; $snr = ($signal - $noise) + 1; $flags = @line[8]; $flags = sprintf("%04d", $flags); $lat = @line[10]; $long = @line[11]; $lat = sprintf("%-02.07f", $lat); $long = sprintf("%-02.07f", $long); if (@line[2] == 1) { $chbt = 2; } elsif (@line[2] == 2) { $chbt = 4; } elsif (@line[2] == 3) { $chbt = 8; } elsif (@line[2] == 4) { $chbt = 10; } elsif (@line[2] == 5) { $chbt = 20; } elsif (@line[2] == 6) { $chbt = 40; } elsif (@line[2] == 7) { $chbt = 80; } elsif (@line[2] == 8) { $chbt = 100; } elsif (@line[2] == 9) { $chbt = 200; } elsif (@line[2] == 10) { $chbt = 400; } elsif (@line[2] == 11) { $chbt = 800; } elsif (@line[2] == 12) { $chbt = 1000; } elsif (@line[2] == 13) { $chbt = 2000; } elsif (@line[2] == 14) { $chbt = 4000; } else { $chbt = 0; } $chbt = sprintf("%04d", $chbt); print FILE2 "N $lat\tW $long\t( @line[1] )\tTYPE\t( @line[0] )\t@line[5] (GMT)\t[ $snr $signal $noise ]\t # ( ) \t$flags\t$chbt\t@line[9]\n"; } } close FILE2;