0

I am making an obfuscation program for Python, it's the backend of the Flask server. Everything is fine except for the fact that the obfuscated code is sometimes faulty, which can be fixed by just obfuscating the code again and getting a different obfuscated code. I am using AES.

However, I'd like to add to my code a checker for if the obfuscated code is faulty, and if it is, it just generates code again and again until the obfuscated code is good to go. I am aware that I can simply do it by:

try:
   exec(obfuscatedcode)
except:
   # generate obfuscated code again

Is there a way to execute the obfuscated code in a safe environment? I'll make the obfuscation website public, and I would not like someone send a bad script that will do something wrong to the server. All I'd need is to probably just not allow the script that will be inputted to check any file contents in the backend or something like that, however im not sure how to do it.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
  • 1
    " Everything is fine except for the fact that the obfuscated code is sometimes faulty, which can be fixed by just obfuscating the code again and getting a different obfuscated code." That doesn't sound right. You would probably be better off examining your obfuscator to figure out what it is breaking and fix it. – chepner Mar 07 '23 at 01:10

0 Answers0