jablonka.czprosek.czf

czfcentos

Subversion Repositories:
[/] [trunk/] [router/] [usr/] [local/] [bin/] [klvs.pl] - Blame information for rev 3

 

Line No. Rev Author Line
13czfcentos#!/usr/bin/perl
2##########################################################################################################
3#
4# Kismet Log Viewer 0.9.7 - By Brian Foy Jr. - 4/13/2003
5#
6# Outputs html interface to Kismet .xml log files.
7#
8# Requires:
9# The XML::LibXML perl module
10# At leaast one Kismet .xml logfile.
11#
12# Optional:
13# Snort (http://www.snort.org/)
14# The .dump logfile that matches the .xml logfile.
15#
16# To Use:
17# Either make sure that the 3 included files:
18# logo.png, ap_manuf, and client_manuf are in the same dir as the log you are going to use or,
19# if you prefer, drop them into a set dir (like /etc/klv) and update the lines below to reflect
20# their new location.
21#
22# Note: ap_manuf and client_manf are the files that come with Kismet. It may be a good idea
23# to just point those two lines to the Kismet files so that when Kismet updates them,
24# klv will use the new files by default.
25#
26# Example:
27$logo_location = "../obrazky/logo.png";
28$ap_manuf_location = "/etc/kismet/ap_manuf";
29$client_manuf_location = "/etc/kismet/client_manuf";
30 
31#$logo_location = "logo.png";
32#$ap_manuf_location = "ap_manuf";
33#$client_manuf_location = "client_manuf";
34 
35# Optionaly:
36# At this point you can combine some log files using the included klc.pl script. See klc.pl for more options.
37#
38# Example:
39# ./klc.pl *.xml
40#
41# Then:
42# ./klv.pl (logfile).xml
43#
44# Optionaly:
45# If you have Snort and the .dump file from the same run, you can use -snort to
46# generate a page for the Snort output for each specific bssid that has data avilable.
47#
48# Example:
49# ./klv.pl (logfile).xml -snort
50#
51# And Finaly:
52# Open the (logfile).xml-kismet-log-view.html in your fav browser.
53#
54# Other Options:
55#
56# Set the alignment of the bssid's, center by default. Standard HTML
57# aligments apply, left, right, etc.
58 
59$ssid_align = "center";
60 
61# Set the character to be used in the clients column when there are 0 clients.
62# This default's to - but can be 0 or any other character you choose.
63 
64$no_clients_char = "-";
65 
66#
67# Enjoy!
68# The help and about links point to:
69# http://www.mindflip.org/klv/help.html and http://www.mindflip.org/klv/about.html respectivly
70# you can see those for more info.
71#
72# Please send bugs, feature requests, questions, suggestions to: klv@mindflip.org
73# Watch http://www.mindflip.org/klv for updates.
74#
75##########################################################################################################
76 
77use XML::LibXML;
78 
79unless ( @ARGV > 0 ) {
80 print "Usage: $0 <logfile> [-snort]\n";
81 exit;
82}
83 
84$file = $ARGV[0];
85 
86$help_location = "http://www.mindflip.org/klv/help.html";
87$about_location = "http://www.mindflip.org/klv/about.html";
88$net_stats_link = "$file" . "-kismet-log-view-" . "stats.html";
89 
90if ( "$ARGV[1]" eq "-snort" ) {
91 
92 print "\nKLV: Running Snort...\n";
93 
94 &do_snort;
95 $snort_ok = 1;
96}
97 
98print "KLV: Loading AP Manuf Data...\n";
99 
100open( AP_FILE, "$ap_manuf_location" );
101@ap_manf = <AP_FILE>;
102close(AP_FILE);
103 
104print "KLV: Loading Client Manuf Data...\n";
105 
106open( CLIENT_FILE, "$client_manuf_location" );
107@client_manf = <CLIENT_FILE>;
108close(CLIENT_FILE);
109 
110print "KLV: Loading Logfile...\n";
111 
112$parser = XML::LibXML->new();
113$parser->expand_entities(0);
114$tree = $parser->parse_file($file);
115$root = $tree->getDocumentElement;
116 
117$kismet_ver = $root->getAttribute('kismet-version');
118$kismet_start_time = $root->getAttribute('start-time');
119$kismet_end_time = $root->getAttribute('end-time');
120 
121print "KLV: Generating main HTML File...\n";
122 
123$html_out_file = "$file" . "-kismet-log-view.html";
124open( HTML_OUT, ">$html_out_file" );
125 
126print HTML_OUT <<EOM;
127<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
128<html>
129<head>
130<title>Kismet Log Viewer 1.0 - By Brian Foy Jr. </title>
131<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
132</head>
133<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
134<table width="760" border="0" align="center" cellpadding="5" cellspacing="1">
135 <tr>
136 <td width="30%"><a href="$html_out_file"><img src="$logo_location" width="214" height="77" border="0"></a></td>
137 <td width="70%" align="right" valign="top"><br><br><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="$help_location">help</a> - <a href="$about_location">about</a> - <a href="$net_stats_link">stats</a><br></font></td>
138 </tr>
139</table>
140<table width="760" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#efefef">
141 <tr bgcolor="#cecece">
142 <td width="20">
143 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Net</font></div></td>
144 <td width="120">
145 <div align="$ssid_align"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Name
146 (SSID)</font></div></td>
147 <td width="25">
148 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Type</font></div></td>
149 <td width="20">
150 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Wep</font></div></td>
151 <td width="20">
152 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Ch</font></div></td>
153 <td width="20">
154 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Quality</font></div></td>
155 <td width="20">
156 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Signal</font></div></td>
157 <td width="20">
158 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Noise</font></div></td>
159 <td width="50">
160 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets</font></div></td>
161 <td width="135">
162 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Type/BSSID</font></div></td>
163 <td width="30">
164 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Clients</font></div></td>
165 <td width="170">
166 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">First
167 Seen </font></div></td>
168 <td width="170">
169 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Last
170 Seen</font></div></td>
171 </tr>
172EOM
173 
174$total_networks = @networks = $root->getElementsByTagName('wireless-network');
175$total_factory_defaults = 0;
176$total_wep = 0;
177$total_cloaked = 0;
178 
179foreach $this_network (@networks) {
180 
181 $total_clients_this_net = @net_clients =
182 $this_network->getElementsByTagName('wireless-client');
183 
184 $total_clients += $total_clients_this_net;
185 
186 $net_number = $this_network->getAttribute('number');
187 $net_type = $this_network->getAttribute('type');
188 $net_wep = $this_network->getAttribute('wep');
189 $net_cloaked = $this_network->getAttribute('cloaked');
190 
191 undef $net_device_cloaked;
192 
193 if ("$net_cloaked" eq "true") {
194 $net_device_cloaked = 1;
195 $total_cloaked++;
196 }
197 
198 $net_carrier = $this_network->getAttribute('carrier');
199 $net_first = $this_network->getAttribute('first-time');
200 $net_last = $this_network->getAttribute('last-time');
201 if ( $temp = $this_network->getElementsByTagName('SSID')->[0] ) {
202 $net_ssid =
203 $this_network->getElementsByTagName('SSID')
204 ->[0]->getFirstChild->getData;
205 }
206 elsif ( $temp = $this_network->getElementsByTagName('info')->[0] ) {
207 $net_ssid =
208 $this_network->getElementsByTagName('info')
209 ->[0]->getFirstChild->getData;
210 }
211 else {
212 $net_ssid = "NA";
213 }
214 $net_bssid =
215 $this_network->getElementsByTagName('BSSID')->[0]->getFirstChild->getData;
216 $net_channel =
217 $this_network->getElementsByTagName('channel')
218 ->[0]->getFirstChild->getData;
219 $net_quality =
220 $this_network->getElementsByTagName('quality')
221 ->[0]->getFirstChild->getData;
222 $net_signal =
223 $this_network->getElementsByTagName('signal')
224 ->[0]->getFirstChild->getData;
225 $net_noise =
226 $this_network->getElementsByTagName('noise')
227 ->[0]->getFirstChild->getData;
228 $net_maxrate =
229 $this_network->getElementsByTagName('maxrate')
230 ->[0]->getFirstChild->getData;
231 $net_packets_LLC =
232 $this_network->getElementsByTagName('LLC')->[0]->getFirstChild->getData;
233 $net_packets_data =
234 $this_network->getElementsByTagName('data')->[0]->getFirstChild->getData;
235 $net_packets_crypt =
236 $this_network->getElementsByTagName('crypt')->[0]->getFirstChild->getData;
237 $net_packets_weak =
238 $this_network->getElementsByTagName('weak')->[0]->getFirstChild->getData;
239 $net_packets_total =
240 $this_network->getElementsByTagName('total')->[0]->getFirstChild->getData;
241 
242 $total_packets += $net_packets_total;
243 
244 if ( $temp = $this_network->getElementsByTagName('datasize')->[0] ) {
245 $net_datasize =
246 $this_network->getElementsByTagName('datasize')
247 ->[0]->getFirstChild->getData;
248 }
249 else {
250 $net_datasize = "NA";
251 }
252 
253 if ( $temp = $this_network->getElementsByTagName('min-lat')->[0] ) {
254 $net_gps_min_lat =
255 $this_network->getElementsByTagName('min-lat')
256 ->[0]->getFirstChild->getData;
257 $net_gps_min_lon =
258 $this_network->getElementsByTagName('min-lon')
259 ->[0]->getFirstChild->getData;
260 $net_gps_min_alt =
261 $this_network->getElementsByTagName('min-alt')
262 ->[0]->getFirstChild->getData;
263 $net_gps_min_spd =
264 $this_network->getElementsByTagName('min-spd')
265 ->[0]->getFirstChild->getData;
266 $net_gps_max_lat =
267 $this_network->getElementsByTagName('max-lat')
268 ->[0]->getFirstChild->getData;
269 $net_gps_max_lon =
270 $this_network->getElementsByTagName('max-lon')
271 ->[0]->getFirstChild->getData;
272 $net_gps_max_alt =
273 $this_network->getElementsByTagName('max-alt')
274 ->[0]->getFirstChild->getData;
275 $net_gps_max_spd =
276 $this_network->getElementsByTagName('max-spd')
277 ->[0]->getFirstChild->getData;
278 $net_gps_med_lon = ( ( $net_gps_min_lon + $net_gps_max_lon ) / 2 );
279 $net_gps_med_lat = ( ( $net_gps_min_lat + $net_gps_max_lat ) / 2 );
280 $net_gps_aprox_map1 =
281"http://tiger.census.gov/cgi-bin/mapper/map.gif?&lat=$net_gps_med_lat&lon=$net_gps_med_lon&ht=0.004&wid=0.011&&tlevel=-&tvar=-&tmeth=i&mlat=$net_gps_med_lat&mlon=$net_gps_med_lon&msym=cross&mlabel=N$net_number&murl=&conf=mapnew.con&iht=359&iwd=422";
282 $net_gps_aprox_map2 =
283"http://tiger.census.gov/cgi-bin/mapper/map.gif?&lat=$net_gps_med_lat&lon=$net_gps_med_lon&ht=0.009&wid=0.022&&tlevel=-&tvar=-&tmeth=i&mlat=$net_gps_med_lat&mlon=$net_gps_med_lon&msym=cross&mlabel=N$net_number&murl=&conf=mapnew.con&iht=359&iwd=422";
284 $net_gps_aprox_map3 =
285"http://tiger.census.gov/cgi-bin/mapper/map.gif?&lat=$net_gps_med_lat&lon=$net_gps_med_lon&ht=0.018&wid=0.044&&tlevel=-&tvar=-&tmeth=i&mlat=$net_gps_med_lat&mlon=$net_gps_med_lon&msym=cross&mlabel=N$net_number&murl=&conf=mapnew.con&iht=359&iwd=422";
286 $net_gps_aprox_map4 =
287"http://tiger.census.gov/cgi-bin/mapper/map.gif?&lat=$net_gps_med_lat&lon=$net_gps_med_lon&ht=0.036&wid=0.088&&tlevel=-&tvar=-&tmeth=i&mlat=$net_gps_med_lat&mlon=$net_gps_med_lon&msym=cross&mlabel=N$net_number&murl=&conf=mapnew.con&iht=359&iwd=422";
288 $net_gps_aprox_map5 =
289"http://tiger.census.gov/cgi-bin/mapper/map.gif?&lat=$net_gps_med_lat&lon=$net_gps_med_lon&ht=0.064&wid=0.192&&tlevel=-&tvar=-&tmeth=i&mlat=$net_gps_med_lat&mlon=$net_gps_med_lon&msym=cross&mlabel=N$net_number&murl=&conf=mapnew.con&iht=359&iwd=422";
290 $net_gps_aprox_map_avilable =
291"(+) <a href=\"$net_gps_aprox_map1\" target=\"_blank\">1</a> <a href=\"$net_gps_aprox_map2\" target=\"_blank\">2</a> <a href=\"$net_gps_aprox_map3\" target=\"_blank\">3</a> <a href=\"$net_gps_aprox_map4\" target=\"_blank\">4</a> <a href=\"$net_gps_aprox_map5\" target=\"_blank\">5</a> (-)";
292 }
293 else {
294 $net_gps_min_lat = "NA";
295 $net_gps_min_lon = "NA";
296 $net_gps_min_alt = "NA";
297 $net_gps_min_spd = "NA";
298 $net_gps_max_lat = "NA";
299 $net_gps_max_lon = "NA";
300 $net_gps_max_alt = "NA";
301 $net_gps_max_spd = "NA";
302 $net_gps_aprox_map = "NA";
303 $net_gps_aprox_map_avilable = "NA";
304 }
305 
306 if ( $temp = $this_network->getElementsByTagName('ip-range')->[0] ) {
307 $net_ip_range =
308 $this_network->getElementsByTagName('ip-range')
309 ->[0]->getFirstChild->getData;
310 @net_ip_parts = $this_network->getElementsByTagName('ip-address');
311 foreach $this_ip (@net_ip_parts) {
312 $net_ip_type = $this_ip->getAttribute('type');
313 }
314 }
315 else {
316 $net_ip_range = "NA";
317 $net_ip_type = "NA";
318 }
319 
320 
321 $net_link = "$file" . "-kismet-log-view-" . "$net_number" . "-info.html";
322 
323 $net_clients_total = @net_clients;
324 
325 if ("$net_clients_total" eq "0") {
326 $net_clients_total = "$no_clients_char";
327 }
328 
329 $net_clients_link =
330 "$file" . "-kismet-log-view-" . "$net_number" . "-clients.html";
331 
332 $net_type = substr( $net_type, 0, 2 );
333 if ( "$net_type" eq "in" ) { $net_type = "AP"; }
334 
335 if ( "$net_wep" eq "true" ) { $net_wep = "Y"; $total_wep++; }
336 else { $net_wep = "N"; }
337 
338 if ( "$net_cloaked" eq "true" ) { $net_cloaked = "Y"; }
339 else { $net_cloaked = "N"; }
340 
341 $net_first =~ s/ / /g;
342 $net_last =~ s/ / /g;
343 
344 @first_parts = split ( / /, $net_first );
345 
346 @last_parts = split ( / /, $net_last );
347 
348 $net_device_name = "NA";
349 undef $net_device_def;
350 foreach $ap_manuf_line (@ap_manf) {
351 chomp $ap_manuf_line;
352 @ap_manuf_line_parts = split ( /\t/, $ap_manuf_line );
353 if ( $net_bssid =~ /$ap_manuf_line_parts[0]/ ) {
354 $net_device_name =
355 "$ap_manuf_line_parts[1] $ap_manuf_line_parts[2]";
356 
357 if ("$net_channel" eq "$ap_manuf_line_parts[4]") {
358 
359 if ("$net_ssid" eq "$ap_manuf_line_parts[3]") {
360 $net_device_def = 1;
361 }
362 
363 if ("$net_ip_range" eq "NA") {
364 $net_ip_range .= " ($ap_manuf_line_parts[5])";
365 } else {
366 $net_ip_range = "$net_ip_range ($ap_manuf_line_parts[5])";
367 }
368 }
369 
370 }
371 }
372 
373 if ( $net_number % 2 == 0 ) {
374 print HTML_OUT "<tr>";
375 }
376 else {
377 print HTML_OUT "<tr bgcolor=\"#FFFFFF\">";
378 }
379 
380 if ($snort_ok) {
381 undef $this_net_snort;
382 $mod_bssid = $net_bssid;
383 $mod_bssid =~ s/://g;
384 if ( $network_packets{"$mod_bssid"} ) {
385 print "KLV: Extracting Snort Data for $net_ssid ...\n";
386 &gen_snort($mod_bssid);
387 $this_net_snort = 1;
388 }
389 }
390 
391 
392undef $flags;
393 if ($net_device_cloaked) {
394 $flags .= "C";
395 $total_factory_defaults++;
396 }
397 if ($net_device_def) {
398 $flags .= "F";
399 $total_factory_defaults++;
400 }
401 if ($this_net_snort) {
402 $flags .= "<a href=\"$net_snort_link\">D</a>";
403 }
404 
405$net_total_unwep = eval($total_networks - $total_wep);
406$net_percent_wep = eval($total_wep / $total_networks) * 100;
407$net_percent_wep = substr($net_percent_wep,0,4);
408 
409$net_percent_factory_default = eval($total_factory_defaults / $total_networks) * 100;
410$net_percent_factory_default = substr($net_percent_factory_default,0,4);
411 
412$net_percent_cloaked = eval($total_cloaked / $total_networks) * 100;
413$net_percent_cloaked = substr($net_percent_cloaked,0,4);
414 
415 
416 print HTML_OUT <<EOM;
417<td width="20"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_number$flags</font></div></td>
418<td width="120"><div align="$ssid_align"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="$net_link">$net_ssid</a></font></div></td>
419<td width="25"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_type</font></div></td>
420<td width="20"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_wep</font></div></td>
421<td width="20"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_channel</font></div></td>
422<td width="20"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_quality</font></div></td>
423<td width="20"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_signal</font></div></td>
424<td width="20"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_noise</font></div></td>
425<td width="50"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_total</font></div></td>
426<td width="75"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_device_name<br>$net_bssid</font></div></td>
427EOM
428 
429 if ($net_clients_total > 0) {
430 print HTML_OUT <<EOM;
431<td width="50"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="$net_clients_link">$net_clients_total</a></font></div></td>
432EOM
433 }
434 else {
435 print HTML_OUT <<EOM;
436<td width="50"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_clients_total</font></div></td>
437EOM
438 }
439 
440 print HTML_OUT <<EOM;
441<td width="200"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$first_parts[0] $first_parts[1] $first_parts[2]<br>$first_parts[3]</font></div></td>
442<td width="200"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$last_parts[0] $last_parts[1] $last_parts[2]<br>$last_parts[3]</font></div></td>
443</tr>
444EOM
445 
446 print "KLV: Generating details for network #$net_number ($net_ssid) ...\n";
447 
448 open( HTML_NET_OUT, ">$net_link" );
449 
450 print HTML_NET_OUT <<EOM;
451<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
452<html>
453<head>
454<title>Kismet Log Viewer 1.0 - By Brian Foy Jr. </title>
455<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
456</head>
457<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
458<table width="760" border="0" align="center" cellpadding="5" cellspacing="1">
459 <tr>
460 <td width="30%"><a href="$html_out_file"><img src="$logo_location" width="214" height="77" border="0"></a></td>
461 <td width="70%" align="right" valign="top"><br><br><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="$help_location">help</a> - <a href="$about_location">about</a> - <a href="$net_stats_link">stats</a><br></font></td>
462 </tr>
463</table>
464<table width="760" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#efefef">
465 <tr bgcolor="#cecece">
466 <td width="200">
467 <div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_ssid</font></div></td>
468 <td width="540">
469 <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Type: $net_device_name ($net_bssid)</font></div></td>
470 </tr>
471<tr bgcolor="#FFFFFF">
472<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Net</font></div></td>
473<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_number</font></div></td>
474</tr>
475<tr>
476<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Type</font></div></td>
477<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_type</font></div></td>
478</tr>
479<tr bgcolor="#FFFFFF">
480<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Wep</font></div></td>
481<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_wep</font></div></td>
482</tr>
483<tr>
484<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Cloaked</font></div></td>
485<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_cloaked</font></div></td>
486</tr>
487<tr bgcolor="#FFFFFF">
488<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Carrier</font></div></td>
489<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_carrier</font></div></td>
490</tr>
491<tr>
492<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">First Seen</font></div></td>
493<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_first</font></div></td>
494</tr>
495<tr bgcolor="#FFFFFF">
496<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Last Seen</font></div></td>
497<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_last</font></div></td>
498</tr>
499<tr>
500<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Channel</font></div></td>
501<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_channel</font></div></td>
502</tr>
503<tr bgcolor="#FFFFFF">
504<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Maxrate</font></div></td>
505<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_maxrate</font></div></td>
506</tr>
507<tr>
508<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (LLC)</font></div></td>
509<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_LLC</font></div></td>
510</tr>
511<tr bgcolor="#FFFFFF">
512<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (data)</font></div></td>
513<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_data</font></div></td>
514</tr>
515<tr>
516<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (crypt)</font></div></td>
517<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_crypt</font></div></td>
518</tr>
519<tr bgcolor="#FFFFFF">
520<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (weak)</font></div></td>
521<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_weak</font></div></td>
522</tr>
523<tr>
524<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (total)</font></div></td>
525<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_total</font></div></td>
526</tr>
527<tr bgcolor="#FFFFFF">
528<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Datasize</font></div></td>
529<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_datasize</font></div></td>
530</tr>
531EOM
532 
533 if ($net_clients_total > 0) {
534 print HTML_NET_OUT <<EOM;
535<tr>
536<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Clients</font></div></td>
537<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="$net_clients_link">$net_clients_total</a></font></div></td>
538</tr>
539EOM
540 } else {
541 print HTML_NET_OUT <<EOM;
542<tr>
543<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Clients</font></div></td>
544<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_clients_total</font></div></td>
545</tr>
546EOM
547}
548 
549 print HTML_NET_OUT <<EOM;
550<tr bgcolor="#FFFFFF">
551<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Lat</font></div></td>
552<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_min_lat</font></div></td>
553</tr>
554<tr>
555<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Lon</font></div></td>
556<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_min_lon</font></div></td>
557</tr>
558<tr bgcolor="#FFFFFF">
559<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Alt</font></div></td>
560<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_min_alt</font></div></td>
561</tr>
562<tr>
563<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Spd</font></div></td>
564<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_min_spd</font></div></td>
565</tr>
566 
567<tr bgcolor="#FFFFFF">
568<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Lat</font></div></td>
569<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_max_lat</font></div></td>
570</tr>
571<tr>
572<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Lon</font></div></td>
573<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_max_lon</font></div></td>
574</tr>
575<tr bgcolor="#FFFFFF">
576<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Alt</font></div></td>
577<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_max_alt</font></div></td>
578</tr>
579<tr>
580<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Spd</font></div></td>
581<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_max_spd</font></div></td>
582</tr>
583<tr bgcolor="#FFFFFF">
584<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">IP Range</font></div></td>
585<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_ip_range</font></div></td>
586</tr>
587<tr>
588<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">IP Type</font></div></td>
589<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_ip_type</font></div></td>
590</tr>
591<tr bgcolor="#FFFFFF">
592<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Map Approx. Location:</font></div></td>
593<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_aprox_map_avilable</font></div></td>
594</tr>
595 
596EOM
597 
598 if ($this_net_snort) {
599 
600 print HTML_NET_OUT <<EOM;
601<tr>
602<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Snort Output:</font></div></td>
603<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="$net_snort_link">View Output</a></font></div></td>
604</tr>
605EOM
606 
607 }
608 
609 print HTML_NET_OUT <<EOM;
610</table>
611<br>
612<hr align="center" width="680" size="1" noshade>
613<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="javascript:history.back(1)">&lt; back </a></font></div>
614<br>
615<br>
616</body>
617</html>
618EOM
619 close HTML_NET_OUT;
620 
621 
622if (@net_clients) {
623 
624 
625 open( HTML_CLIENT_OUT, ">$net_clients_link" );
626 
627 print HTML_CLIENT_OUT <<EOM;
628<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
629<html>
630<head>
631<title>Kismet Log Viewer 1.0 - By Brian Foy Jr. </title>
632<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
633</head>
634<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
635<table width="760" border="0" align="center" cellpadding="5" cellspacing="1">
636 <tr>
637 <td width="30%"><a href="$html_out_file"><img src="$logo_location" width="214" height="77" border="0"></a></td>
638 <td width="70%" align="right" valign="top"><br><br><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="$help_location">help</a> - <a href="$about_location">about</a> - <a href="$net_stats_link">stats</a><br></font></td>
639 </tr>
640</table>
641EOM
642 
643 
644 foreach $this_client (@net_clients) {
645 
646 $client_number = $this_client->getAttribute('number');
647 $client_type = $this_client->getAttribute('type');
648 $client_wep = $this_client->getAttribute('wep');
649 $client_first = $this_client->getAttribute('first-time');
650 $client_last = $this_client->getAttribute('last-time');
651 $client_mac =
652 $this_client->getElementsByTagName('client-mac')
653 ->[0]->getFirstChild->getData;
654 $client_packets_data =
655 $this_client->getElementsByTagName('client-data')
656 ->[0]->getFirstChild->getData;
657 $client_packets_crypt =
658 $this_client->getElementsByTagName('client-crypt')
659 ->[0]->getFirstChild->getData;
660 $client_packets_weak =
661 $this_client->getElementsByTagName('client-weak')
662 ->[0]->getFirstChild->getData;
663 $client_datasize =
664 $this_client->getElementsByTagName('client-datasize')
665 ->[0]->getFirstChild->getData;
666 $client_maxrate =
667 $this_client->getElementsByTagName('client-maxrate')
668 ->[0]->getFirstChild->getData;
669 
670 if ( $temp = $this_client->getElementsByTagName('client-min-lat')->[0] )
671 {
672 $client_gps_min_lat =
673 $this_client->getElementsByTagName('client-min-lat')
674 ->[0]->getFirstChild->getData;
675 $client_gps_min_lon =
676 $this_client->getElementsByTagName('client-min-lon')
677 ->[0]->getFirstChild->getData;
678 $client_gps_min_alt =
679 $this_client->getElementsByTagName('client-min-alt')
680 ->[0]->getFirstChild->getData;
681 $client_gps_min_spd =
682 $this_client->getElementsByTagName('client-min-spd')
683 ->[0]->getFirstChild->getData;
684 $client_gps_max_lat =
685 $this_client->getElementsByTagName('client-max-lat')
686 ->[0]->getFirstChild->getData;
687 $client_gps_max_lon =
688 $this_client->getElementsByTagName('client-max-lon')
689 ->[0]->getFirstChild->getData;
690 $client_gps_max_alt =
691 $this_client->getElementsByTagName('client-max-alt')
692 ->[0]->getFirstChild->getData;
693 $client_gps_max_spd =
694 $this_client->getElementsByTagName('client-max-spd')
695 ->[0]->getFirstChild->getData;
696 }
697 else {
698 $client_gps_min_lat = "NA";
699 $client_gps_min_lon = "NA";
700 $client_gps_min_alt = "NA";
701 $client_gps_min_spd = "NA";
702 $client_gps_max_lat = "NA";
703 $client_gps_max_lon = "NA";
704 $client_gps_max_alt = "NA";
705 $client_gps_max_spd = "NA";
706 }
707 
708 if ( $temp =
709 $this_client->getElementsByTagName('client-ip-address')->[0] )
710 {
711 $client_ip_address =
712 $this_client->getElementsByTagName('client-ip-address')
713 ->[0]->getFirstChild->getData;
714 @client_ip_parts =
715 $this_client->getElementsByTagName('client-ip-address');
716 foreach $this_client_ip (@client_ip_parts) {
717 $client_ip_type = $this_client_ip->getAttribute('type');
718 }
719 }
720 else {
721 $client_ip_address = "NA";
722 $client_ip_type = "NA";
723 }
724 
725 if ( "$client_wep" eq "true" ) { $client_wep = "Y"; }
726 else { $client_wep = "N"; }
727 
728 $client_device_name = "Type: NA";
729 foreach $client_manuf_line (@client_manf) {
730 chomp $client_manuf_line;
731 @client_manuf_line_parts = split ( /\t/, $client_manuf_line );
732 if ( $client_mac =~ /$client_manuf_line_parts[0]/ ) {
733 $client_device_name =
734"Type: $client_manuf_line_parts[1] $client_manuf_line_parts[2]";
735 }
736 }
737 
738 print
739"KLV: Generating details for network #$net_number ($net_ssid) client #$client_number ...\n";
740 
741 print HTML_CLIENT_OUT <<EOM;
742<table width="760" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#efefef">
743 <tr bgcolor="#cecece">
744 <td width="200">
745 <div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Client #$client_number</font></div></td>
746 <td width="540">
747 <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_device_name (<a href="$net_link">$net_ssid</a>)</font></div></td>
748 </tr>
749<tr bgcolor="#FFFFFF">
750<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Type</font></div></td>
751<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_type</font></div></td>
752</tr>
753<tr>
754<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Wep</font></div></td>
755<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_wep</font></div></td>
756</tr>
757<tr bgcolor="#FFFFFF">
758<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">First Seen</font></div></td>
759<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_first</font></div></td>
760</tr>
761<tr>
762<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Last Seen</font></div></td>
763<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_last</font></div></td>
764</tr>
765<tr bgcolor="#FFFFFF">
766<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Mac</font></div></td>
767<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_mac</font></div></td>
768</tr>
769<tr>
770<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (data)</font></div></td>
771<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_packets_data</font></div></td>
772</tr>
773<tr bgcolor="#FFFFFF">
774<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (crypt)</font></div></td>
775<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_packets_crypt</font></div></td>
776</tr>
777<tr>
778<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (weak)</font></div></td>
779<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_packets_weak</font></div></td>
780</tr>
781<tr bgcolor="#FFFFFF">
782<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (total)</font></div></td>
783<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_total</font></div></td>
784</tr>
785<tr>
786<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Datasize</font></div></td>
787<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_datasize</font></div></td>
788</tr>
789<tr bgcolor="#FFFFFF">
790<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Maxrate</font></div></td>
791<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_maxrate</font></div></td>
792 
793<tr>
794<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Lat</font></div></td>
795<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_min_lat</font></div></td>
796</tr>
797<tr bgcolor="#FFFFFF">
798<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Lon</font></div></td>
799<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_min_lon</font></div></td>
800</tr>
801<tr>
802<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Alt</font></div></td>
803<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_min_alt</font></div></td>
804</tr>
805<tr bgcolor="#FFFFFF">
806<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Spd</font></div></td>
807<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_min_spd</font></div></td>
808</tr>
809 
810<tr>
811<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Lat</font></div></td>
812<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_max_lat</font></div></td>
813</tr>
814<tr bgcolor="#FFFFFF">
815<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Lon</font></div></td>
816<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_max_lon</font></div></td>
817</tr>
818<tr>
819<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Alt</font></div></td>
820<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_max_alt</font></div></td>
821</tr>
822<tr bgcolor="#FFFFFF">
823<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Spd</font></div></td>
824<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_max_spd</font></div></td>
825</tr>
826<tr>
827<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">IP Address</font></div></td>
828<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_ip_address</font></div></td>
829</tr>
830<tr bgcolor="#FFFFFF">
831<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">IP Type</font></div></td>
832<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_ip_type</font></div></td>
833</tr>
834 
835</table>
836<br>
837EOM
838 
839 } # end foreach client
840 
841 print HTML_CLIENT_OUT <<EOM;
842</table>
843<br>
844<hr align="center" width="680" size="1" noshade>
845<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="javascript:history.back(1)">&lt; back </a></font></div>
846<br>
847<br>
848</body>
849</html>
850EOM
851 close HTML_CLIENT_OUT;
852 
853} # end of @net_clients
854 
855 
856} # end foreach @networks
857 
858print HTML_OUT <<EOM;
859</table>
860<br>
861<hr align="center" width="680" size="1" noshade>
862 
863<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#a5a5a5">
864Started: $kismet_start_time - Ended: $kismet_end_time<br>
865Log File: $file<br>
866</font></div>
867<br><br>
868<br><br>
869<br><br>
870<br><br>
871<br><br>
872<br><br>
873<br><br>
874<br><br>
875<br><br>
876<br><br>
877<br><br>
878<br><br>
879<br><br>
880<br><br>
881<br><br>
882<br><br>
883<br><br>
884<br><br>
885<br><br>
886</body>
887</html>
888EOM
889close HTML_OUT;
890 
891 
892print "KLV: Generating Stats...\n";
893 
894 open( HTML_STATS_OUT, ">$net_stats_link" );
895 
896 print HTML_STATS_OUT <<EOM;
897<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
898<html>
899<head>
900<title>Kismet Log Viewer 1.0 - By Brian Foy Jr. </title>
901<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
902</head>
903<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
904<table width="760" border="0" align="center" cellpadding="5" cellspacing="1">
905 <tr>
906 <td width="30%"><a href="$html_out_file"><img src="$logo_location" width="214" height="77" border="0"></a></td>
907 <td width="70%" align="right" valign="top"><br><br><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="$help_location">help</a> - <a href="$about_location">about</a> - <a href="$net_stats_link">stats</a><br></font></td>
908 </tr>
909</table>
910<table width="760" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#efefef">
911 <tr bgcolor="#cecece">
912 <td width="200">
913 <div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Stats:</font></div></td>
914 <td width="540">
915 <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$file</font></div></td>
916 </tr>
917 
918<tr bgcolor="#FFFFFF">
919<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Started</font></div></td>
920<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$kismet_start_time</font></div></td>
921</tr>
922<tr>
923<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Ended</font></div></td>
924<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$kismet_end_time</font></div></td>
925</tr>
926 
927<tr bgcolor="#FFFFFF">
928<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Kismet Server Ver</font></div></td>
929<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$kismet_ver</font></div></td>
930</tr>
931<tr>
932<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Networks</font></div></td>
933<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_networks</font></div></td>
934</tr>
935<tr bgcolor="#FFFFFF">
936<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Networks with WEP</font></div></td>
937<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_wep</font></div></td>
938</tr>
939<tr>
940<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Networks without WEP</font></div></td>
941<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_total_unwep</font></div></td>
942</tr>
943<tr bgcolor="#FFFFFF">
944<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">% Networks with WEP</font></div></td>
945<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_percent_wep%</font></div></td>
946</tr>
947<tr>
948<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Networks Factory Default</font></div></td>
949<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_factory_defaults</font></div></td>
950</tr>
951<tr bgcolor="#FFFFFF">
952<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">% Networks Factory Default</font></div></td>
953<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_percent_factory_default%</font></div></td>
954</tr>
955<tr>
956<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Cloaked Networks</font></div></td>
957<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_cloaked</font></div></td>
958</tr>
959<tr bgcolor="#FFFFFF">
960<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">% Networks Cloaked</font></div></td>
961<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_percent_cloaked%</font></div></td>
962</tr>
963<tr>
964<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Clients</font></div></td>
965<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_clients</font></div></td>
966</tr>
967<tr bgcolor="#FFFFFF">
968<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Packets</font></div></td>
969<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_packets</font></div></td>
970</tr>
971 
972</table>
973<br>
974<hr align="center" width="680" size="1" noshade>
975<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="javascript:history.back(1)">&lt; back </a></font></div>
976<br>
977</body>
978</html>
979EOM
980 
981print "KLV: Done!\n";
982exit;
983 
984sub do_snort {
985 
986 $snort_file = $file;
987 $snort_file =~ s/\.xml/\.dump/g;
988 
989 system("snort -vdeCr $snort_file > snort_temp.txt");
990 
991 open( SNORTFILE, "snort_temp.txt" );
992 @all_snort_lines = <SNORTFILE>;
993 close SNORTFILE;
994 unlink("snort_temp.txt");
995 
996 foreach $this_line (@all_snort_lines) {
997 $all_lines_comb .= "$this_line";
998 }
999 
1000 @all_snort_line_parts = split (
1001/\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+/,
1002 $all_lines_comb
1003 );
1004 
1005 foreach $this_line (@all_snort_line_parts) {
1006 
1007 undef $this_packets_lines;
1008 undef $bssid;
1009 
1010 @this_packet_lines = split ( /\n/, $this_line );
1011 
1012 foreach $this_packet_line (@this_packet_lines) {
1013 
1014 if ( $this_packet_line =~ /Run time for packet processing was/ ) {
1015 break;
1016 }
1017 
1018 if ( $this_packet_line =~ /bssid/ ) {
1019 @this_bssid_parts = split ( / /, $this_packet_line );
1020 $bssid = "$this_bssid_parts[1]";
1021 }
1022 $this_packet_line =~ s/\r/\<br\>/g;
1023 
1024 if ( $this_packet_line =~
1025 /No run mode specified, defaulting to verbose mode/g )
1026 {
1027 $this_packet_line = "<br>";
1028 }
1029 $this_packets_lines .= "$this_packet_line<br>";
1030 }
1031 
1032 if ($bssid) {
1033 
1034 @bssid_parts = split ( /\:/, $bssid );
1035 
1036 undef $this_full_bssid;
1037 
1038 foreach $this_bssid_parts (@bssid_parts) {
1039 
1040 if ( length($this_bssid_parts) < 2 ) {
1041 $this_bssid_parts = "0" . "$this_bssid_parts";
1042 }
1043 
1044 $this_full_bssid .= "$this_bssid_parts";
1045 }
1046 
1047 $network_packets{"$this_full_bssid"} .= "$this_packets_lines";
1048 
1049 }
1050 
1051 }
1052 
1053} # end sub do_snort
1054 
1055sub gen_snort($mod_bssid) {
1056 
1057 $net_snort_link =
1058 "$file" . "-kismet-log-view-" . "$mod_bssid" . "-snort.html";
1059 
1060 open( HTML_SNORT_OUT, ">$net_snort_link" );
1061 
1062 print HTML_SNORT_OUT <<EOM;
1063<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
1064<html>
1065<head>
1066<title>Kismet Log Viewer 1.0 - By Brian Foy Jr. </title>
1067<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
1068</head>
1069<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
1070<table width="760" border="0" align="center" cellpadding="5" cellspacing="1">
1071 <tr>
1072 <td width="30%"><a href="$html_out_file"><img src="$logo_location" width="214" height="77" border="0"></a></td>
1073 <td width="70%" align="right" valign="top"><br><br><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="$help_location">help</a> - <a href="$about_location">about</a> - <a href="$net_stats_link">stats</a><br></font></td>
1074 </tr>
1075</table>
1076<table width="760" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#efefef">
1077 <tr bgcolor="#cecece">
1078 <td width="760">
1079 <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Snort output for: <a href="$net_link"> $net_ssid</a> ($net_bssid)</font></div></td>
1080 </tr>
1081<tr bgcolor="#FFFFFF">
1082<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
1083EOM
1084 
1085 print HTML_SNORT_OUT $network_packets{"$mod_bssid"};
1086 
1087 print HTML_SNORT_OUT <<EOM;
1088</font>
1089</td>
1090</tr>
1091</table>
1092<br>
1093</table>
1094<br>
1095<hr align="center" width="680" size="1" noshade>
1096<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="javascript:history.back(1)">&lt; back </a></font></div>
1097<br>
1098<br>
1099</body>
1100</html>
1101EOM
1102 close HTML_SNORT_OUT;
1103 
1104} #end sub gen_snort

Powered by WebSVN 2.2.1