function Action_del_alert_op($id, $db, $deltmp, $j, $perc, $f) { return PurgeAlert($id, $db, $deltmp, $j, $perc, $f); }
function Action_archive_alert2_op($sid, $cid, &$db, $action_arg, &$ctx) { $cnt = $cnt2 = 0; $cnt = Action_archive_alert_op($sid, $cid, $db, $action_arg, $ctx); if ($cnt == 1) { $cnt2 = PurgeAlert($sid, $cid, $db); } /* Note: the inconsistent state possible if alerts are copied to * the archive DB, but not deleted */ if ($cnt == 1 && $cnt2 == 1) { return 1; } else { return 0; } }
function Action_del_alert_op($id, $db, $deltmp, $j, $interval, $f) { return PurgeAlert($id, $db, $deltmp, $j, $interval, $f); }
} } } } } } // ****************************************** Console Purge Event Script ********************************************** ob_implicit_flush(); ini_set('include_path', '/usr/share/ossim/include'); require_once "ossim_db.inc"; $db = new ossim_db(); $conn = $db->snort_connect(); $acid_event_input = ""; if (!($rs =& $conn->Execute("SELECT table_name FROM INFORMATION_SCHEMA.tables WHERE table_name='acid_event_input'"))) { print $conn->ErrorMsg(); exit; } else { if (!$rs->EOF) { $acid_event_input = $rs->fields["table_name"]; } } $sid = $argv[1]; $cid = $argv[2]; if ($sid == "" || cid == "") { echo "Usage: php purge_event.php SID CID\n"; exit; } PurgeAlert_ac($conn, $sid, $cid); PurgeAlert($conn, $sid, $cid, $acid_event_input); echo "\nEvent SID:{$sid}, CID={$cid} successfully deleted.\n\n"; $db->close($conn);
} $action_cnt = 0; $dup_cnt = 0; $j = 0; $fsidcids = fopen($listtmp, "r"); $f = fopen($deltmp, "w+"); fputs($f, "/* ****************Background Purge Execution*************** */\n"); fputs($f, "CREATE TABLE IF NOT EXISTS `deletetmp` (`id` int(11) NOT NULL,`perc` int(11) NOT NULL, PRIMARY KEY (`id`));\n"); fputs($f, "INSERT INTO deletetmp (id,perc) VALUES ({$rnd},1) ON DUPLICATE KEY UPDATE perc=1;\n"); while (!feof($fsidcids)) { $sidcid = fgets($fsidcids, 4096); $aux = explode("-", trim($sidcid)); $sid = $aux[0]; $cid = $aux[1]; if ($sid != "" && $cid != "") { $tmp = PurgeAlert($sid, $cid, $db, $deltmp, $j, $interval, $f, $acid_event_input); if ($tmp == 0) { ++$dup_cnt; } else { if ($tmp == 1) { ++$action_cnt; } } $j++; } } fputs($f, "UPDATE deletetmp SET perc=100 WHERE id={$rnd};\n"); fclose($f); fclose($fsidcids); unlink($listtmp); // POST ACTION