> Is there any way to really protect source?

Of course, there are several possibilities to scrable and encrypt the code,
but in the end it has to be descrambled and decrypted in order to be
executed by the Python interpreter anyway, and a versatile hacker will
always be able to intercept the code here. So, you can make it a bit harder
to get your source, but you can't really protect it. If you only deliver
.pyc, at least the comments won't be there, and if you deliver only .pyo,
the docstrings won't be there, either. You could also use source code
obfuscators which would scramble the names of your variables and do some
tricks to make your source code hard to read and understand for others.

In real life, people don't use comments and docstrings anyway, and the code
is already so obscure that you cannot ofuscate it any further anyway ;-)

> There are only pyc files and I have edited Applicacion.config but is not
> working. Can you show me how to edit it.

Sorry, I just saw you need to patch ServletFactory.py also.
Otherwise, .pyc files will be not treated as executables,
but delivered to the client as binary files.

Here are the patches I made in order to use .pyo files.
With these patches, you can also use .py and .pyo together
(.py takes precedence). This is helpful in the development phase.

# Application.config
'ExtensionsToIgnore': ['.pyc', '.py~', '.psp~', '.html~', '.bak', '.tmpl'],
'ExtensionsToServe': ['.py', '.pyo'], # if specified, only extensions in
this list will be used
'UseCascadingExtensions': 1,
'ExtensionCascadeOrder': ['.py', '.pyo'], # needs ServletFactory patch!
'FilesToHide': ['.*', '*~', '*.bak', '*.tmpl', '*.config', '__init__.*',
'*.pyc'],
'FilesToServe': ['*.py', '*.pyo'], # if specified, only files matching these
patterns will be served

# ServletFactory.py:
# this patch is needed for running .pyc or .pyo files without .py
# normally .pyc and .pyo files would be delivered instead
# of being executed, which is a security problem also
# replace:
return ['.py']
# with:
 return ['.py','.pyc','.pyo']

# ImportSpy.py:
# this is needed when you want to use .pyo files
# replace:
if f[-4:] == '.pyc':
# with:
 if f[-4:] in ('.pyc', '.pyo'):

# Application.py:
# this is needed for allowing .py plus .pyc or .pyo index files
# this is a quick and dirty patch, a more sophisticated patch
# considering cascading extensions has already been submitted
# replace:
elif num>1:
# with:
elif num>3:

Gtx
Christoph Zwerschke



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to