How protect proprietary Python code? (bytecode obfuscation?, what better?)
Fredrik Lundh
fredrik at pythonware.com
Tue Apr 18 06:21:53 EDT 2006
"Daniel Nogradi" wrote:
>> char secret_code[] = "print 'moshe'";
>>
>> int main()
>> {
>> return PyRun_SimpleString(secret_code);
>> }
>>
>> and you need to link with python24.lib or whatever the object file is
>> for your platform.
>
> Are you sure? On a linux platform I tried linking with libpython2.4.so
> (I assume this is the correct object file) but it segfaults in
> PyImport_GetModuleDict( ).
I still don't understand why you think that embedding the *source code* in a variable
named "secret" will do a better job than just putting the byte code in some non-obvious
packaging, but if you insist on embedding the code, reading the documentation might
help:
http://docs.python.org/ext/embedding.html
"At the very least, you have to call the function Py_Initialize()"
http://docs.python.org/ext/high-level-embedding.html
(minimal PyRun_SimpleString example)
</F>
More information about the Python-list
mailing list