Attached Files | ssid_report.patch [^] (10,125 bytes) 2011-03-22 16:07 [Show Content] [Hide Content]#
# old_revision [a1e9c333ea01ba1740a775e263ee586a43f5eddb]
#
# patch "pf/conf/ui.conf"
# from [754db03e72d1019e16845c586f054e35187dd7a0]
# to [308534764b9b3a00558e19cb30357886b6867fb3]
#
# patch "pf/html/admin/status/grapher.php"
# from [18dfe328514b21827c4df9823d3ba5f4bd55765c]
# to [e14e400bb20b4f28b84a6de1baa1d4610cc4118a]
#
# patch "pf/html/admin/status/reports.php"
# from [309cdd669c4d812d7c838399ca1757caf86ace4e]
# to [1422c16764e61aba8b31eb978a5681fdc227fa13]
#
# patch "pf/lib/pf/pfcmd/help.pm"
# from [b7dc1a244925947cb1373019a079d5728f5351ee]
# to [4a8dff6065b6b2d7cc1238440dc15a7a0a25c484]
#
# patch "pf/lib/pf/pfcmd/report.pm"
# from [bf061b52bc7bd0bbdb4fad9326607268836b96df]
# to [e63b3db9c04264fc1c9907029c897c1c2e4b4119]
#
# patch "pf/lib/pf/pfcmd.pm"
# from [a6fc36f5ea1e6021125213ae8dbaa3ef59b9a2a3]
# to [df7a772cdc6673efdc6ce8487363dc40ab8b5b23]
#
============================================================
--- pf/conf/ui.conf 754db03e72d1019e16845c586f054e35187dd7a0
+++ pf/conf/ui.conf 308534764b9b3a00558e19cb30357886b6867fb3
@@ -44,7 +44,7 @@ networks=Networks
networks=Networks
[ui.status.reports]
-display=ipmachistory,locationhistoryswitch,locationhistorymac,ifoctetshistoryswitch,ifoctetshistorymac,ifoctetshistoryuser,active,inactive,registered,unregistered,os,osclass,unknownprints,openviolations,statics
+display=ipmachistory,locationhistoryswitch,locationhistorymac,ifoctetshistoryswitch,ifoctetshistorymac,ifoctetshistoryuser,active,inactive,registered,unregistered,os,osclass,unknownprints,openviolations,statics,ssid
ipmachistory=IP - MAC History
locationhistoryswitch=Location History (switch)
locationhistorymac=Location History (MAC)
@@ -60,6 +60,7 @@ statics=Probable Static IPs
unknownprints=Unknown Fingerprints
openviolations=Open Violations
statics=Probable Static IPs
+ssid=SSID
[ui.scan]
display=scan, results
@@ -612,6 +613,13 @@ command=report statics
connection_type=Type of connection
command=report statics
+[ui.status.reports.ssid]
+display=ssid,percent,connections
+ssid=SSID
+percent=Percent
+connections=Connections
+command=report ssid
+
[ui.scan.scan]
display=id,date,hosts,tid
id=Scan ID
============================================================
--- pf/html/admin/status/grapher.php 18dfe328514b21827c4df9823d3ba5f4bd55765c
+++ pf/html/admin/status/grapher.php e14e400bb20b4f28b84a6de1baa1d4610cc4118a
@@ -55,7 +55,10 @@
'bar' => 'bar',
'ifoctetshistorymac' => 'stacked_without_fill',
'ifoctetshistoryswitch' => 'stacked_without_fill',
- 'ifoctetshistoryuser' => 'stacked_without_fill');
+ 'ifoctetshistoryuser' => 'stacked_without_fill',
+ 'ssid' => 'pie',
+ 'ssid active' => 'pie',
+ 'ssid all' => 'pie');
if (($type == 'ifoctetshistoryuser')||($type == 'ifoctetshistorymac')) {
$chart_data = get_chart_data("graph $type {$_GET['pid']} start_time={$_GET['start_time']},end_time=${_GET['end_time']}");
@@ -134,10 +137,15 @@
if($type == 'pie'){
$graph = new PieGraph($width, $height, "auto");
- $title=pretty_header('status-reports', 'osclass').' distribution';
+ # we extract the first portion of the graph type to go and fetch it's pretty header for the graph's title
+ if (preg_match("/^(\w+).*$/", $_GET['type'], $match)) {
+ $title=pretty_header('status-reports', $match[1]) .' distribution';
+ } else {
+ $title=pretty_header('status-reports', $_GET['type']).' distribution';
+ }
}
-
+
$graph->title->Set(ucwords($title));
if($subtitle != 'Per Report'){
$graph->subtitle->Set($subtitle);
============================================================
--- pf/html/admin/status/reports.php 309cdd669c4d812d7c838399ca1757caf86ace4e
+++ pf/html/admin/status/reports.php 1422c16764e61aba8b31eb978a5681fdc227fa13
@@ -31,7 +31,7 @@
include_once('../header.php');
- $active_available = array('registered', 'unregistered', 'os', 'osclass', 'unknownprints', 'openviolations', 'statics');
+ $active_available = array('registered', 'unregistered', 'os', 'osclass', 'unknownprints', 'openviolations', 'statics', 'ssid');
$type = set_default($_REQUEST['type'], 'ipmachistory');
$subtype = set_default($_GET['subtype'], '');
============================================================
--- pf/lib/pf/pfcmd/help.pm b7dc1a244925947cb1373019a079d5728f5351ee
+++ pf/lib/pf/pfcmd/help.pm 4a8dff6065b6b2d7cc1238440dc15a7a0a25c484
@@ -296,7 +296,7 @@ sub help_report {
sub help_report {
print STDERR << "EOT";
-Usage: pfcmd report <active|inactive> | <registered|unregistered|os|osclass|unknownprints|openviolations|statics> [all|active]
+Usage: pfcmd report <active|inactive> | <registered|unregistered|os|osclass|unknownprints|openviolations|statics|ssid> [all|active]
display canned reports - "active" modifier shows only nodes with open iplog entries
@@ -309,6 +309,7 @@ statics | show probable static IP
unknownprints | show DHCP fingerprints without a known OS mapping
openviolations | show all open violations
statics | show probable static IPs
+ssid | show user connections by SSID
EOT
return 1;
}
============================================================
--- pf/lib/pf/pfcmd/report.pm bf061b52bc7bd0bbdb4fad9326607268836b96df
+++ pf/lib/pf/pfcmd/report.pm e63b3db9c04264fc1c9907029c897c1c2e4b4119
@@ -42,6 +42,8 @@ BEGIN {
report_registered_active
report_openviolations_all
report_openviolations_active
+ report_ssid_all
+ report_ssid_active
report_statics_all
report_statics_active
report_unknownprints_all
@@ -119,6 +121,12 @@ sub report_db_prepare {
$report_statements->{'report_openviolations_active_sql'} = get_db_handle()->prepare(
qq [SELECT n.pid as owner, n.mac as mac, v.status as status, v.start_date as start_date, c.description as violation from (violation v, iplog i) LEFT JOIN node n ON v.mac=n.mac LEFT JOIN class c on c.vid=v.vid WHERE v.status="open" and n.mac=i.mac and (i.end_time=0 or i.end_time > now()) order by n.pid ]);
+ $report_statements->{'report_ssid_all_sql'} = get_db_handle()->prepare(
+ qq [SELECT ssid,count(*) as connections,ROUND(COUNT(*)/(SELECT COUNT(*) from locationlog INNER JOIN node ON node.mac=locationlog.mac WHERE ssid != "")*100,1) as percent from locationlog INNER JOIN node ON node.mac=locationlog.mac WHERE ssid != "" GROUP BY ssid ORDER BY connections]);
+
+ $report_statements->{'report_ssid_active_sql'} = get_db_handle()->prepare(
+ qq [SELECT ssid,count(*) as connections,ROUND(COUNT(*)/(SELECT COUNT(*) from locationlog INNER JOIN node ON node.mac=locationlog.mac INNER JOIN iplog ON node.mac=iplog.mac WHERE ssid != "" AND (iplog.end_time=0 OR iplog.end_time > now()))*100,1) as percent from locationlog INNER JOIN node ON node.mac=locationlog.mac INNER JOIN iplog ON node.mac=iplog.mac WHERE ssid != "" AND (iplog.end_time=0 OR iplog.end_time > now()) GROUP BY ssid ORDER BY connections]);
+
$report_db_prepared = 1;
return 1;
}
@@ -327,6 +335,52 @@ sub report_unknownprints_active {
return (@data);
}
+=item * report_ssid_all
+
+Reporting - Connections by SSID for all nodes regardless of the status
+
+=cut
+sub report_ssid_all {
+ my @data = db_data(REPORT, $report_statements, 'report_ssid_all_sql');
+ my $total = 0;
+ my @return_data;
+
+ foreach my $record (@data) {
+ $total += $record->{'connections'};
+
+ if ( $record->{'connections'} > 0 ) {
+ push @return_data, $record;
+ }
+
+ }
+
+ push @return_data, { ssid => "Total", percent => "100", connections => $total };
+ return (@return_data);
+}
+
+=item * report_ssid_active
+
+Reporting - Connections by SSID for all active nodes (reg/unreg)
+
+=cut
+sub report_ssid_active {
+ my @data = db_data(REPORT, $report_statements, 'report_ssid_active_sql');
+ my $total = 0;
+ my @return_data;
+
+ foreach my $record (@data) {
+ $total += $record->{'connections'};
+
+ if ( $record->{'connections'} > 0 ) {
+ push @return_data, $record;
+ }
+
+ }
+
+ push @return_data, { ssid => "Total", percent => "100", connections => $total };
+ return (@return_data);
+}
+
=item * translate_connection_type
Translates connection_type database string into a human-understandable string
@@ -369,13 +423,15 @@ Olivier Bilodeau <obilodeau@inverse.ca>
Olivier Bilodeau <obilodeau@inverse.ca>
+Francois Gaudreault <fgaudreault@inverse.ca>
+
=head1 COPYRIGHT
Copyright (C) 2005 David LaPorte
Copyright (C) 2005 Kevin Amorin
-Copyright (C) 2010 Inverse inc.
+Copyright (C) 2010 - 2011 Inverse inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
============================================================
--- pf/lib/pf/pfcmd.pm a6fc36f5ea1e6021125213ae8dbaa3ef59b9a2a3
+++ pf/lib/pf/pfcmd.pm df7a772cdc6673efdc6ce8487363dc40ab8b5b23
@@ -252,12 +252,12 @@ sub parseCommandLine {
'report' => qr{ ^ (?: #for grouping only
( active | inactive | openviolations
| os | osclass | registered | statics
- | unknownprints | unregistered )
+ | unknownprints | unregistered | ssid )
|
(?: #for grouping only
( openviolations | os | osclass
| registered | statics
- | unknownprints | unregistered
+ | unknownprints | unregistered | ssid
)
\s+
( all | active )
|