Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added new signal indication in newer kismet releases

Fixed normalisation
Increased signal indicator size
  • Loading branch information...
commit d604b324495dbceedfa24a00dd33ab72995c873c 1 parent 8338e34
Paul Robins authored February 13, 2011

Showing 1 changed file with 21 additions and 16 deletions. Show diff stats Hide diff stats

  1. 37  kismet2kml.pl
37  kismet2kml.pl
@@ -52,9 +52,10 @@ sub norm_power {
52 52
   my $in  = shift;
53 53
 
54 54
   return 6 unless ($seensignal);
  55
+	my $diff  = $maxpower - $minpower;
55 56
 
56  
-  $in     += abs($minpower);
57  
-  $in     /= ($maxpower+abs($minpower))/5;
  57
+  $in    -= $minpower;
  58
+  $in     /= $diff/5;
58 59
   $in     += 1;
59 60
 
60 61
   return $in;
@@ -157,11 +158,14 @@ sub average {
157 158
 
158 159
   my $bssid = $point->{bssid};
159 160
 
160  
-  $seensignal = 1 if ($point->{signal} && $point->{signal}  != 0);
161  
-
162  
-  if ($point->{signal}) {
163  
-    $minpower = $point->{signal} unless ($point->{signal} == 0 || defined($minpower) && $minpower <= $point->{signal});
164  
-    $maxpower = $point->{signal} unless ($point->{signal} == 0 || defined($maxpower) && $maxpower >= $point->{signal});
  161
+  if ($point->{signal} ||	$point->{signal_dbm}) {
  162
+		my $power = ($point->{signal} && $point->{signal} != 0) ? $point->{signal} : $point->{signal_dbm};
  163
+		$point->{power}  = $power;
  164
+		next if ($power == 0);
  165
+		
  166
+		$seensignal = 1;
  167
+    $minpower = $power unless (defined($minpower) && $minpower <= $power);
  168
+    $maxpower = $power unless (defined($maxpower) && $maxpower >= $power);
165 169
   }
166 170
 
167 171
   $waps{$bssid} = {
@@ -189,14 +193,14 @@ sub average {
189 193
   for my $point (@sorted) {
190 194
     if ($points[$#points] &&  $points[$#points]->{lat} == $point->{lat} &&
191 195
                               $points[$#points]->{lon} == $point->{lon}) {
192  
-      next unless ($point->{signal} && $point->{signal} != 0);
  196
+      next unless ($point->{power} && $point->{power} != 0);
193 197
       # Multiple points at the same location may have different power levels
194  
-      push @{$points[$#points]->{signals}}, $point->{signal};
195  
-      $points[$#points]->{signal} = Math::NumberCruncher::Median($points[$#points]->{signals});
  198
+      push @{$points[$#points]->{powers}}, $point->{power};
  199
+      $points[$#points]->{power} = Math::NumberCruncher::Median($points[$#points]->{powers});
196 200
       next;
197 201
     };
198 202
 
199  
-    $point->{signals} = [$point->{signal}];
  203
+    $point->{powers} = [$point->{power}];
200 204
     push @points,$point;
201 205
   }
202 206
 
@@ -204,12 +208,13 @@ sub average {
204 208
   for my $point (@points) {
205 209
     next unless ($point);
206 210
 
  211
+		my $power = norm_power($point->{power});
207 212
     # Complete hack to display stable lines in google earth  
208  
-    my $coords  = ($point->{lon} - 0.0000005) .",". ($point->{lat} - 0.0000005) .",". norm_power($point->{signal}) ."\n".
209  
-                  ($point->{lon} - 0.0000005) .",". ($point->{lat} + 0.0000005) .",". norm_power($point->{signal}) ."\n".
210  
-                  ($point->{lon} + 0.0000005) .",". ($point->{lat} + 0.0000005) .",". norm_power($point->{signal}) ."\n".
211  
-                  ($point->{lon} + 0.0000005) .",". ($point->{lat} - 0.0000005) .",". norm_power($point->{signal}) ."\n".
212  
-                  ($point->{lon} - 0.0000005) .",". ($point->{lat} - 0.0000005) .",". norm_power($point->{signal});
  213
+    my $coords  = ($point->{lon} - 0.000005) .",". ($point->{lat} - 0.000005) .",". $power ."\n".
  214
+                  ($point->{lon} - 0.000005) .",". ($point->{lat} + 0.000005) .",". $power ."\n".
  215
+                  ($point->{lon} + 0.000005) .",". ($point->{lat} + 0.000005) .",". $power ."\n".
  216
+                  ($point->{lon} + 0.000005) .",". ($point->{lat} - 0.000005) .",". $power ."\n".
  217
+                  ($point->{lon} - 0.000005) .",". ($point->{lat} - 0.000005) .",". $power;
213 218
 
214 219
     push @signals, $gen->Placemark(
215 220
 			$gen->styleUrl($waps{$wap}->{desc}->{type} eq 'infrastructure' ? '#inf' : '#noninf'),

0 notes on commit d604b32

Please sign in to comment.
Something went wrong with that request. Please try again.