password protect python script

6456
6
02-28-2011 09:13 PM
BrandonMoore1
New Contributor
Hey everyone,

I was just wondering if anyone has had any luck password protecting a python script in a toolbox they've made.  I can right click on a model and select the Set Password, but this option is grayed out for my script.  Any suggestions?  By the way, I'm using Arc 10 with SP1.

Brandon
Tags (2)
0 Kudos
6 Replies
ChrisMathers
Occasional Contributor III
The difference is that the model is stored inside the toolbox. A script is stored outside the toolbox in whatever dir you put it in. This means that even if you password protect the tool in the toolbox, someone could just add the script again to another toolbox or navigate to the directory and run it from idle or commandline.
0 Kudos
BrandonMoore1
New Contributor
Hmmm...seems like you should be able to lock it down if it's intellectual property.  I was googling everything I could think of to find a solution and came across this site (http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000001wt000000).  What is in quotes below can be found near the bottom of the linked page.  Does this make any sense???

Brandon


"Python script tool misstatements
The following are some misstatements about Python script tools:

    * Misstatement�??Python is slow.
          o Actually, Python performs quite well compared to compiled languages (you can search the Web for benchmarks of Python compared to other languages). Some of these misstatements come from how ArcGIS implemented Python. In ArcGIS 9.2, Python code executed out-of-process and Python was slow when invoked from ArcGIS. However, since ArcGIS 9.3, Python runs in-process.
    * Misstatement�??You cannot protect your intellectual property with Python scripts.
          o In ArcGIS 10, you can embed your Python script in the toolbox and password-encrypt your code (your intellectual property is safe).
                + Caveat�??Only the script tool code is protected. If you have additional Python libraries, they will not be encrypted.
"
0 Kudos
ChrisMathers
Occasional Contributor III
If at 10, I didnt know this, you can store the script within the toolbox file than you would be able to password protect it. Thats very interesting. I feel however that you shoud add copyright clauses to your code as comments and allow users to take your code to use as their own. A very easy way to learn and create in python is through adaptation of other works. I know thats a bit open-sourcy for a forum surrounding a closed source program suite but In this aspect you should allow people to get at your code. Perhaps a Creative Commons set up if you arent planning to sell the script but still want to be acknowledged as its originator. If you look at some of the code pasted around here or on the resource center, we tend to mention with in code comments when parts have been borrowed from others.
0 Kudos
BrandonMoore1
New Contributor
I personally have no issues with sharing my code, I've done so on numerous occasions both with my toolsets and through the esri forums.  Problem becomes is the funding agency supporting my work requires all products to be protected in some manner, either through and encryption or password protection.  Although neither of these are foolproof, it makes it much more tedious for the average person to go in and alter the code.  I wonder if encrypting the folder containing the scripts would work or if it would still need the encryption key to run the python code. 

Brandon
0 Kudos
ChrisMathers
Occasional Contributor III
That would probably cut off the toolbox from being able to get to the folder. Your best bet would be to find how to store the code inside the toolbox.
0 Kudos
ChrisFox3
Occasional Contributor III
  What is in quotes below can be found near the bottom of the linked page.  Does this make any sense???

Brandon"


Brandon,

Check out the following help topic. This should accomplish what you are looking for:

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Embedding_scripts_and_password_protect...
0 Kudos