Search code examples
pythonvariablesmethodsrenameobfuscation

A python script to rename variables of given python source code with a set of given words


I want to change variable (and method) names of a given python code with a set of given words. (If someone is familiar with ProGuard for Android, this will be very similar to that.) For example, I want to do something like below:

python renamer.py --input ./some-source.py --wordlist ./nice_words.txt

I took a look of rope (python library) and other obfuscation tools. But I could not find what I wanted. What will be a good way to do what I want to do?


Solution

  • I found the solution. An open source project called Carbon (https://github.com/0sir1ss/Carbon) can be used for this purpose by slightly modifying the code.