Forum: Poser Python Scripting


Subject: Encrypted python scripts: possible somehow ?

papillon68 opened this issue on Sep 25, 2010 · 14 posts


papillon68 posted Sat, 25 September 2010 at 3:54 PM

I'm afraid I already know the answer, but I'll ask anyway.
I would like to know if there is any way to encrypt or create python binary scripts for Poser, so that a commercial plugin wouldn't show the source code.
What Daz does is very good, it gives the possibility to wether release plugins in text or binary.
Thanks

visit my blog:  www.alessandromastronardi.com

My Rendo Store


markschum posted Sat, 25 September 2010 at 4:38 PM

Yes , its not that hard , use compile to create a .pyc file. 

I have done a couple of things but people who sell utilities done in python would do it as a matter of course.  I use a script to contain the compile command . Check the  python manuals for the version you use.

compile( string, filename, kind[, flags[, dont_inherit]])


bagginsbill posted Sat, 25 September 2010 at 4:38 PM

Python files distributed in PYC form (the compiled file) are binary.

My matmatic scripts were distributed this way and nobody has ever seen the code.

There are always people on this forum telling stuff they don't know about. When you hear somebody say Python scripts are only in source code form, they are wrong.

I can also encrypt Python and hide it in anything. I have demonstrated this before. I can hide them in JPEG files and run them without you even being aware that you have a script as part of a package.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill posted Sat, 25 September 2010 at 4:39 PM

x-post again - 2nd time in a week that mark is faster than me!


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


papillon68 posted Sat, 25 September 2010 at 5:57 PM

Thanks very much for the informations BagginsBill. So basically one could compile python scripts (I suppose also with python shell commands) and Poser would accept those .pyc's same as .py's

Interesting !

visit my blog:  www.alessandromastronardi.com

My Rendo Store


papillon68 posted Sat, 25 September 2010 at 6:21 PM

I'd like also to ask which python compiler is most recommended for Poser: I'm using IDLE (python version 3.1.2) and it doesn't accept the "import poser" call, thus aborting compile operations.
Thanks

visit my blog:  www.alessandromastronardi.com

My Rendo Store


markschum posted Sat, 25 September 2010 at 6:27 PM

I believe you have to compile from within Poser, using the Poser version of Python , which for Poser 7 is I believe Python 2.4

Bagginsbill or Philc can probably help more on the procedure.  I dont remember it being particularly difficuult.


papillon68 posted Sat, 25 September 2010 at 6:33 PM

That's right, the compiler is integrated in Poser.
I run the following commands

import py_compile
py_compile.compile('helloworld.py')

And it worked just fine. Thank you very much

visit my blog:  www.alessandromastronardi.com

My Rendo Store


markschum posted Sat, 25 September 2010 at 6:44 PM

Well , there ya go . Was it the answer you thought in your first post ?

@bagginsbill, you were thinking deep thoughts, my head is basically empty, so much faster :lol:

Poser documentation on python is really bad. If you get the documentation for Python itself you will see how powerful it can be , and why compiled scripts need to be from reliable sources. I have often wondered how far a malicious script would get.  


bagginsbill posted Sat, 25 September 2010 at 10:42 PM

How far? It can steal your hard drive contents entirely. It can watch every keystroke you make. It can see every web page you visit. It can copy every password you type. It can get into your bank account. It can max out your credit cards.

That s how far a script could get.

People should only download content from reputable sources. And don't expect a virus detector or malware detector to understand a Poser python script. I can copy and wipe your hard drive a million ways and none of the professional malware programs would ever know.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


papillon68 posted Sun, 26 September 2010 at 12:35 AM

Quote - Well , there ya go . Was it the answer you thought in your first post ?

Yes, thanks

visit my blog:  www.alessandromastronardi.com

My Rendo Store


PhilC posted Sun, 26 September 2010 at 4:48 AM

If your script is "myScript.py" you can compile it by running the script below:-

###############
import myScript

###############

Save the script in the same folder as myScript.py

You may find this Python for Poser of interest.

I would have killed for it when I started writing Python scripts :)


semidieu posted Sun, 26 September 2010 at 6:37 AM

Notice that there are some way to uncompile scripts... with older version of Python, there was somewhere a free script that did this.

For newer version (like Python 2.4 (Poser version) or better), I know they are some web site that offer this...


papillon68 posted Mon, 27 September 2010 at 4:19 PM

Quote -

You may find this Python for Poser of interest.

I would have killed for it when I started writing Python scripts :)

Yes I got that, very useful indeed !

visit my blog:  www.alessandromastronardi.com

My Rendo Store