aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort-dev/snort_json_post.php
diff options
context:
space:
mode:
authorrobiscool <robrob2626@yahoo.com>2011-05-06 13:08:28 -0700
committerrobiscool <robrob2626@yahoo.com>2011-05-06 13:08:28 -0700
commitc0076cc80d8c3689ffacff0a61f6d5a76c30b70c (patch)
tree56617399385ca9868de39e822f289291390173f6 /config/snort-dev/snort_json_post.php
parent007a2e17c59e36d5f59457d1df50f722d8fb9d64 (diff)
downloadpfsense-packages-c0076cc80d8c3689ffacff0a61f6d5a76c30b70c.tar.gz
pfsense-packages-c0076cc80d8c3689ffacff0a61f6d5a76c30b70c.tar.bz2
pfsense-packages-c0076cc80d8c3689ffacff0a61f6d5a76c30b70c.zip
snort-dev, add neww files
Diffstat (limited to 'config/snort-dev/snort_json_post.php')
-rw-r--r--config/snort-dev/snort_json_post.php129
1 files changed, 92 insertions, 37 deletions
diff --git a/config/snort-dev/snort_json_post.php b/config/snort-dev/snort_json_post.php
index 3d54e0d2..6ae100b1 100644
--- a/config/snort-dev/snort_json_post.php
+++ b/config/snort-dev/snort_json_post.php
@@ -10,30 +10,55 @@ if(isset($_POST['__csrf_magic']))
unset($_POST['__csrf_magic']);
}
-// Cancel echo back
-if ($_POST['Cancel'] == 1) {
-
- if ($_POST['CancelType'] == '') {
- echo '
- {
- "snortpost": "fail"
- }
- ';
- return false;
- }
-
-
- if ($_POST['CancelType'] == 'SnortSettings') {
- snortSql_fetchSettingsAllToJson($_POST['CancelType'], '');
- return true;
- }
+// return codes
+$snortJsonReturnCode_success = '
+{
+"snortgeneralsettings": "success"
+}
+';
- if ($_POST['CancelType'] == 'SnortWhitelist' || $_POST['CancelType'] == 'SnortWhitelistips') {
- snortSql_fetchSettingsAllToJson($_POST['CancelType'], $_POST['CancelName']);
- return true;
- }
-
+$snortJsonReturnCode_fail = '
+{
+"snortgeneralsettings": "fail"
+}
+';
+// row from db by uuid
+if ($_POST['RMlistDelRow'] == 1)
+{
+
+ //conf_mount_rw();
+
+ if ($_POST['RMlistTable'] == 'Snortrules' || $_POST['RMlistTable'] == 'SnortSuppress')
+ {
+ if (snortSql_updatelistDelete($_POST['RMlistDB'], $_POST['RMlistTable'], 'uuid', $_POST['RMlistUuid']))
+ {
+ echo $snortJsonReturnCode_success;
+ return true;
+ }else{
+ echo $snortJsonReturnCode_fail;
+ return false;
+ }
+ }
+
+ if ($_POST['RMlistTable'] == 'SnortWhitelist')
+ {
+ $fetchExtraWhitelistEntries = snortSql_fetchAllSettings($_POST['RMlistDB'], $_POST['RMlistTable'], 'uuid', $_POST['RMlistUuid']);
+
+ if (snortSql_updatelistDelete($_POST['RMlistDB'], 'SnortWhitelistips', 'filename', $fetchExtraWhitelistEntries['filename']))
+ {
+ snortSql_updatelistDelete($_POST['RMlistDB'], $_POST['RMlistTable'], 'uuid', $_POST['RMlistUuid']);
+
+ echo $snortJsonReturnCode_success;
+ return true;
+ }else{
+ echo $snortJsonReturnCode_fail;
+ return false;
+ }
+ }
+
+ //conf_mount_ro();
+
}
@@ -46,8 +71,7 @@ if ($_POST['snortSaveSettings'] == 1)
if ($_POST['ifaceTab'] == 'snort_interfaces_global')
{
- // checkboxes when set to off never get included in POST thus this code
- $_POST['emergingthreats'] = ($_POST['emergingthreats'] == '' ? off : $_POST['emergingthreats']);
+ // checkboxes when set to off never get included in POST thus this code
$_POST['forcekeepsettings'] = ($_POST['forcekeepsettings'] == '' ? off : $_POST['forcekeepsettings']);
}
@@ -89,17 +113,56 @@ if ($_POST['snortSaveSettings'] == 1)
}
+// Suppress settings save
+if ($_POST['snortSaveSuppresslist'] == 1)
+{
+
+ // post for supress_edit
+ if ($_POST['ifaceTab'] == 'snort_interfaces_suppress_edit')
+ {
+
+ // make sure filename is valid
+ if (!is_validFileName($_POST['filename']))
+ {
+ echo 'Error: FileName';
+ return false;
+ }
+
+ // unset POSTs that are markers not in db
+ unset($_POST['snortSaveSuppresslist']);
+ unset($_POST['ifaceTab']);
+
+ // convert textbox to base64
+ $_POST['suppresspassthru'] = base64_encode($_POST['suppresspassthru']);
+
+ //conf_mount_rw();
+ snortSql_updateSettings($_POST, 'uuid', $_POST['uuid']);
+ //conf_mount_ro();
+
+ echo '
+ {
+ "snortgeneralsettings": "success"
+ }
+ ';
+ return true;
+
+ }
+
+
+
+}
+
// Whitelist settings save
if ($_POST['snortSaveWhitelist'] == 1)
{
if ($_POST['ifaceTab'] == 'snort_interfaces_whitelist_edit') {
- if ($_POST['filename'] == '')
- {
- echo 'Error: No FileName';
- return false;
- }
+ if (!is_validFileName($_POST['filename']))
+ {
+ echo 'Error: FileName';
+ return false;
+ }
$_POST['wanips'] = ($_POST['wanips'] == '' ? off : $_POST['wanips']);
$_POST['wangateips'] = ($_POST['wangateips'] == '' ? off : $_POST['wangateips']);
@@ -135,14 +198,6 @@ if ($_POST['snortSaveWhitelist'] == 1)
}
-// Whitelist settings delete
-if ($_POST['WhitelistDelRow'] == 1)
-{
- //conf_mount_rw();
- snortSql_updateWhitelistDelete($_POST['WhitelistTable'], $_POST['WhitelistUuid']);
- //conf_mount_ro();
-}
-
// download code for alerts page
if ($_POST['snortlogsdownload'] == 1)
{