bugfix: wscan does not show channels sometimes.

We should of used the freq: field, not sure why I did not use it to begin with.

Corrected and added a small function to convert from frequency to channel.
This commit is contained in:
Conrad Lara - KG6JEI 2015-07-19 23:22:45 -07:00
parent 92dc43209f
commit 661dc23e18
1 changed files with 38 additions and 2 deletions

View File

@ -50,13 +50,49 @@ sub usage
exit;
}
sub freq_to_chan
{
my ($freq) = @_;
if ($freq < 256 )
{
return $freq;
}
elsif ($freq == 2484)
{
return "14";
}
elsif ($freq == 2407)
{
return 0;
}
elsif ($freq < 2484)
{
return ($freq-2407)/5;
}
elsif ($freq < 5000)
{
return ($freq-4000)/5;
}
elsif ($freq < 6000)
{
return ($freq-5000)/5;
}
else
{
return $freq;
}
}
sub pushAP
{
my($signal, $chan, $key, $ssid, $host, $mac, $mode) = @_;
my($signal, $freq, $key, $ssid, $host, $mac, $mode) = @_;
return if $mac eq "";
return if $openap and ($key ne "" or $mode ne "ESS");
$chan=freq_to_chan($freq);
if($ssid eq "") { $ssid = "(hidden)" }
if($chan eq "") { $chan = "?" }
@ -159,7 +195,7 @@ while(1)
if($line =~ /\bSSID: unknown/) { $ssid = "unknown" }
if($line =~ /\bcapability: (ESS|IBSS)/ and $mode eq "")
{ $mode = $1 }
if($line =~ /\bchannel ([\d-]+)/) { $chan = $1 }
if($line =~ /\bfreq: (\d+)/) { $chan = $1 }
if($line =~ /\bsignal: ([\d-]+)/) { $signal = $1 }
if($line =~ /\bGroup cipher:(.+)/) { $key = $1 }
}