Open zbalkan opened 8 months ago
Hey @zbalkan , this is awesome! Really cool how you were able to repurpose wtfis! :)
I think this is a good idea, but my concern is mostly the additional overhead in maintaining this feature. Some questions that come to mind:
Thanks!
Thanks @zbalkan !
I used this solution in my wtfis-Wazuh integration and it works smoothly.
To make the code above understandable, I must give some context. I had to make
wtfis
a library that outputs JSON results for that integration. So, the external script can just call the library methods. I, first, stripped away all the UI related code, then created a wrapper class calledResolver
, which includes thegenerate_entity_handler
method inside. Then afetch
and anexport
method were added as the main interface to the library.In
wtfis
you used environment variables stored in.env.wtfis
file. In order to be able to integrate smoothly, I first created a class called Config, that I can pass toResolver
. One can use any method to create thisConfig
class. In my case, Wazuh initiates the Python script with a bash script, along with arguments. So, I read the arguments, initiate theConfig
class instance, and pass it to theResover
along with the target IP or domain name.These two methods are the interface of the
wtfis
library. Everything else was moved underwtfis.internal
.The code above then reads the SQLite-backed cache. I am using the defaults for cache settings. But it is possible to customize parameters, choose a different strategy, and have a shorter lifetime for cache.
The idea is to minimize the API usage. It may help in the long term.