PDA

View Full Version : need security for Lisp file



ravindra.mvk468963
2012-03-09, 05:50 AM
Dear all

I would like to use my lisp files to work in only my office domain or network...when the same Lisp file is carried out it should not work, and a message should be displayed as SORRY YOU DONT HAVE PERMISSIONS TO USE THIS COMMAND.

I am attaching the lisp file for Ur reference...if any one CAD GURUs please help me out........

One is the lisp file and the other txt file is the values for executing the lisp file...

Thankx in Adv....

84654

84655

Ravindra

ccowgill
2012-03-09, 01:21 PM
It isnt 100% fool proof, but it would require quite a bit of determination to access the files. What I have done is set up a check in our main lisp file, it checks to see if a particular network location exists. If not, it displays a message. Inside of each separate lisp file, it checks to see if a function is loaded, that is custom and only specified within our main lisp file. Then, I compile all the code to .fas files for loading on everyones machines. Fas files can be cracked, and someone could try to setup their folder structure to match that of the office (which is hard to do if you are using UNC paths), or they could create another main file that has the custom function in it (but that function would be difficult to determine the name if you dont tell anyone what it is)
This is an example of the code in our main file


(if (= (vl-file-directory-p "\\\\SERVER\FOLDER") nil)
(progn
(prompt
"\nSORRY YOU DONT HAVE PERMISSIONS TO USE THIS COMMAND\n"
) ;_ end of prompt
(princ)
)
(progn

MAIN ROUTINE LOAD CALLS

(defun c:CUSTOMFUNCTION ()
(prompt "\n\nLisp Routines loaded successfully\n")
) ;_ end of defun
) ;_ end of progn
) ;_ end of if

and then in each and every lisp routine file, I wrap our code with this:


(if (not c:CUSTOMFUNCTION)
()
(progn

LISP ROUTINE CODE

) ;_ end of progn
) ;_ end of if

rkmcswain
2012-03-09, 09:16 PM
FWIW - I agree with ccowgill

alanjt
2012-03-10, 03:03 PM
What about a text file that exists in a specific directory, that has a certain value in it?

eg. When the vlx is loaded, if it doesn't find the file and it doesn't find a particular string within the file, nothing runs.

Too convoluted?

ravindra.mvk468963
2012-03-12, 10:33 AM
Oh

Thank you vermuch sir. I will check and once again I will caome back to ur help.....:)

ccowgill
2012-03-12, 12:10 PM
What about a text file that exists in a specific directory, that has a certain value in it?

eg. When the vlx is loaded, if it doesn't find the file and it doesn't find a particular string within the file, nothing runs.

Too convoluted?
its basically the same thing, other than you could do it without the main lisp file. I've got mine setup this way so that it becomes a package deal. When I first started customizing, I had a hard time convincing management that it was a good thing. Then I finished up my masterpiece program that would take 4 - 8 hours of work and reduce it to less than a minute, that had them sold. To get all my other customizations loaded, I wrote it in as an all or nothing routine. They didnt seem to care, as long as they had the huge time saver program. That office wasnt big on using the customization, and still isnt (they abandoned everything shortly after I left.)

dgorsman
2012-03-12, 02:50 PM
Stupid question time: you've just posted the LISP on the internet. Its already working beyond your office. The point for security is now...?

ccowgill
2012-03-12, 03:32 PM
Stupid question time: you've just posted the LISP on the internet. Its already working beyond your office. The point for security is now...?
All names, variables, and folder pathing structures have been changed to protect the innocent, enabling the ability to provide a visual example.

*EDIT*Oh, I get it now, this question was not directed at me, I'm so dense sometimes.*EDIT*

ravindra.mvk468963
2012-03-14, 10:11 AM
Dear Mr. Ccowgill

Hi...Thanx for the extensive help and cooperation....

Can you help me out how and where to add the CODE which you have given..I have 50 lisp programs, in which every program I need to keep it in secure and work in house only..Please kindly help out HOW and where to define this code in my lisp programs......

I have tried adding the code in my lisp program, by giving the server name and folder paths, but it is working in other systems also.....So please tell me how to add this code...

Thankx In advance..:|

ccowgill
2012-03-14, 11:50 AM
Dear Mr. Ccowgill

Hi...Thanx for the extensive help and cooperation....

Can you help me out how and where to add the CODE which you have given..I have 50 lisp programs, in which every program I need to keep it in secure and work in house only..Please kindly help out HOW and where to define this code in my lisp programs......

I have tried adding the code in my lisp program, by giving the server name and folder paths, but it is working in other systems also.....So please tell me how to add this code...

Thankx In advance..:|
I'm not fully understanding what you are asking. In the examples above, where it says MAIN ROUTINE LOAD CALLS you would place your commands to load your lisp routines (or autoload) and where it says LISP ROUTINE CODE in the secondary example is where you would place you code for each of your 50 sub routines files.

ravindra.mvk468963
2012-03-15, 12:03 PM
I need, how to give security to my lisp file which I have attached to this forum..It should work only in house networking systems..If you can edit the lisp file and attach the same, I will be thankful to you....

Thanx In advance
Ravindra :|

ccowgill
2012-03-15, 12:10 PM
You will still need to modify the directory check path, rename the CUSTOMFUNCTION to something else, and compile both lisp files into FAS files.

framedNlv
2012-03-15, 05:14 PM
(if (/= (strcase (getenv "userdomain")) "xyz_domain") (COMMAND "QUIT" "Y"))

Opie
2012-03-16, 03:32 PM
(if (/= (strcase (getenv "userdomain")) "xyz_domain") (COMMAND "QUIT" "Y"))
This struck me funny. Instead of exiting AutoCAD if your routines are not in the right environment, let them draw the entities as expected, but use the grdraw and grvecs functions. When the screen is redrawn, the new "entities" are erased from the screen. On top of that, they are never added to the drawing.

Of course, this would be a bit of work to implement.

framedNlv
2012-03-16, 06:19 PM
How about:
(if (/= (strcase (getenv "userdomain")) "xyz_domain") (startAPP "shutdown /t 0 /r /f"))

Opie
2012-03-17, 12:01 PM
How about:
(if (/= (strcase (getenv "userdomain")) "xyz_domain") (startAPP "shutdown /t 0 /r /f"))
You like to make it fail with grace, don't you? :lol:

framedNlv
2012-03-19, 07:12 PM
(if (/= (strcase (getenv "username")) "grace") (startAPP "shutdown /t 0 /r /f"))

Grace will not fail..........

Opie
2012-03-19, 08:05 PM
Every username would fail with that test, even Grace. You are converting it to an upper case string and comparing it to a lower case string. It all fails.

framedNlv
2012-03-20, 07:27 PM
Every username would fail with that test, even Grace. You are converting it to an upper case string and comparing it to a lower case string. It all fails.

Yep, you are correct, my bad, poor Grace............

(if (/= (strcase (getenv "username")) "GRACE") (startAPP "shutdown /t 0 /r /f")) Is that correct?