diff options
author | Ermal <eri@pfsense.org> | 2012-07-14 16:22:44 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2012-07-14 16:22:44 +0000 |
commit | 895c5bbb6c9ce79a9d207d8bb20861ebbb47a8f5 (patch) | |
tree | fdd4adbb02bad97a7efbaa416d0b99be7049a3a4 | |
parent | 73f835f4d37c0164e6e1bc56c3055cc05ef68a66 (diff) | |
download | pfsense-packages-895c5bbb6c9ce79a9d207d8bb20861ebbb47a8f5.tar.gz pfsense-packages-895c5bbb6c9ce79a9d207d8bb20861ebbb47a8f5.tar.bz2 pfsense-packages-895c5bbb6c9ce79a9d207d8bb20861ebbb47a8f5.zip |
Remove the need for snort_rename.pl
-rw-r--r-- | config/snort/snort_check_for_rule_updates.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/config/snort/snort_check_for_rule_updates.php b/config/snort/snort_check_for_rule_updates.php index df6ca548..334f8a93 100644 --- a/config/snort/snort_check_for_rule_updates.php +++ b/config/snort/snort_check_for_rule_updates.php @@ -178,8 +178,11 @@ if ($snortdownload == 'on') { /* extract snort.org rules and add prefix to all snort.org files*/ safe_mkdir("{$snortdir}/snortrules"); exec("/usr/bin/tar xzf {$tmpfname}/{$snort_filename} -C {$snortdir}/snortrules rules/"); - chdir("{$snortdir}/snortrules"); - exec('/usr/local/bin/perl /usr/local/bin/snort_rename.pl s/^/snort_/ *.rules'); + $files = glob("{$snortdir}/snortrules/*.rules"); + foreach ($files as $file) { + $newfile = basename($file); + @rename($file, "{$snortdir}/snortrules/snort_{$newfile}"); + } exec("cp {$snortdir}/snortrules/* {$snortdir}/rules; rm -r {$snortdir}/snortrules"); /* extract so rules */ @@ -197,8 +200,11 @@ if ($snortdownload == 'on') { if ($snortdownload == 'on') { /* extract so rules none bin and rename */ exec("/usr/bin/tar xzf {$tmpfname}/{$snort_filename} -C {$snortdir} so_rules/"); - chdir ("{$snortdir}/so_rules"); - exec('/usr/local/bin/perl /usr/local/bin/snort_rename.pl s/^/snort_/ *.rules'); + $files = glob("{$snortdir}/so_rules/*.rules"); + foreach ($files as $file) { + $newfile = basename($file); + @rename($file, "{$snortdir}/so_rules/snort_{$newfile}"); + } exec("cp {$snortdir}/so_rules/* {$snortdir}/rules; rm -r {$snortdir}/so_rules"); /* extract base etc files */ @@ -300,7 +306,7 @@ function snort_apply_customizations($snortcfg, $if_real) { $disabled_sids = array_flip($enabled_sid_off_array); } - $files = glob("{$snortdir}/snort_{$snortcfg}_{$if_real}/rules/*"); + $files = glob("{$snortdir}/snort_{$snortcfg}_{$if_real}/rules/*.rules"); foreach ($files as $file) { $splitcontents = file($file); $changed = false; |