jablonka.czprosek.czf

czfcentos

Subversion Repositories:
[/] [trunk/] [router/] [usr/] [local/] [bin/] [klv.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="50">
154 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets</font></div></td>
155 <td width="135">
156 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Type/BSSID</font></div></td>
157 <td width="30">
158 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Clients</font></div></td>
159 <td width="170">
160 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">First
161 Seen </font></div></td>
162 <td width="170">
163 <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Last
164 Seen</font></div></td>
165 </tr>
166EOM
167 
168$total_networks = @networks = $root->getElementsByTagName('wireless-network');
169$total_factory_defaults = 0;
170$total_wep = 0;
171$total_cloaked = 0;
172 
173foreach $this_network (@networks) {
174 
175 $total_clients_this_net = @net_clients =
176 $this_network->getElementsByTagName('wireless-client');
177 
178 $total_clients += $total_clients_this_net;
179 
180 $net_number = $this_network->getAttribute('number');
181 $net_type = $this_network->getAttribute('type');
182 $net_wep = $this_network->getAttribute('wep');
183 $net_cloaked = $this_network->getAttribute('cloaked');
184 
185 undef $net_device_cloaked;
186 
187 if ("$net_cloaked" eq "true") {
188 $net_device_cloaked = 1;
189 $total_cloaked++;
190 }
191 
192 $net_carrier = $this_network->getAttribute('carrier');
193 $net_first = $this_network->getAttribute('first-time');
194 $net_last = $this_network->getAttribute('last-time');
195 if ( $temp = $this_network->getElementsByTagName('SSID')->[0] ) {
196 $net_ssid =
197 $this_network->getElementsByTagName('SSID')
198 ->[0]->getFirstChild->getData;
199 }
200 elsif ( $temp = $this_network->getElementsByTagName('info')->[0] ) {
201 $net_ssid =
202 $this_network->getElementsByTagName('info')
203 ->[0]->getFirstChild->getData;
204 }
205 else {
206 $net_ssid = "NA";
207 }
208 $net_bssid =
209 $this_network->getElementsByTagName('BSSID')->[0]->getFirstChild->getData;
210 $net_channel =
211 $this_network->getElementsByTagName('channel')
212 ->[0]->getFirstChild->getData;
213 $net_maxrate =
214 $this_network->getElementsByTagName('maxrate')
215 ->[0]->getFirstChild->getData;
216 $net_packets_LLC =
217 $this_network->getElementsByTagName('LLC')->[0]->getFirstChild->getData;
218 $net_packets_data =
219 $this_network->getElementsByTagName('data')->[0]->getFirstChild->getData;
220 $net_packets_crypt =
221 $this_network->getElementsByTagName('crypt')->[0]->getFirstChild->getData;
222 $net_packets_weak =
223 $this_network->getElementsByTagName('weak')->[0]->getFirstChild->getData;
224 $net_packets_total =
225 $this_network->getElementsByTagName('total')->[0]->getFirstChild->getData;
226 
227 $total_packets += $net_packets_total;
228 
229 if ( $temp = $this_network->getElementsByTagName('datasize')->[0] ) {
230 $net_datasize =
231 $this_network->getElementsByTagName('datasize')
232 ->[0]->getFirstChild->getData;
233 }
234 else {
235 $net_datasize = "NA";
236 }
237 
238 if ( $temp = $this_network->getElementsByTagName('min-lat')->[0] ) {
239 $net_gps_min_lat =
240 $this_network->getElementsByTagName('min-lat')
241 ->[0]->getFirstChild->getData;
242 $net_gps_min_lon =
243 $this_network->getElementsByTagName('min-lon')
244 ->[0]->getFirstChild->getData;
245 $net_gps_min_alt =
246 $this_network->getElementsByTagName('min-alt')
247 ->[0]->getFirstChild->getData;
248 $net_gps_min_spd =
249 $this_network->getElementsByTagName('min-spd')
250 ->[0]->getFirstChild->getData;
251 $net_gps_max_lat =
252 $this_network->getElementsByTagName('max-lat')
253 ->[0]->getFirstChild->getData;
254 $net_gps_max_lon =
255 $this_network->getElementsByTagName('max-lon')
256 ->[0]->getFirstChild->getData;
257 $net_gps_max_alt =
258 $this_network->getElementsByTagName('max-alt')
259 ->[0]->getFirstChild->getData;
260 $net_gps_max_spd =
261 $this_network->getElementsByTagName('max-spd')
262 ->[0]->getFirstChild->getData;
263 $net_gps_med_lon = ( ( $net_gps_min_lon + $net_gps_max_lon ) / 2 );
264 $net_gps_med_lat = ( ( $net_gps_min_lat + $net_gps_max_lat ) / 2 );
265 $net_gps_aprox_map1 =
266"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";
267 $net_gps_aprox_map2 =
268"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";
269 $net_gps_aprox_map3 =
270"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";
271 $net_gps_aprox_map4 =
272"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";
273 $net_gps_aprox_map5 =
274"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";
275 $net_gps_aprox_map_avilable =
276"(+) <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> (-)";
277 }
278 else {
279 $net_gps_min_lat = "NA";
280 $net_gps_min_lon = "NA";
281 $net_gps_min_alt = "NA";
282 $net_gps_min_spd = "NA";
283 $net_gps_max_lat = "NA";
284 $net_gps_max_lon = "NA";
285 $net_gps_max_alt = "NA";
286 $net_gps_max_spd = "NA";
287 $net_gps_aprox_map = "NA";
288 $net_gps_aprox_map_avilable = "NA";
289 }
290 
291 if ( $temp = $this_network->getElementsByTagName('ip-range')->[0] ) {
292 $net_ip_range =
293 $this_network->getElementsByTagName('ip-range')
294 ->[0]->getFirstChild->getData;
295 @net_ip_parts = $this_network->getElementsByTagName('ip-address');
296 foreach $this_ip (@net_ip_parts) {
297 $net_ip_type = $this_ip->getAttribute('type');
298 }
299 }
300 else {
301 $net_ip_range = "NA";
302 $net_ip_type = "NA";
303 }
304 
305 
306 $net_link = "$file" . "-kismet-log-view-" . "$net_number" . "-info.html";
307 
308 $net_clients_total = @net_clients;
309 
310 if ("$net_clients_total" eq "0") {
311 $net_clients_total = "$no_clients_char";
312 }
313 
314 $net_clients_link =
315 "$file" . "-kismet-log-view-" . "$net_number" . "-clients.html";
316 
317 $net_type = substr( $net_type, 0, 2 );
318 if ( "$net_type" eq "in" ) { $net_type = "AP"; }
319 
320 if ( "$net_wep" eq "true" ) { $net_wep = "Y"; $total_wep++; }
321 else { $net_wep = "N"; }
322 
323 if ( "$net_cloaked" eq "true" ) { $net_cloaked = "Y"; }
324 else { $net_cloaked = "N"; }
325 
326 $net_first =~ s/ / /g;
327 $net_last =~ s/ / /g;
328 
329 @first_parts = split ( / /, $net_first );
330 
331 @last_parts = split ( / /, $net_last );
332 
333 $net_device_name = "NA";
334 undef $net_device_def;
335 foreach $ap_manuf_line (@ap_manf) {
336 chomp $ap_manuf_line;
337 @ap_manuf_line_parts = split ( /\t/, $ap_manuf_line );
338 if ( $net_bssid =~ /$ap_manuf_line_parts[0]/ ) {
339 $net_device_name =
340 "$ap_manuf_line_parts[1] $ap_manuf_line_parts[2]";
341 
342 if ("$net_channel" eq "$ap_manuf_line_parts[4]") {
343 
344 if ("$net_ssid" eq "$ap_manuf_line_parts[3]") {
345 $net_device_def = 1;
346 }
347 
348 if ("$net_ip_range" eq "NA") {
349 $net_ip_range .= " ($ap_manuf_line_parts[5])";
350 } else {
351 $net_ip_range = "$net_ip_range ($ap_manuf_line_parts[5])";
352 }
353 }
354 
355 }
356 }
357 
358 if ( $net_number % 2 == 0 ) {
359 print HTML_OUT "<tr>";
360 }
361 else {
362 print HTML_OUT "<tr bgcolor=\"#FFFFFF\">";
363 }
364 
365 if ($snort_ok) {
366 undef $this_net_snort;
367 $mod_bssid = $net_bssid;
368 $mod_bssid =~ s/://g;
369 if ( $network_packets{"$mod_bssid"} ) {
370 print "KLV: Extracting Snort Data for $net_ssid ...\n";
371 &gen_snort($mod_bssid);
372 $this_net_snort = 1;
373 }
374 }
375 
376 
377undef $flags;
378 if ($net_device_cloaked) {
379 $flags .= "C";
380 $total_factory_defaults++;
381 }
382 if ($net_device_def) {
383 $flags .= "F";
384 $total_factory_defaults++;
385 }
386 if ($this_net_snort) {
387 $flags .= "<a href=\"$net_snort_link\">D</a>";
388 }
389 
390$net_total_unwep = eval($total_networks - $total_wep);
391$net_percent_wep = eval($total_wep / $total_networks) * 100;
392$net_percent_wep = substr($net_percent_wep,0,4);
393 
394$net_percent_factory_default = eval($total_factory_defaults / $total_networks) * 100;
395$net_percent_factory_default = substr($net_percent_factory_default,0,4);
396 
397$net_percent_cloaked = eval($total_cloaked / $total_networks) * 100;
398$net_percent_cloaked = substr($net_percent_cloaked,0,4);
399 
400 
401 print HTML_OUT <<EOM;
402<td width="20"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_number$flags</font></div></td>
403<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>
404<td width="25"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_type</font></div></td>
405<td width="20"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_wep</font></div></td>
406<td width="20"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_channel</font></div></td>
407<td width="50"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_total</font></div></td>
408<td width="75"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_device_name<br>$net_bssid</font></div></td>
409EOM
410 
411 if ($net_clients_total > 0) {
412 print HTML_OUT <<EOM;
413<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>
414EOM
415 }
416 else {
417 print HTML_OUT <<EOM;
418<td width="50"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_clients_total</font></div></td>
419EOM
420 }
421 
422 print HTML_OUT <<EOM;
423<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>
424<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>
425</tr>
426EOM
427 
428 print "KLV: Generating details for network #$net_number ($net_ssid) ...\n";
429 
430 open( HTML_NET_OUT, ">$net_link" );
431 
432 print HTML_NET_OUT <<EOM;
433<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
434<html>
435<head>
436<title>Kismet Log Viewer 1.0 - By Brian Foy Jr. </title>
437<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
438</head>
439<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
440<table width="760" border="0" align="center" cellpadding="5" cellspacing="1">
441 <tr>
442 <td width="30%"><a href="$html_out_file"><img src="$logo_location" width="214" height="77" border="0"></a></td>
443 <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>
444 </tr>
445</table>
446<table width="760" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#efefef">
447 <tr bgcolor="#cecece">
448 <td width="200">
449 <div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_ssid</font></div></td>
450 <td width="540">
451 <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Type: $net_device_name ($net_bssid)</font></div></td>
452 </tr>
453<tr bgcolor="#FFFFFF">
454<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Net</font></div></td>
455<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_number</font></div></td>
456</tr>
457<tr>
458<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Type</font></div></td>
459<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_type</font></div></td>
460</tr>
461<tr bgcolor="#FFFFFF">
462<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Wep</font></div></td>
463<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_wep</font></div></td>
464</tr>
465<tr>
466<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Cloaked</font></div></td>
467<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_cloaked</font></div></td>
468</tr>
469<tr bgcolor="#FFFFFF">
470<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Carrier</font></div></td>
471<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_carrier</font></div></td>
472</tr>
473<tr>
474<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">First Seen</font></div></td>
475<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_first</font></div></td>
476</tr>
477<tr bgcolor="#FFFFFF">
478<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Last Seen</font></div></td>
479<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_last</font></div></td>
480</tr>
481<tr>
482<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Channel</font></div></td>
483<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_channel</font></div></td>
484</tr>
485<tr bgcolor="#FFFFFF">
486<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Maxrate</font></div></td>
487<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_maxrate</font></div></td>
488</tr>
489<tr>
490<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (LLC)</font></div></td>
491<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_LLC</font></div></td>
492</tr>
493<tr bgcolor="#FFFFFF">
494<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (data)</font></div></td>
495<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_data</font></div></td>
496</tr>
497<tr>
498<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (crypt)</font></div></td>
499<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_crypt</font></div></td>
500</tr>
501<tr bgcolor="#FFFFFF">
502<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (weak)</font></div></td>
503<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_weak</font></div></td>
504</tr>
505<tr>
506<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (total)</font></div></td>
507<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_total</font></div></td>
508</tr>
509<tr bgcolor="#FFFFFF">
510<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Datasize</font></div></td>
511<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_datasize</font></div></td>
512</tr>
513EOM
514 
515 if ($net_clients_total > 0) {
516 print HTML_NET_OUT <<EOM;
517<tr>
518<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Clients</font></div></td>
519<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>
520</tr>
521EOM
522 } else {
523 print HTML_NET_OUT <<EOM;
524<tr>
525<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Clients</font></div></td>
526<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_clients_total</font></div></td>
527</tr>
528EOM
529}
530 
531 print HTML_NET_OUT <<EOM;
532<tr bgcolor="#FFFFFF">
533<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Lat</font></div></td>
534<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_min_lat</font></div></td>
535</tr>
536<tr>
537<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Lon</font></div></td>
538<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_min_lon</font></div></td>
539</tr>
540<tr bgcolor="#FFFFFF">
541<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Alt</font></div></td>
542<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_min_alt</font></div></td>
543</tr>
544<tr>
545<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Spd</font></div></td>
546<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_min_spd</font></div></td>
547</tr>
548 
549<tr bgcolor="#FFFFFF">
550<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Lat</font></div></td>
551<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_max_lat</font></div></td>
552</tr>
553<tr>
554<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Lon</font></div></td>
555<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_max_lon</font></div></td>
556</tr>
557<tr bgcolor="#FFFFFF">
558<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Alt</font></div></td>
559<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_max_alt</font></div></td>
560</tr>
561<tr>
562<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Spd</font></div></td>
563<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_max_spd</font></div></td>
564</tr>
565<tr bgcolor="#FFFFFF">
566<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">IP Range</font></div></td>
567<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_ip_range</font></div></td>
568</tr>
569<tr>
570<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">IP Type</font></div></td>
571<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_ip_type</font></div></td>
572</tr>
573<tr bgcolor="#FFFFFF">
574<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Map Approx. Location:</font></div></td>
575<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_gps_aprox_map_avilable</font></div></td>
576</tr>
577 
578EOM
579 
580 if ($this_net_snort) {
581 
582 print HTML_NET_OUT <<EOM;
583<tr>
584<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Snort Output:</font></div></td>
585<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>
586</tr>
587EOM
588 
589 }
590 
591 print HTML_NET_OUT <<EOM;
592</table>
593<br>
594<hr align="center" width="680" size="1" noshade>
595<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="javascript:history.back(1)">&lt; back </a></font></div>
596<br>
597<br>
598</body>
599</html>
600EOM
601 close HTML_NET_OUT;
602 
603 
604if (@net_clients) {
605 
606 
607 open( HTML_CLIENT_OUT, ">$net_clients_link" );
608 
609 print HTML_CLIENT_OUT <<EOM;
610<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
611<html>
612<head>
613<title>Kismet Log Viewer 1.0 - By Brian Foy Jr. </title>
614<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
615</head>
616<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
617<table width="760" border="0" align="center" cellpadding="5" cellspacing="1">
618 <tr>
619 <td width="30%"><a href="$html_out_file"><img src="$logo_location" width="214" height="77" border="0"></a></td>
620 <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>
621 </tr>
622</table>
623EOM
624 
625 
626 foreach $this_client (@net_clients) {
627 
628 $client_number = $this_client->getAttribute('number');
629 $client_type = $this_client->getAttribute('type');
630 $client_wep = $this_client->getAttribute('wep');
631 $client_first = $this_client->getAttribute('first-time');
632 $client_last = $this_client->getAttribute('last-time');
633 $client_mac =
634 $this_client->getElementsByTagName('client-mac')
635 ->[0]->getFirstChild->getData;
636 $client_packets_data =
637 $this_client->getElementsByTagName('client-data')
638 ->[0]->getFirstChild->getData;
639 $client_packets_crypt =
640 $this_client->getElementsByTagName('client-crypt')
641 ->[0]->getFirstChild->getData;
642 $client_packets_weak =
643 $this_client->getElementsByTagName('client-weak')
644 ->[0]->getFirstChild->getData;
645 $client_datasize =
646 $this_client->getElementsByTagName('client-datasize')
647 ->[0]->getFirstChild->getData;
648 $client_maxrate =
649 $this_client->getElementsByTagName('client-maxrate')
650 ->[0]->getFirstChild->getData;
651 
652 if ( $temp = $this_client->getElementsByTagName('client-min-lat')->[0] )
653 {
654 $client_gps_min_lat =
655 $this_client->getElementsByTagName('client-min-lat')
656 ->[0]->getFirstChild->getData;
657 $client_gps_min_lon =
658 $this_client->getElementsByTagName('client-min-lon')
659 ->[0]->getFirstChild->getData;
660 $client_gps_min_alt =
661 $this_client->getElementsByTagName('client-min-alt')
662 ->[0]->getFirstChild->getData;
663 $client_gps_min_spd =
664 $this_client->getElementsByTagName('client-min-spd')
665 ->[0]->getFirstChild->getData;
666 $client_gps_max_lat =
667 $this_client->getElementsByTagName('client-max-lat')
668 ->[0]->getFirstChild->getData;
669 $client_gps_max_lon =
670 $this_client->getElementsByTagName('client-max-lon')
671 ->[0]->getFirstChild->getData;
672 $client_gps_max_alt =
673 $this_client->getElementsByTagName('client-max-alt')
674 ->[0]->getFirstChild->getData;
675 $client_gps_max_spd =
676 $this_client->getElementsByTagName('client-max-spd')
677 ->[0]->getFirstChild->getData;
678 }
679 else {
680 $client_gps_min_lat = "NA";
681 $client_gps_min_lon = "NA";
682 $client_gps_min_alt = "NA";
683 $client_gps_min_spd = "NA";
684 $client_gps_max_lat = "NA";
685 $client_gps_max_lon = "NA";
686 $client_gps_max_alt = "NA";
687 $client_gps_max_spd = "NA";
688 }
689 
690 if ( $temp =
691 $this_client->getElementsByTagName('client-ip-address')->[0] )
692 {
693 $client_ip_address =
694 $this_client->getElementsByTagName('client-ip-address')
695 ->[0]->getFirstChild->getData;
696 @client_ip_parts =
697 $this_client->getElementsByTagName('client-ip-address');
698 foreach $this_client_ip (@client_ip_parts) {
699 $client_ip_type = $this_client_ip->getAttribute('type');
700 }
701 }
702 else {
703 $client_ip_address = "NA";
704 $client_ip_type = "NA";
705 }
706 
707 if ( "$client_wep" eq "true" ) { $client_wep = "Y"; }
708 else { $client_wep = "N"; }
709 
710 $client_device_name = "Type: NA";
711 foreach $client_manuf_line (@client_manf) {
712 chomp $client_manuf_line;
713 @client_manuf_line_parts = split ( /\t/, $client_manuf_line );
714 if ( $client_mac =~ /$client_manuf_line_parts[0]/ ) {
715 $client_device_name =
716"Type: $client_manuf_line_parts[1] $client_manuf_line_parts[2]";
717 }
718 }
719 
720 print
721"KLV: Generating details for network #$net_number ($net_ssid) client #$client_number ...\n";
722 
723 print HTML_CLIENT_OUT <<EOM;
724<table width="760" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#efefef">
725 <tr bgcolor="#cecece">
726 <td width="200">
727 <div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Client #$client_number</font></div></td>
728 <td width="540">
729 <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>
730 </tr>
731<tr bgcolor="#FFFFFF">
732<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Type</font></div></td>
733<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_type</font></div></td>
734</tr>
735<tr>
736<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Wep</font></div></td>
737<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_wep</font></div></td>
738</tr>
739<tr bgcolor="#FFFFFF">
740<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">First Seen</font></div></td>
741<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_first</font></div></td>
742</tr>
743<tr>
744<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Last Seen</font></div></td>
745<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_last</font></div></td>
746</tr>
747<tr bgcolor="#FFFFFF">
748<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Mac</font></div></td>
749<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_mac</font></div></td>
750</tr>
751<tr>
752<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (data)</font></div></td>
753<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_packets_data</font></div></td>
754</tr>
755<tr bgcolor="#FFFFFF">
756<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (crypt)</font></div></td>
757<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_packets_crypt</font></div></td>
758</tr>
759<tr>
760<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (weak)</font></div></td>
761<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_packets_weak</font></div></td>
762</tr>
763<tr bgcolor="#FFFFFF">
764<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Packets (total)</font></div></td>
765<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_packets_total</font></div></td>
766</tr>
767<tr>
768<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Datasize</font></div></td>
769<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_datasize</font></div></td>
770</tr>
771<tr bgcolor="#FFFFFF">
772<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Maxrate</font></div></td>
773<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_maxrate</font></div></td>
774 
775<tr>
776<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Lat</font></div></td>
777<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_min_lat</font></div></td>
778</tr>
779<tr bgcolor="#FFFFFF">
780<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Lon</font></div></td>
781<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_min_lon</font></div></td>
782</tr>
783<tr>
784<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Alt</font></div></td>
785<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_min_alt</font></div></td>
786</tr>
787<tr bgcolor="#FFFFFF">
788<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Min Spd</font></div></td>
789<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_min_spd</font></div></td>
790</tr>
791 
792<tr>
793<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Lat</font></div></td>
794<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_max_lat</font></div></td>
795</tr>
796<tr bgcolor="#FFFFFF">
797<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Lon</font></div></td>
798<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_max_lon</font></div></td>
799</tr>
800<tr>
801<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Alt</font></div></td>
802<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_max_alt</font></div></td>
803</tr>
804<tr bgcolor="#FFFFFF">
805<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">GPS Max Spd</font></div></td>
806<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_gps_max_spd</font></div></td>
807</tr>
808<tr>
809<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">IP Address</font></div></td>
810<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_ip_address</font></div></td>
811</tr>
812<tr bgcolor="#FFFFFF">
813<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">IP Type</font></div></td>
814<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$client_ip_type</font></div></td>
815</tr>
816 
817</table>
818<br>
819EOM
820 
821 } # end foreach client
822 
823 print HTML_CLIENT_OUT <<EOM;
824</table>
825<br>
826<hr align="center" width="680" size="1" noshade>
827<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="javascript:history.back(1)">&lt; back </a></font></div>
828<br>
829<br>
830</body>
831</html>
832EOM
833 close HTML_CLIENT_OUT;
834 
835} # end of @net_clients
836 
837 
838} # end foreach @networks
839 
840print HTML_OUT <<EOM;
841</table>
842<br>
843<hr align="center" width="680" size="1" noshade>
844 
845<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#a5a5a5">
846Started: $kismet_start_time - Ended: $kismet_end_time<br>
847Log File: $file<br>
848</font></div>
849<br><br>
850<br><br>
851<br><br>
852<br><br>
853<br><br>
854<br><br>
855<br><br>
856<br><br>
857<br><br>
858<br><br>
859<br><br>
860<br><br>
861<br><br>
862<br><br>
863<br><br>
864<br><br>
865<br><br>
866<br><br>
867<br><br>
868</body>
869</html>
870EOM
871close HTML_OUT;
872 
873 
874print "KLV: Generating Stats...\n";
875 
876 open( HTML_STATS_OUT, ">$net_stats_link" );
877 
878 print HTML_STATS_OUT <<EOM;
879<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
880<html>
881<head>
882<title>Kismet Log Viewer 1.0 - By Brian Foy Jr. </title>
883<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
884</head>
885<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
886<table width="760" border="0" align="center" cellpadding="5" cellspacing="1">
887 <tr>
888 <td width="30%"><a href="$html_out_file"><img src="$logo_location" width="214" height="77" border="0"></a></td>
889 <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>
890 </tr>
891</table>
892<table width="760" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#efefef">
893 <tr bgcolor="#cecece">
894 <td width="200">
895 <div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Stats:</font></div></td>
896 <td width="540">
897 <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$file</font></div></td>
898 </tr>
899 
900<tr bgcolor="#FFFFFF">
901<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Started</font></div></td>
902<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$kismet_start_time</font></div></td>
903</tr>
904<tr>
905<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Ended</font></div></td>
906<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$kismet_end_time</font></div></td>
907</tr>
908 
909<tr bgcolor="#FFFFFF">
910<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Kismet Server Ver</font></div></td>
911<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$kismet_ver</font></div></td>
912</tr>
913<tr>
914<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Networks</font></div></td>
915<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_networks</font></div></td>
916</tr>
917<tr bgcolor="#FFFFFF">
918<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Networks with WEP</font></div></td>
919<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_wep</font></div></td>
920</tr>
921<tr>
922<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Networks without WEP</font></div></td>
923<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_total_unwep</font></div></td>
924</tr>
925<tr bgcolor="#FFFFFF">
926<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">% Networks with WEP</font></div></td>
927<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_percent_wep%</font></div></td>
928</tr>
929<tr>
930<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Networks Factory Default</font></div></td>
931<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_factory_defaults</font></div></td>
932</tr>
933<tr bgcolor="#FFFFFF">
934<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">% Networks Factory Default</font></div></td>
935<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_percent_factory_default%</font></div></td>
936</tr>
937<tr>
938<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Cloaked Networks</font></div></td>
939<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_cloaked</font></div></td>
940</tr>
941<tr bgcolor="#FFFFFF">
942<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">% Networks Cloaked</font></div></td>
943<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$net_percent_cloaked%</font></div></td>
944</tr>
945<tr>
946<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Clients</font></div></td>
947<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_clients</font></div></td>
948</tr>
949<tr bgcolor="#FFFFFF">
950<td width="200"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Total Packets</font></div></td>
951<td width="540"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$total_packets</font></div></td>
952</tr>
953 
954</table>
955<br>
956<hr align="center" width="680" size="1" noshade>
957<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="javascript:history.back(1)">&lt; back </a></font></div>
958<br>
959</body>
960</html>
961EOM
962 
963print "KLV: Done!\n";
964exit;
965 
966sub do_snort {
967 
968 $snort_file = $file;
969 $snort_file =~ s/\.xml/\.dump/g;
970 
971 system("snort -vdeCr $snort_file > snort_temp.txt");
972 
973 open( SNORTFILE, "snort_temp.txt" );
974 @all_snort_lines = <SNORTFILE>;
975 close SNORTFILE;
976 unlink("snort_temp.txt");
977 
978 foreach $this_line (@all_snort_lines) {
979 $all_lines_comb .= "$this_line";
980 }
981 
982 @all_snort_line_parts = split (
983/\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+\=\+/,
984 $all_lines_comb
985 );
986 
987 foreach $this_line (@all_snort_line_parts) {
988 
989 undef $this_packets_lines;
990 undef $bssid;
991 
992 @this_packet_lines = split ( /\n/, $this_line );
993 
994 foreach $this_packet_line (@this_packet_lines) {
995 
996 if ( $this_packet_line =~ /Run time for packet processing was/ ) {
997 break;
998 }
999 
1000 if ( $this_packet_line =~ /bssid/ ) {
1001 @this_bssid_parts = split ( / /, $this_packet_line );
1002 $bssid = "$this_bssid_parts[1]";
1003 }
1004 $this_packet_line =~ s/\r/\<br\>/g;
1005 
1006 if ( $this_packet_line =~
1007 /No run mode specified, defaulting to verbose mode/g )
1008 {
1009 $this_packet_line = "<br>";
1010 }
1011 $this_packets_lines .= "$this_packet_line<br>";
1012 }
1013 
1014 if ($bssid) {
1015 
1016 @bssid_parts = split ( /\:/, $bssid );
1017 
1018 undef $this_full_bssid;
1019 
1020 foreach $this_bssid_parts (@bssid_parts) {
1021 
1022 if ( length($this_bssid_parts) < 2 ) {
1023 $this_bssid_parts = "0" . "$this_bssid_parts";
1024 }
1025 
1026 $this_full_bssid .= "$this_bssid_parts";
1027 }
1028 
1029 $network_packets{"$this_full_bssid"} .= "$this_packets_lines";
1030 
1031 }
1032 
1033 }
1034 
1035} # end sub do_snort
1036 
1037sub gen_snort($mod_bssid) {
1038 
1039 $net_snort_link =
1040 "$file" . "-kismet-log-view-" . "$mod_bssid" . "-snort.html";
1041 
1042 open( HTML_SNORT_OUT, ">$net_snort_link" );
1043 
1044 print HTML_SNORT_OUT <<EOM;
1045<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
1046<html>
1047<head>
1048<title>Kismet Log Viewer 1.0 - By Brian Foy Jr. </title>
1049<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
1050</head>
1051<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
1052<table width="760" border="0" align="center" cellpadding="5" cellspacing="1">
1053 <tr>
1054 <td width="30%"><a href="$html_out_file"><img src="$logo_location" width="214" height="77" border="0"></a></td>
1055 <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>
1056 </tr>
1057</table>
1058<table width="760" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#efefef">
1059 <tr bgcolor="#cecece">
1060 <td width="760">
1061 <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>
1062 </tr>
1063<tr bgcolor="#FFFFFF">
1064<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
1065EOM
1066 
1067 print HTML_SNORT_OUT $network_packets{"$mod_bssid"};
1068 
1069 print HTML_SNORT_OUT <<EOM;
1070</font>
1071</td>
1072</tr>
1073</table>
1074<br>
1075</table>
1076<br>
1077<hr align="center" width="680" size="1" noshade>
1078<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="javascript:history.back(1)">&lt; back </a></font></div>
1079<br>
1080<br>
1081</body>
1082</html>
1083EOM
1084 close HTML_SNORT_OUT;
1085 
1086} #end sub gen_snort

Powered by WebSVN 2.2.1