[Prelude Hybrid IDS] #274: [python binding] Retrieve int values from alerts

"Prelude Hybrid IDS" <[email protected]>
Newsgroups gmane.comp.security.ids.prelude.devel
Message-ID <[email protected]>
#274: [python binding] Retrieve int values from alerts
------------------------------------+---------------------------------------
 Reporter:  [email protected]  |       Owner:  yoann            
     Type:  defect                  |      Status:  new              
 Priority:  normal                  |   Milestone:  Libprelude 0.9.17
Component:  libprelude              |     Version:  0.9              
 Severity:  normal                  |    Keywords:  python binding   
------------------------------------+---------------------------------------
 I do not manage to get python integer values from the functions that
 return either an uint32_t* or uint16_t* type (e.g., get_severity,
 get_completion, userid->get_number, process->get_pid, get_completion,
 get_port, etc...). I get a reference to the corresponding object, but I
 cannot (or I don't know how to) dereference the pointer to get the value
 in python.

 My (dirty) workaround consists in replacing

  {{{
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result),
  SWIGTYPE_p_unsigned_int, 0 |  0 );
  }}}

  with

  {{{
  resultobj = PyInt_FromLong((long)(*result));
  }}}

  in _prelude.c, after having tested that result is not NULL:

  {{{
  if(result == (uint32_t *)NULL) SWIG_fail;
  }}}

 Maybe a typemap directive is also required here, but I am not sure...

 Cheers,

 Ben

-- 
Ticket URL: <https://trac.prelude-ids.org/ticket/274>
Prelude Hybrid IDS <http://www.prelude-ids.org>
The Prelude Hybrid Intrusion Detection System suite
_______________________________________________
Prelude-devel site list
[email protected]
http://www.prelude-ids.org/mailman/listinfo/prelude-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.