LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Protect Python Code

Hi there,

 

is there a way to protect my *.py files, which I call from within LabView? Or is this going to be implemented into the *.exe file after I build the project (and if so, is this sufficent protection)?

 

Thanks

0 Kudos
Message 1 of 6
(3,955 Views)

@mw42 wrote:

is there a way to protect my *.py files, which I call from within LabView? Or is this going to be implemented into the *.exe file after I build the project (and if so, is this sufficent protection)?


It looks like the Python Node needs a path to a .py file - regardless if you run your code as a .vi or as an .exe

python-path.PNG

 

 

could you be more precise about "protection" ?

in terms like "read-only"?

in terms like encryption?

 

 

0 Kudos
Message 2 of 6
(3,896 Views)

The idea of Python is openness so in a way it goes against that, but put the file in a password protected zip? I think LV can handle that and the zip should work like a folder. I might be way off though.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 6
(3,882 Views)

@Yamaeda wrote:

The idea of Python is openness so in a way it goes against that, but put the file in a password protected zip? I think LV can handle that and the zip should work like a folder. I might be way off though.

/Y


I had that in mind to Smiley Very Happy

 

but I can't say if that would work,  ... any thoughts?

https://www.ni.com/en/support/downloads/tools-network/download.openg-libraries-for-labview.html

 

0 Kudos
Message 4 of 6
(3,825 Views)

Yes the Openg ZIP library has a possibility to extract files inside a password protected archive and even extract it directly into a memory buffer without the need to write it to a file on disk. However I'm not sure if the Python Node supports passing a in memory file as a string or always requires a path to a real file on disk. If it doesn't you still would need to save the file to a temporary location and then specify its name to the Python Node. And that temporary file would not be encrypted.

It still would allow to make reasonably sure that a user can't modify the file before being executed but he could intercept it and copy it and then read its contents.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 5 of 6
(3,800 Views)

I guess the other option is to have Exectute only-flag on the file or have the program run as a separate user and only have read access to that user.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(3,761 Views)