winevt icon indicating copy to clipboard operation
winevt copied to clipboard

Event subscription callback on instance method

Open 6p9hb3ukynd3n8er opened this issue 5 years ago • 1 comments

Hi,

I noticed this check when specifying the callback function of an event subscription : https://github.com/bannsec/winevt/blob/0c6ecc430e4cb95f36ae99957593f9c6783bbd46/winevt/EventLog/Subscribe.py#L155

In both python 2 and 3, type(lambda x: x) is <type 'function'> but in python2, a class or instance method is <type 'instancemethod'> and in python3 an instance method is <class 'method'>.

I think using the builtin callable() function would be more appropriate and would allow the use of an instance method as a callback. This modification solved the issue for me.

if not callable(callback):

6p9hb3ukynd3n8er avatar Mar 04 '19 23:03 6p9hb3ukynd3n8er

Good call, thanks! Will push update soon.

bannsec avatar Mar 07 '19 19:03 bannsec