"; ?>
/images/misc/progress_bar.gif' width='280' height='23' name='progressbar' id='progressbar' alt='' />

You last checked for updates: {$last_md5_download}

\n"; echo "\n

You last installed for rules: {$last_rules_install}

\n"; echo "\n\n\n\n"; exit(0); } /* Check if were up to date */ if (file_exists("{$snortdir}/snortrules-snapshot-2.8.tar.gz.md5")){ $md5_check_new_parse = file_get_contents("{$tmpfname}/{$snort_filename_md5}"); $md5_check_new = `/bin/echo "{$md5_check_new_parse}" | /usr/bin/awk '{ print $4 }'`; $md5_check_old_parse = file_get_contents("{$snortdir}/{$snort_filename_md5}"); $md5_check_old = `/bin/echo "{$md5_check_old_parse}" | /usr/bin/awk '{ print $4 }'`; /* Write out time of last sucsessful md5 to cache */ $config['installedpackages']['snort']['last_md5_download'] = date("Y-M-jS-h:i-A"); write_config(); if ($md5_check_new == $md5_check_old) { update_status(gettext("Your rules are up to date...")); update_output_window(gettext("You may start Snort now, check update.")); hide_progress_bar_status(); /* Timestamps to html */ echo "\n

You last checked for updates: {$last_md5_download}

\n"; echo "\n

You last installed for rules: {$last_rules_install}

\n"; // echo "P is this code {$premium_subscriber}"; echo "\n\n\n\n"; exit(0); } } /* "You are Not Up to date */; update_status(gettext("You are NOT up to date...")); /* download snortrules file */ if (file_exists("{$tmpfname}/{$snort_filename}")) { update_status(gettext("Snortrule tar file exists...")); } else { update_status(gettext("There is a new set of Snort rules posted. Downloading...")); update_output_window(gettext("May take 4 to 10 min...")); // download_file_with_progress_bar("http://www.mtest.local/pub-bin/oinkmaster.cgi/{$oinkid}/snortrules-snapshot-2.8{$premium_subscriber}.tar.gz", $tmpfname . "/{$snort_filename}", "read_body_firmware"); download_file_with_progress_bar("http://dl.snort.org/{$premium_url}/snortrules-snapshot-2.8{$premium_subscriber}.tar.gz?oink_code={$oinkid}", $tmpfname . "/{$snort_filename}", "read_body_firmware"); update_all_status($static_output); update_status(gettext("Done downloading rules file.")); } /* Compair md5 sig to file sig */ $premium_url_chk = $config['installedpackages']['snort']['config'][0]['subscriber']; if ($premium_url_chk == on) { $md5 = file_get_contents("{$tmpfname}/{$snort_filename_md5}"); $file_md5_ondisk = `/sbin/md5 {$tmpfname}/{$snort_filename} | /usr/bin/awk '{ print $4 }'`; if ($md5 == $file_md5_ondisk) { update_status(gettext("Valid md5 checksum pass...")); } else { update_status(gettext("The downloaded file does not match the md5 file...P is ON")); update_output_window(gettext("Error md5 Mismatch...")); exit(0); } } $premium_url_chk = $config['installedpackages']['snort']['config'][0]['subscriber']; if ($premium_url_chk != on) { $md55 = `/bin/cat {$tmpfname}/{$snort_filename_md5} | /usr/bin/awk '{ print $4 }'`; $file_md5_ondisk2 = `/sbin/md5 {$tmpfname}/{$snort_filename} | /usr/bin/awk '{ print $4 }'`; if ($md55 == $file_md5_ondisk2) { update_status(gettext("Valid md5 checksum pass...")); } else { update_status(gettext("The downloaded file does not match the md5 file...Not P")); update_output_window(gettext("Error md5 Mismatch...")); exit(0); } } /* Untar snort rules file */ if (file_exists("{$tmpfname}/$snort_filename")) { update_status(gettext("Extracting rules...")); update_output_window(gettext("May take a while...")); exec("/usr/bin/tar xzf {$tmpfname}/{$snort_filename} -C {$tmpfname}"); update_status(gettext("Done extracting.")); } else { update_status(gettext("The Download rules file missing...")); update_output_window(gettext("Error rules extracting failed...")); exit(0); } /* Making Snort Directory */ if (file_exists("{$snortdir}")) { update_status(gettext("Directory rules exists...")); update_output_window(gettext("Directory rules exists...")); } else { update_status(gettext("Making Snort Directory...")); update_output_window(gettext("should be fast...")); exec("/bin/mkdir {$snortdir}"); update_status(gettext("Done making snort direcory.")); } /* Copy rules dir to snort dir */ if (file_exists("{$tmpfname}/rules")) { update_status(gettext("Copying rules...")); update_output_window(gettext("May take a while...")); exec("/bin/cp -r {$tmpfname}/rules {$snortdir}/rules"); update_status(gettext("Done copping rules.")); /* Write out time of last sucsessful rule install catch */ $config['installedpackages']['snort']['last_rules_install'] = date("Y-M-jS-h:i-A"); write_config(); } else { update_status(gettext("Directory rules exists...")); update_output_window(gettext("Error copping rules direcory...")); exit(0); } /* Copy md5 sig to snort dir */ if (file_exists("{$tmpfname}/$snort_filename_md5")) { update_status(gettext("Copying md5 sig to snort directory...")); exec("/bin/cp {$tmpfname}/$snort_filename_md5 {$snortdir}/$snort_filename_md5"); } else { update_status(gettext("The md5 file exists...")); update_output_window(gettext("Error copping config...")); exit(0); } /* Copy configs to snort dir */ if (file_exists("{$tmpfname}/etc/Makefile.am")) { update_status(gettext("Copying configs to snort directory...")); exec("/bin/cp {$tmpfname}/etc/* {$snortdir}"); } else { update_status(gettext("The snort configs exists...")); update_output_window(gettext("Error copping config...")); exit(0); } /* Copy signatures dir to snort dir */ if (file_exists("{$tmpfname}/doc/signatures")) { update_status(gettext("Copying signatures...")); update_output_window(gettext("May take a while...")); exec("/bin/cp -r {$tmpfname}/doc/signatures {$snortdir}/signatures"); update_status(gettext("Done copying signatures.")); } else { update_status(gettext("Directory signatures exists...")); update_output_window(gettext("Error copping signature...")); exit(0); } /* php code finish */ update_status(gettext("Rules update finished...")); update_output_window(gettext("You may start Snort now finnal.")); /* hide progress bar and lets end this party */ hide_progress_bar_status(); ?> 150) { update_output_window($text); update_progress_bar($downloadProgress); flush(); $counter = 0; } fwrite($fout, $string); return $length; } ?>