Академический Документы
Профессиональный Документы
Культура Документы
trigger_time: after
trigger_event: insert
Use
INET_NTOA
and
INET_ATON
This works because IPv4 was originally designed to have IP addresses defined as 32-
bit numbers. The dot-decimal notation is for readbility.
Update
ALTER TABLE `buffer` CHANGE `sig_name` `sig_name` VARCHAR( 50 ) CHARACTER SET utf8
COLLATE utf8_general_ci NULL DEFAULT NULL
CREATE TRIGGER ins_lat after INSERT ON lat FOR EACH ROW insert into
`smsdb`.outbox(DestinationNumber, TextDecoded) values ('085725877772', (select
col1, col2, col3 from lat limit 1));
CREATE TRIGGER ins_lat after INSERT ON lat FOR EACH ROW insert into
`smsdb`.outbox(DestinationNumber, TextDecoded) values ('085725877772', (select
concat('alerd : 'col1,'dari : ' col2,'ke : ' col3) as text from lat limit 1));
CREATE TRIGGER ins_lat after INSERT ON lat FOR EACH ROW insert into
`smsdb`.outbox(DestinationNumber, TextDecoded) values ('085725877772', (select
concat('alerd : 'col1,'dari : ' col2,'ke : ' col3) as text from lat order by id
desc limit 1));
CREATE TRIGGER ins_lat after INSERT ON lat FOR EACH ROW insert into
`smsdb`.outbox(DestinationNumber, TextDecoded) values ('085725877772', (select
concat_ws('-',col1, col2, col3) as text from lat order by id desc limit 1));
CREATE TRIGGER after_ins_acid_event after INSERT ON acid_event FOR EACH ROW insert
into buffer(sig_name, ipsrc, ipdst, portsrc, portdst, timestamp) values
(NEW.sig_name, NEW.ip_src , NEW.ip_dst, NEW.layer4_sport, NEW.layer4_dport,
NEW.timestamp);
CREATE TRIGGER after_ins_buffer after INSERT ON buffer FOR EACH ROW insert into
`smsdb`.outbox(DestinationNumber, TextDecoded) values ('085725877772', (select
concat('ALERT : '+ sig_name,' IPsrc:'+ inet_ntoa(ipsrc),' IPdst:' inet_ntoa(ipdst),
' Sport:'+portsrc, ' Dport:'+portdst, timestamp) as text from buffer order by id
desc limit 1));
SELECT concat( 'ALERT : ' , sig_name), concat( ' IPsrc:' , inet_ntoa( ip_src ) ),
concat( ' IPdst:' , inet_ntoa( ip_dst )), concat( ' Sport:' , layer4_sport),
concat( ' Dport:' , layer4_dport), timestamp ) AS text
FROM acid_event
ORDER BY timestamp DESC
CREATE TRIGGER after_ins_buffer after INSERT ON buffer FOR EACH ROW insert into
`smsdb`.outbox(DestinationNumber, TextDecoded) values ('085725877772', SELECT
concat( concat( 'ALERT : ', sig_name ) , concat( ' IPsrc:', inet_ntoa( ipsrc ) ) ,
concat( ' IPdst:', inet_ntoa( ipdst ) ) , concat( ' Sport:', portsrc ) , concat( '
Dport:', portdst ) , timestamp ) AS text
FROM buffer order by id desc limit 1));