diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2009-02-09 18:56:25 -0500 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2009-02-09 18:56:25 -0500 |
commit | 3b7742e0884ab95302a5028f5cd9baa4f965e8cb (patch) | |
tree | 2154940713c1316e22e1f782050751f13f669f4c /config | |
parent | ddad7f5298ff4293df10908c1833422f8e92eec7 (diff) | |
download | pfsense-packages-3b7742e0884ab95302a5028f5cd9baa4f965e8cb.tar.gz pfsense-packages-3b7742e0884ab95302a5028f5cd9baa4f965e8cb.tar.bz2 pfsense-packages-3b7742e0884ab95302a5028f5cd9baa4f965e8cb.zip |
Update URL
Diffstat (limited to 'config')
-rw-r--r-- | config/snort/snort.inc | 3 | ||||
-rw-r--r-- | config/snort/snort_check_for_rule_updates.php | 26 | ||||
-rw-r--r-- | config/snort/snort_download_rules.php | 39 |
3 files changed, 56 insertions, 12 deletions
diff --git a/config/snort/snort.inc b/config/snort/snort.inc index 70dc31bf..d8826ea9 100644 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -631,7 +631,8 @@ function extract_snort_rules_md5($tmpfname) { $static_output = gettext("Extracting snort rules..."); update_all_status($static_output); } - $cmd = "/usr/bin/tar xzf {$tmpfname}/{$snort_filename} -C /usr/local/etc/snort/"; + mkdir("/usr/local/etc/snort/rules/"); + $cmd = "/usr/bin/tar xzf {$tmpfname}/{$snort_filename} -C /usr/local/etc/snort/rules/"; /* extract item and show status during extraction */ $handle = popen('$cmd 2>&1', 'r'); while(!feof($handle)) { diff --git a/config/snort/snort_check_for_rule_updates.php b/config/snort/snort_check_for_rule_updates.php index 92f32900..90df3bc7 100644 --- a/config/snort/snort_check_for_rule_updates.php +++ b/config/snort/snort_check_for_rule_updates.php @@ -66,12 +66,26 @@ if($date1ts > $date2ts or !$last_ruleset_download) { exit; } echo "Downloading snort rule updates..."; - /* setup some variables */ - $snort_filename = "snortrules-snapshot-CURRENT.tar.gz"; - $snort_filename_md5 = "snortrules-snapshot-CURRENT.tar.gz.md5"; - ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0)'); - $dl = "http://www.snort.org/pub-bin/oinkmaster.cgi/{$oinkid}/{$snort_filename}"; - $dl_md5 = "http://www.snort.org/pub-bin/oinkmaster.cgi/{$oinkid}/{$snort_filename_md5}"; + /* setup some variables */ + $premium_subscriber = ""; + + /* Snort version */ + $snort_version = "2.8"; + + /* Are we using the premium subscriber subscription? */ + if($config['installedpackages']['snortadvanced']['config'][0]['subscriber']) { + // http://www.snort.org/pub-bin/downloads.cgi/Download/sub_rules/snortrules-snapshot-CURRENT_s.tar.gz.md5 + $premium_subscriber = "_s"; + $snort_download_prefix = "http://www.snort.org/pub-bin/oinkmaster.cgi"; + } else { + // http://www.snort.org/pub-bin/downloads.cgi/Download/vrt_os/snortrules-snapshot-CURRENT.tar.gz.md5 + $premium_subscriber = ""; + $snort_download_prefix = "http://www.snort.org/pub-bin/oinkmaster.cgi"; + } + + /* Set snort rules download filename */ + $snort_filename = "snortrules-snapshot-{$snort_version}{$premium_subscriber}.tar.gz"; + $snort_filename_md5 = "snortrules-snapshot-{$snort_version}{$premium_subscriber}.tar.gz.md5"; /* multi user system, request new filename and create directory */ $tmpfname = tempnam("/tmp", "snortRules"); diff --git a/config/snort/snort_download_rules.php b/config/snort/snort_download_rules.php index 7866bad0..caeb92aa 100644 --- a/config/snort/snort_download_rules.php +++ b/config/snort/snort_download_rules.php @@ -212,15 +212,21 @@ $tmpfname = tempnam("/tmp", "snortRules"); exec("/bin/rm -rf {$tmpfname};/bin/mkdir -p {$tmpfname}"); /* download snort rules */ -$static_output = gettext("Downloading current snort rules... {$dl}"); +$static_output = gettext("Downloading current snort rules... "); + +/* Set URL we are downloading in bottom textarea and + * download snort rules + */ update_all_status($static_output); -download_file_with_progress_bar($dl, $tmpfname . "/{$snort_filename}"); +update_output_window("{$dl}"); +download_file_with_progress_bar($dl, $tmpfname . "/{$snort_filename}", "read_body_snort"); verify_downloaded_file($tmpfname . "/{$snort_filename}"); /* download snort rules md5 file */ -$static_output = gettext("Downloading current snort rules md5... {$dl_md5}"); +$static_output = gettext("Downloading current snort rules md5... "); update_all_status($static_output); -download_file_with_progress_bar($dl_md5, $tmpfname . "/{$snort_filename_md5}"); +update_output_window("{$dl_md5}"); +download_file_with_progress_bar($dl_md5, $tmpfname . "/{$snort_filename_md5}", "read_body_snort");); verify_downloaded_file($tmpfname . "/{$snort_filename_md5}"); /* verify downloaded rules signature */ @@ -256,6 +262,29 @@ hide_progress_bar_status(); <?php - +function read_body_snort($ch, $string) { + global $fout, $file_size, $downloaded, $counter, $version, $latest_version, $current_installed_pfsense_version; + $length = strlen($string); + $downloaded += intval($length); + $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); + $downloadProgress = 100 - $downloadProgress; + $a = $file_size; + $b = $downloaded; + $c = $downloadProgress; + $text = " Snort download in progress\\n"; + $text .= "----------------------------------------------------\\n"; + $text .= " File size : {$a}\\n"; + $text .= " Downloaded : {$b}\\n"; + $text .= " Percent : {$c}%\\n"; + $text .= "----------------------------------------------------\\n"; + $counter++; + if($counter > 150) { + update_output_window($text); + update_progress_bar($downloadProgress); + $counter = 0; + } + fwrite($fout, $string); + return $length; +} ?>
\ No newline at end of file |