pyc file problem

L

Leo Yee

Hi,

I am programming a online game program. I use python as my game's script
language. To avoid hacking and cheating I don't want anyone to read the
python script file and find useful information for hacking the game.

I know I can compile the '.py' file to '.pyc' file but I found that a normal
text editor can read a lot of information from the '.pyc' file even those
comments I wrote.

My question is if there is a methond to compile the '.py' file into a state
that there are no human readable strings.

Thanks in advance.

Leo Yee
 
S

sid

i doubt there are any good name manglers for python.especialy with it being
dynamic.

you could encrypt your game files. of course the loader would have to be
mangled by hand.

if you are keen on this you could look at the tempfile and imp modules.

this is not foolproof. people could still step through your code and crack
it.

just wondering, is it smart to have any of the game's logic on the users
machine. i can see a lot of situations other than hacking and cracking the
code that could lead to problems.
 
P

pythonhda

You can also compile the .py to a python optimized file .pyo. That'll get rid of the comments.

Check out the "py_compile" module in the documentation.

The easiest way to do it would be to invoke python with the -O flag and import your module to generate the .pyo file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top