diff options
author | Perry Mason <crazypark2@yahoo.dk> | 2009-02-10 01:04:08 +0100 |
---|---|---|
committer | Perry Mason <crazypark2@yahoo.dk> | 2009-02-10 01:04:08 +0100 |
commit | db532a42bb4450b98cb6e1049aa9b26852ad9cc8 (patch) | |
tree | 271c90302ba4d02904a9f4da5b1ae82beb8c77f6 /config/snort/snort_download_rules.php | |
parent | fbc60ffbeccaf89792a6dd5e71dd533e7764735f (diff) | |
parent | 3b7742e0884ab95302a5028f5cd9baa4f965e8cb (diff) | |
download | pfsense-packages-db532a42bb4450b98cb6e1049aa9b26852ad9cc8.tar.gz pfsense-packages-db532a42bb4450b98cb6e1049aa9b26852ad9cc8.tar.bz2 pfsense-packages-db532a42bb4450b98cb6e1049aa9b26852ad9cc8.zip |
Merge branch 'master' of http://gitweb.pfsense.org/pfsense-packages/mainline
Diffstat (limited to 'config/snort/snort_download_rules.php')
-rw-r--r-- | config/snort/snort_download_rules.php | 39 |
1 files changed, 34 insertions, 5 deletions
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 |