[prev in list] [next in list] [prev in thread] [next in thread] 

List:       prelude-user
Subject:    Re: [prelude-user] Python API
From:       Yoann Vandoorselaere <yoann.v () prelude-technologies ! com>
Date:       2010-03-11 9:38:22
Message-ID: 1268300302.15286.630.camel () arwen
[Download RAW message or body]

Hi Sérgio,

Le vendredi 05 mars 2010 à 09:49 +0000, Sérgio Alves a écrit :
> i'm currently developing a receiver of IDMEF messages from prelude and
> i'm using Prelude Python API PreludeEasy.
> I wonder if there is any other way of waiting for messages instead of a
> typical while(true), which is CPU consumer, without changes to the
> prelude python api.
> I was thinking of an effective way such as signaling.
> 
> Any suggestions/ideas or other effective ways?

There are two typicals way of waiting for a message, the first is to use
RecvIDMEF(timeout=X). With a timeout of zero, the function call will
return immediately if there is no events available for reading.

Another possibility is to retrieve the sockets used for communicating
with the various manager:

import PreludeEasy

client = PreludeEasy.ClientEasy("mySensor")
client.Start()

sock_list = []
for i in client.GetConnectionPool().GetConnectionList():
    if i.IsAlive():
        sock_list.append(i.GetFd())


Using the retrieved sockets, you should be able to monitor events.


Hope this help,

-- 
Yoann Vandoorselaere | Directeur Technique/CTO | PreludeIDS Technologies
Tel: +33 (0)1 40 24 65 10                      Fax: +33 (0)1 40 24 65 28
http://www.prelude-technologies.com

_______________________________________________
Prelude-user site list
Prelude-user@prelude-technologies.com
http://lists.prelude-technologies.com/mailman/listinfo/prelude-user

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic