FortiDB Version 3.2 Utilities User Guide
16
15-32000-81369-20081219
Chaining with Parameterized User-Defined Rules
Rule Chaining
4
Login as
BAD_GUY
at an "abnormal" time (Here, that is anytime except between 3
and 4 AM)
DECLARE
v_str VARCHAR2(80) := 'ALTER SYSTEM KILL SESSION
'||chr(39);
v_statementVARCHAR2(80);
sesid NUMBER;
serial NUMBER;
usernameVARCHAR(50);
osuser VARCHAR(50);
machine VARCHAR(50);
program VARCHAR(50);
BEGIN
SELECT sid, serial#,username,osuser,machine,program
INTO sesid,serial,username,osuser,machine,program
FROM v$session
WHERE audsid =
$sessionid
;
v_statement := v_str||sesid||','||serial||chr(39)||'
IMMEDIATE';
EXECUTE IMMEDIATE v_statement;
DBMS_OUTPUT.PUT_LINE
(TO_CHAR
(SYSDATE,'YYYY/MM/DD HH24:MI:SS') ||
' A suspicious session has been killed.'||
' [Username]'||username||
' [Osuser]'||osuser||' [Machine]'||machine||
' [Program]'||program) ;
EXCEPTION
WHEN no_data_found THEN
DBMS_OUTPUT.PUT_LINE
(TO_CHAR
(SYSDATE,'YYYY/MM/DD HH24:MI:SS') ||
' A suspicious session is not found at this moment.');
END;