aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort/snort_blocked.php
diff options
context:
space:
mode:
authorbmeeks8 <bmeeks8@bellsouth.net>2014-09-17 15:48:17 -0400
committerbmeeks8 <bmeeks8@bellsouth.net>2014-09-17 15:48:17 -0400
commitf7f5c7bb21c94f6be6b36202a8fa301d86a66406 (patch)
treefc1909dc510d5ab95880e6050d06b3ea2b444bfc /config/snort/snort_blocked.php
parent69e99bed09652ef93607cc353cafcc99d7e54b2e (diff)
downloadpfsense-packages-f7f5c7bb21c94f6be6b36202a8fa301d86a66406.tar.gz
pfsense-packages-f7f5c7bb21c94f6be6b36202a8fa301d86a66406.tar.bz2
pfsense-packages-f7f5c7bb21c94f6be6b36202a8fa301d86a66406.zip
Replace exec() calls with system calls and also use unlink_if_exists().
Diffstat (limited to 'config/snort/snort_blocked.php')
-rw-r--r--config/snort/snort_blocked.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/config/snort/snort_blocked.php b/config/snort/snort_blocked.php
index 0f95f8ce..2d0af2c3 100644
--- a/config/snort/snort_blocked.php
+++ b/config/snort/snort_blocked.php
@@ -89,9 +89,9 @@ if ($_POST['download'])
exec('/sbin/pfctl -t snort2c -T show', $blocked_ips_array_save);
/* build the list */
if (is_array($blocked_ips_array_save) && count($blocked_ips_array_save) > 0) {
- $save_date = exec('/bin/date "+%Y-%m-%d-%H-%M-%S"');
+ $save_date = date("Y-m-d-H-i-s");
$file_name = "snort_blocked_{$save_date}.tar.gz";
- exec('/bin/mkdir -p /tmp/snort_blocked');
+ safe_mkdir("/tmp/snort_blocked");
file_put_contents("/tmp/snort_blocked/snort_block.pf", "");
foreach($blocked_ips_array_save as $counter => $fileline) {
if (empty($fileline))
@@ -120,8 +120,8 @@ if ($_POST['download'])
readfile("/tmp/{$file_name}");
// Clean up the temp files and directory
- @unlink("/tmp/{$file_name}");
- exec("/bin/rm -fr /tmp/snort_blocked");
+ unlink_if_exists("/tmp/{$file_name}");
+ rmdir_recursive("/tmp/snort_blocked");
} else
$savemsg = gettext("An error occurred while creating archive");
} else