diff options
author | robiscool <robrob2626@yahoo.com> | 2011-06-01 19:01:11 -0700 |
---|---|---|
committer | robiscool <robrob2626@yahoo.com> | 2011-06-01 19:01:11 -0700 |
commit | 19598c0fc7074cfbb42e32cd8f0354c74a7c6c22 (patch) | |
tree | ddff0395576163436cfeb6925fdcc2a38bf01e0a /config/snort-dev/snort_json_get.php | |
parent | 3e221854cbde63171c008f62cd3e0e3d4d79f4ef (diff) | |
download | pfsense-packages-19598c0fc7074cfbb42e32cd8f0354c74a7c6c22.tar.gz pfsense-packages-19598c0fc7074cfbb42e32cd8f0354c74a7c6c22.tar.bz2 pfsense-packages-19598c0fc7074cfbb42e32cd8f0354c74a7c6c22.zip |
snort-dev, add update code, add update tab
Diffstat (limited to 'config/snort-dev/snort_json_get.php')
-rw-r--r-- | config/snort-dev/snort_json_get.php | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/config/snort-dev/snort_json_get.php b/config/snort-dev/snort_json_get.php index a8cdcd2d..1fdcc1e7 100644 --- a/config/snort-dev/snort_json_get.php +++ b/config/snort-dev/snort_json_get.php @@ -2,10 +2,49 @@ require_once("guiconfig.inc"); require_once("/usr/local/pkg/snort/snort_new.inc"); +require_once("/usr/local/pkg/snort/snort_download_rules.inc"); +session_start(); // alwaya at the very top of a php page or "Cannot send session cache limiter - headers already sent" - - +// upload created log tar to user +if ($_GET['snortGetUpdate'] == 1) +{ + + $tmpfname = "/usr/local/etc/snort/snort_download"; + $snort_filename = "snortrules-snapshot-2905.tar.gz"; + + + $snortSessionPath = $_SESSION['tmp']['snort']['snort_download_updates']; + + if (!file_exists("{$tmpfname}/{$snort_filename}")) + { + + if ($snortSessionPath['download']['working'] != '1') + { + unset($_SESSION['tmp']); + $snortSessionPath['download']['working'] = '1'; + sendUpdateSnortLogDownload(); + } + + } + + $time = time(); + while((time() - $time) < 30) { + // query memcache, database, etc. for new data + $data = $datasource->getLatest(); + + // if we have new data return it + if(!empty($data)) { + echo json_encode($data); + ob_flush(); + flush(); + break; + } + + usleep(25000); + } + +} // end main if |