naichuan-zhang / handin-system-ul

3 stars 1 forks source link

Obfuscation of the python code #1

Open shallyyy opened 4 years ago

shallyyy commented 4 years ago

https://github.com/naichuan-zhang/handin-system-ul/blob/f9c42dfd6823b65e938af870229cbabc75039d19/script_download_server.py#L190

Once you've finished up with creating and modyfing the handin.py file it's probably best to add a layer of obfuscation. Essentially it means to make the code unreadable to users. Python has a built in compiler to byte-code: python -OO -m py_compile handin.py

This produces a .pyo file that contains byte-code, and where docstrings are removed, etc. You can rename the .pyo file with a .py extension, and handin.py runs like your program but does not contain your source code. This is likely enough to deter any students that get their hands on the handin.py file from figuring out how to break the system.

However this isn't 100% safe, https://github.com/Mysterie/uncompyle2 is a tool that can recover lots of the code and names so this should just be the first safety net.

Could you point me to where the application runs grading?

naichuan-zhang commented 4 years ago

https://github.com/naichuan-zhang/handin-system-ul/blob/f9c42dfd6823b65e938af870229cbabc75039d19/system_server.py#L307

Here is where the grading logic starts.