View Full Version : How to convert exploits from python2 to python3

2022-01-07, 13:51
Hi all,

I really hope it's not a stupid question, however I'm finding this problem a bit more recurrent these days.
Looks like the database of python exploits are written in the outdated python2, and obviously not updated on Kali, exploit-db and searchsploit.

My question is, if there is a way to convert somehow painless the file from python2 to python3 without manual intervention.

I am using 2to3 which is good in regards of converting the input of outdated modules, but still requires a lot of manual fix as for example wont add any parenthesis to open and close the print function correctly, regardless the fact that I am not the quickest in reviewing and fxing python scripts, but also the fix would be relative to the pretty much single use script, and wouldn't be saved in the database.

Thank you

2022-01-16, 21:07
Not really.
an exploit is typically any thing from 50 - 200 lines of code. It takes an hour or so so convert.
Alternatively, yes you can have multiple versions of python on a system.

2022-01-18, 17:40
Sorry dude, there's only the long way around, and reading through python2 version, figuring out what doesn't work. and figuring out how to do it in python3 :)