sola-st / DynaPyt

Dynamic analysis framework for Python
MIT License
56 stars 14 forks source link

Only track selected functions #32

Open AryazE opened 1 year ago

AryazE commented 1 year ago

For some analyses it would be nice to only instrument and analyze specific functions. This can either be done by

@except(functions=['read', 'write']) def post_call(...)

AryazE commented 1 year ago

Also

nimamg commented 1 year ago

Another enhancement related to this issue would be to track objects of a specific type (or subclass of a particular class).

Also, if decorators such as the example you provided are to be used, it could be even better to call any arbitrary function as a hook as long as it has the decorator. This can help in writing cleaner analyzers, as the dispatch per object type should be handled manually in the hook right now.

For example:

@pre_call(functions=['open', 'close']
def file_handling_pre_call(...)

@pre_call(functions=['startswith', 'endswith'])
def string_handling_pre_call(...)

Although this would be a major breaking change.

AryazE commented 11 months ago

@nimamg Do you mean to have hooks for specific object types? Like a hook that gets called every time there is a function call on a string type?