MYSQL trigger Áú¹®ÀÌ ÀÖ½À´Ï´Ù..

   Á¶È¸ 5131   Ãßõ 0    

mikrotik 에서 패킷 스니퍼 기능으로 ubuntu 16.04 서버에 패킷을 보낸후 suricata로 분석하고 barnyard2 로 db에 저장

db에 저장된 값을 php 스크립트를 이용하여 미크로틱 api기능을이용해서 블럭 어드레스에 추가하는 기능입니다.. 다른것은 다 진행되는데 mysql 트리거 에서 문법오류가 납니다 ㅠㅠ

확인 가능하신분 계시면 확인부탁드립니다..

 http://forum.mikrotik.com/viewtopic.php?t=111727


CREATE TRIGGER `after_iphdr_insert` AFTER INSERT ON `iphdr`
  FOR EACH ROW BEGIN
  DECLARE this_event INT(11) default 0;
  DECLARE this_event_signature INT(10) default 0;
  DECLARE this_event_timestamp TIMESTAMP;
  DECLARE this_sig INT(10) default 0;
  DECLARE this_sig_name VARCHAR(256) default "";
  DECLARE this_sig_gid INT(10) default 0;
  DECLARE timeout VARCHAR(12) default "";
  DECLARE interested INT default 0;
  DECLARE direction VARCHAR(3) default "";
  DECLARE ip_src VARCHAR(64) default "";
  DECLARE ip_dst VARCHAR(64) default "";
  SELECT event.id, event.signature, event.timestamp
  INTO this_event, this_event_signature, this_event_timestamp
  FROM event
  WHERE event.sid = NEW.sid and event.cid = NEW.cid;  
  SELECT signature.sig_sid, signature.sig_gid, signature.sig_name 
  INTO this_sig, this_sig_gid, this_sig_name
  FROM signature
  WHERE signature.sig_id = this_event_signature;
  SELECT count(*), sigs_to_block.src_or_dst, sigs_to_block.timeout
  INTO interested, direction, timeout
  FROM sigs_to_block
  WHERE this_sig_name LIKE CONCAT(sigs_to_block.sig_name, '%');
  IF (interested > 0) THEN
   IF (direction = "src") THEN
      INSERT INTO block_queue
   SET que_ip_adr = inet_ntoa(NEW.ip_src),
          que_timeout = timeout,
          que_sig_name = this_sig_name,
          que_sig_gid = this_sig_gid,
          que_sig_sid = this_sig,
          que_event_timestamp = this_event_timestamp;
    ELSE
      INSERT INTO block_queue
   SET que_ip_adr = inet_ntoa(NEW.ip_dst),
          que_timeout = timeout,
          que_sig_name = this_sig_name,
          que_sig_gid = this_sig_gid,
          que_sig_sid = this_sig,
          que_event_timestamp = this_event_timestamp;
    END IF;
  END IF;
END


현재 mysql 5.7버전 사용하고 있습니다

ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
Á¤ÀçÈ£02 2016-09
¾Ë¾Æ¼­ ÇØ°áÇß½À´Ï´Ù¸¸.. Ȥ½Ã Àú¿Í°°ÀÌ ±¸ÃàÇϽźÐÀÌ ÀÖ´Ù°¡ ¸·È÷½Å´Ù¸é Àú¿¡°Ô ÂÊÁö¸¦ ³²°ÜÁÖ¼¼¿ä
NeOpLe 2016-09
MySQL trigger µµ ¸¹ÀÌ º¯Ç߳׿ä.


QnA
Á¦¸ñPage 2198/5667
2014-05   4913866   Á¤ÀºÁØ1
2015-12   1452156   ¹é¸Þ°¡
2023-12   899   Caig
2011-01   7818   ¹Ú¹®Çü
2018-06   4452   ±è¿ìÁø
2018-06   3722   ¸®Àå´Ô
2022-04   2233   ±Þ¿©ÀÏ¿¡¸¸³ª¿ä
2013-10   12224   luciddream
2018-06   4776   ÀÌÁ¾¼Û1
2019-08   3095   Áý¾Èû¼Ò
2020-11   5121   godpa
2023-12   842   2cÀå±Ô½Ä
2011-02   7838   6Åø
2023-12   1044   CW33300
2013-10   7812   ÄÄÁö±â
2017-03   14322   ĵÀ§µå
2018-06   5089   ²Þ²Ù´Âº£ºó¾ß
2013-10   6037   Ä¡ºñ¶óºÎ
2015-02   3807   luciddream
2013-10   7633   º´¸ÀÆù
2022-05   1104   VSPress
2011-03   6745   ÀÌÁ¤±Ù