diff options
author | jim-p <jim@pingle.org> | 2009-10-17 15:27:13 -0400 |
---|---|---|
committer | jim-p <jim@pingle.org> | 2009-10-17 15:28:01 -0400 |
commit | e9562289eb7346dc2782e8f2ffe0236878deedc7 (patch) | |
tree | 4b472ca931a4b5c821ad3beb38344f1ff80cad47 | |
parent | b5faf7a8a7e083affce17a7b19755474a1b38cfb (diff) | |
download | pfsense-packages-e9562289eb7346dc2782e8f2ffe0236878deedc7.tar.gz pfsense-packages-e9562289eb7346dc2782e8f2ffe0236878deedc7.tar.bz2 pfsense-packages-e9562289eb7346dc2782e8f2ffe0236878deedc7.zip |
Snort widget updates, courtesy of matrix200
-rw-r--r-- | config/widget-snort/snort_alerts.inc.php | 8 | ||||
-rw-r--r-- | config/widget-snort/snort_alerts.js | 9 | ||||
-rw-r--r-- | config/widget-snort/snort_alerts.widget.php | 14 | ||||
-rw-r--r-- | config/widget-snort/widget-snort.xml | 2 | ||||
-rwxr-xr-x | pkg_config.7.xml | 2 | ||||
-rwxr-xr-x | pkg_config.8.xml | 2 | ||||
-rw-r--r-- | pkg_config.xml | 2 |
7 files changed, 20 insertions, 19 deletions
diff --git a/config/widget-snort/snort_alerts.inc.php b/config/widget-snort/snort_alerts.inc.php index 99e3ee9f..48506f9b 100644 --- a/config/widget-snort/snort_alerts.inc.php +++ b/config/widget-snort/snort_alerts.inc.php @@ -26,7 +26,7 @@ function get_snort_alerts($snort_alerts, $nentries, $tail = 20) { function parse_snort_alert_line($line) { $log_split = ""; - + $datesplit = ""; preg_match("/^(.*)\s+\[\*\*\]\s+\[(\d+\:\d+:\d+)\]\s(.*)\s(.*)\s+\[\*\*\].*\s+\[Priority:\s(\d+)\]\s{(.*)}\s+(.*)\s->\s(.*)$/U", $line, $log_split); list($all, $alert['time'], $alert['rule'], $alert['category'], $alert['descr'], @@ -40,6 +40,10 @@ function parse_snort_alert_line($line) { $usableline = false; if($usableline == true) { + preg_match("/^(\d+)\/(\d+)-(\d+\:\d+\:\d+).\d+$/U", $alert['time'], $datesplit); + $alert['dateonly'] = $datesplit[2] . "/" . $datesplit[1]; + $alert['timeonly'] = $datesplit[3]; + $alert['category'] = strtoupper( substr($alert["category"],0 , 1) ) . strtolower( substr($alert["category"],1 ) ); return $alert; } else { if($g['debug']) { @@ -67,7 +71,7 @@ function handle_snort_ajax($snort_alerts_logfile, $nentries = 5, $tail = 50) { preg_match("/.*([0-9][0-9]:[0-9][0-9]:[0-9][0-9]).*/", $log_row['time'], $time_regex); $row_time = strtotime($time_regex[1]); if($row_time > $lastsawtime) { - $new_rules .= "{$log_row['time']}||{$log_row['priority']}||{$log_row['category']}||{$log_row['src']}||{$log_row['dst']}||" . time() . "||\n"; + $new_rules .= "{$log_row['time']}||{$log_row['priority']}||{$log_row['category']}||{$log_row['src']}||{$log_row['dst']}||" . time() . "||{$log_row['timeonly']}||{$log_row['dateonly']}" . "||\n"; } } echo $new_rules; diff --git a/config/widget-snort/snort_alerts.js b/config/widget-snort/snort_alerts.js index 48c97d6c..2eebb140 100644 --- a/config/widget-snort/snort_alerts.js +++ b/config/widget-snort/snort_alerts.js @@ -72,10 +72,9 @@ function snort_alerts_fetch_new_rules_callback(callback_data) { /* loop through rows */ row_split = data_split[x].split("||"); var line = ''; - line = '<td width="5%" class="listr">' + row_split[1] + '</td>'; - line += '<td width="5%" class="listr">' + row_split[2] + '</td>'; - line += '<td width="45%" class="listr">' + row_split[3] + '</td>'; - line += '<td width="45%" class="listr">' + row_split[4] + '</td>'; + line = '<td width="30%" class="listr" >' + row_split[6] + '<br>' + row_split[7]+ '</td>'; + line += '<td width="40%" class="listr" >' + row_split[3] + '<br>' + row_split[4] + '</td>'; + line += '<td width="40%" class="listr" >' + 'Pri : ' + row_split[1] + '<br>' + 'Cat : ' + row_split[2] + '</td>'; snortlastsawtime = row_split[5]; new_data_to_add[new_data_to_add.length] = line; } @@ -142,4 +141,4 @@ function snort_alerts_toggle_pause() { } } /* start local AJAX engine */ -snorttimer = setInterval('snort_alerts_fetch_new_rules()', snortupdateDelay); +snorttimer = setInterval('snort_alerts_fetch_new_rules()', snortupdateDelay);
\ No newline at end of file diff --git a/config/widget-snort/snort_alerts.widget.php b/config/widget-snort/snort_alerts.widget.php index 22bd1b69..aa416274 100644 --- a/config/widget-snort/snort_alerts.widget.php +++ b/config/widget-snort/snort_alerts.widget.php @@ -30,10 +30,9 @@ global $config, $g; <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody> <tr class="snort-alert-header"> - <td width="5%" class="widgetsubheader">Pri</td> - <td width="5%" class="widgetsubheader">Category</td> - <td width="45%" class="widgetsubheader">Src</td> - <td width="45%" class="widgetsubheader">Dst</td> + <td width="30%" class="widgetsubheader" >Date</td> + <td width="40%" class="widgetsubheader">Src/Dst</td> + <td width="40%" class="widgetsubheader">Details</td> </tr> <?php $counter=0; foreach ($snort_alerts as $alert) { ?> @@ -56,10 +55,9 @@ global $config, $g; ?> <tr class="snort-alert-entry" <?php echo $activerow; ?>> - <td width="5%" class="listr"><?= $alert["priority"] ?></td> - <td width="5%" class="listr"><?= $alert["category"] ?></td> - <td width="45%" class="listr"><?= $alert["src"] ?></td> - <td width="45%" class="listr"><?= $alert["dst"] ?></td> + <td width="30%" class="listr"><?= $alert['timeonly'] . ' ' . $alert['dateonly'] ?></td> + <td width="40%" class="listr"><?= $alert["src"] . '<br>' . $alert["dst"] ?></td> + <td width="40%" class="listr"><?= 'Pri : ' . $alert["priority"] . '<br>' . 'Cat : ' . $alert['category'] ?></td> </tr> <?php $counter++; } ?> diff --git a/config/widget-snort/widget-snort.xml b/config/widget-snort/widget-snort.xml index b32a27d7..1644181c 100644 --- a/config/widget-snort/widget-snort.xml +++ b/config/widget-snort/widget-snort.xml @@ -46,7 +46,7 @@ <requirements>Dashboard package and Snort</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>widget-snort</name> - <version>0.1</version> + <version>0.2</version> <title>Widget - Snort</title> <include_file>/usr/local/pkg/widget-snort.inc</include_file> <additional_files_needed> diff --git a/pkg_config.7.xml b/pkg_config.7.xml index 0a217750..f2d24221 100755 --- a/pkg_config.7.xml +++ b/pkg_config.7.xml @@ -132,7 +132,7 @@ <descr>Dashboard widget for Snort.</descr> <category>System</category> <config_file>http://www.pfsense.com/packages/config/widget-snort/widget-snort.xml</config_file> - <version>0.1</version> + <version>0.2</version> <status>BETA</status> <required_version>1.2</required_version> <configurationfile>widget-snort.xml</configurationfile> diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 70d01e7d..0b48267f 100755 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -756,7 +756,7 @@ <descr>Dashboard widget for Snort.</descr> <category>System</category> <config_file>http://www.pfsense.com/packages/config/widget-snort/widget-snort.xml</config_file> - <version>0.1</version> + <version>0.2</version> <status>BETA</status> <required_version>1.2</required_version> <configurationfile>widget-snort.xml</configurationfile> diff --git a/pkg_config.xml b/pkg_config.xml index 1ebb3da3..e1773ca6 100644 --- a/pkg_config.xml +++ b/pkg_config.xml @@ -99,7 +99,7 @@ <descr>Dashboard widget for Snort.</descr> <category>System</category> <config_file>http://www.pfsense.com/packages/config/widget-snort/widget-snort.xml</config_file> - <version>0.1</version> + <version>0.2</version> <status>BETA</status> <required_version>1.2</required_version> <configurationfile>widget-snort.xml</configurationfile> |