aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort
diff options
context:
space:
mode:
authorrobiscool <robrob2626@yahoo.com>2009-06-04 04:20:05 -0700
committerrobiscool <robrob2626@yahoo.com>2009-06-04 04:21:10 -0700
commit9338a242c712fc10d4b1275259e5120d6e04d0f7 (patch)
tree1cea00dc3a4df09c221055f4229f9e8631f66fbe /config/snort
parentd0761866e10c3e9d446816122f330e5d8b814e2c (diff)
downloadpfsense-packages-9338a242c712fc10d4b1275259e5120d6e04d0f7.tar.gz
pfsense-packages-9338a242c712fc10d4b1275259e5120d6e04d0f7.tar.bz2
pfsense-packages-9338a242c712fc10d4b1275259e5120d6e04d0f7.zip
Thanx to serialdie, found missing Snort.org paid subscriber urls, different md5 formats for different files ahhh
Diffstat (limited to 'config/snort')
-rw-r--r--config/snort/snort_download_rules.php37
1 files changed, 29 insertions, 8 deletions
diff --git a/config/snort/snort_download_rules.php b/config/snort/snort_download_rules.php
index 792f7d05..78bbf232 100644
--- a/config/snort/snort_download_rules.php
+++ b/config/snort/snort_download_rules.php
@@ -142,6 +142,13 @@ if ($premium_subscriber_chk === on) {
$premium_subscriber = "";
}
+$premium_url_chk = $config['installedpackages']['snort']['config'][0]['subscriber'];
+if ($premium_url_chk === on) {
+ $premium_url = "sub-rules";
+}else{
+ $premium_url = "reg-rules";
+}
+
/* hide progress bar */
hide_progress_bar_status();
@@ -173,7 +180,7 @@ if (file_exists("{$tmpfname}/{$snort_filename_md5}")) {
} else {
update_status(gettext("Downloading md5 file..."));
ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0)');
- $image = @file_get_contents("http://dl.snort.org/reg-rules/snortrules-snapshot-2.8{$premium_subscriber}.tar.gz.md5?oink_code={$oinkid}");
+ $image = @file_get_contents("http://dl.snort.org/{$premium_url}/snortrules-snapshot-2.8{$premium_subscriber}.tar.gz.md5?oink_code={$oinkid}");
// $image = @file_get_contents("http://www.mtest.local/pub-bin/oinkmaster.cgi/{$oinkid}/snortrules-snapshot-2.8{$premium_subscriber}.tar.gz.md5");
$f = fopen("{$tmpfname}/snortrules-snapshot-2.8.tar.gz.md5", 'w');
fwrite($f, $image);
@@ -193,7 +200,6 @@ if (0 == filesize("{$tmpfname}/snortrules-snapshot-2.8.tar.gz.md5")){
/* Display last time of sucsessful md5 check from cache */
echo "\n<p align=center><b>You last checked for updates: </b>{$last_md5_download}</p>\n";
echo "\n<p align=center><b>You last installed for rules: </b>{$last_rules_install}</p>\n";
- echo "P is this code {$premium_subscriber}";
echo "\n\n</body>\n</html>\n";
exit(0);
}
@@ -229,24 +235,39 @@ if (file_exists("{$tmpfname}/{$snort_filename}")) {
} 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://dl.snort.org/reg-rules/snortrules-snapshot-2.8{$premium_subscriber}.tar.gz?oink_code={$oinkid}", $tmpfname . "/{$snort_filename}", "read_body_firmware");
// 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 */
-$md555 = file_get_contents("{$tmpfname}/{$snort_filename_md5}");
-$md5 = `/bin/echo "{$md555}" | /usr/bin/awk '{ print $4 }'`;
+
+$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) {
+ 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..."));
+ 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 */