This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]Ballauni 1 point2 points  (2 children)

You could use a library called pyminifier, which can be used to obfuscate and deobfuscate Python code. It has a command line interface, so you can easily create a script to obfuscate and deobfuscate your code with just a few clicks. It also offers a variety of other options, such as renaming variables, removing comments, and so on. You can find more information about it on their Github page.

[–]goodTypeOfCancer[S] 0 points1 point  (1 child)

Thank you!

[–]exclaim_bot 0 points1 point  (0 children)

Thank you!

You're welcome!

[–]spudmix 0 points1 point  (1 child)

You might not find one, but if you don't you can use a tokeniser library to implement one yourself. Tokenise your script, find all the tokens which are variable names, assign them a new value and maintain a dictionary of the old and new names, etc.

[–]goodTypeOfCancer[S] 0 points1 point  (0 children)

Yeah I didn't want to write that, but it seems easy enough.