klara icon indicating copy to clipboard operation
klara copied to clipboard

Make Klara compatible with Python3 / replace torndb module

Open Nono-m0le opened this issue 2 years ago • 3 comments
trafficstars

Is your feature request related to a problem? Please describe.

As python2 reaching end of life. I tried to upgrade my system, which doesn't come with python2 anymore. My first attempt to manual install python2 (and especially the mysql module) failed, so I start digging if a transition to python3 wasn't going to be more straight forward.

I endup on a dead-end because (at least) the dispachter use the "tornado" and "torndb" module which isn't supported anymore.

Even though they still exists:

$ python3 --version
Python 3.10.6

$ python3 -m pip list | grep torn
tornado                6.3.2
torndb                 0.3

$ ./klara-dispatcher
Traceback (most recent call last):
  File "/dispatcher/./klara-dispatcher", line 9, in <module>
    import torndb
  File "/.local/lib/python3.10/site-packages/torndb.py", line 260, in <module>
    CONVERSIONS[field_type] = [(FLAG.BINARY, str)] + CONVERSIONS[field_type]
TypeError: can only concatenate list (not "type") to list

Thus the question, would it be possible to port the project to python3 using "recent" or at least still maintain library ?

Maybe tornado/torndb aren't the only one who'll need a rewrite.

Nono-m0le avatar Jul 20 '23 09:07 Nono-m0le

Hey!

Thanks for the feedback. Yes, I 100% agree with you. torndb module needs replacement. They specify in their code that torndb is not compatible with Python 3.

Indeed, this is an issue I have to handle soon.

I'll add it to my todo list with priority.

xdanx avatar Jul 20 '23 14:07 xdanx

It turns out, making it run (without error, maybe not on an ideal way) is straight forward. The bigger part turns out to be moving the web app code from CodeIgniter 3 to CodeIgniter4 in order to support PHP8.

Do you have any ETA for this @xdanx ?

Nono-m0le avatar Jul 21 '23 07:07 Nono-m0le

Hi @xdanx as you may have seen, I've created a PR for the "migration" to python2 to python3 (it's more a wrapper of the turndb module), you can see it here : https://github.com/KasperskyLab/klara/pull/32

I'm still very interesting to know the future for the project to support PHP8. Would it be an upgrade of CI3 or migration to CI4 ?

Nono-m0le avatar Aug 18 '23 13:08 Nono-m0le