Author Topic: Is this good way to protect the lisp from running out of the owner's computer?  (Read 2231 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1420
I am trying to protect the lisp from running out of the owner's computer.

I'll add these lines then compile to VLX

Code - Auto/Visual Lisp: [Select]
  1. (defun c:xxx (/)
  2.       (if (findfile "C:/TestFolder/TestFile.dwg")
  3.         (progn
  4.           (princ
  5.             (strcat "Welcome " (getvar "loginname") " to | HasanCAD |")
  6.           )
  7.                                         ;...the code
  8.         )
  9.         (alert (strcat "Welcome "
  10.                        (getvar "loginname")
  11.                        "\n You are out of | HasanCAD | PLease call | xxxxxxxx | for getting permisiom to run the code"
  12.                )
  13.         )
  14.       )
  15.     )
« Last Edit: January 14, 2017, 02:04:41 AM by HasanCAD »

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Alternatively, you could hardcode the MAC address - this is hardware-specific and will not change.

HasanCAD

  • Swamp Rat
  • Posts: 1420
Alternatively, you could hardcode the MAC address - this is hardware-specific and will not change.

How is this?

mailmaverick

  • Bull Frog
  • Posts: 494
Your computer has a specific MAC address which you can get from following function :-

Code: [Select]
(defun get_macaddress (/ query retval)
;;Source : http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/seial-number-etc/td-p/2674574
  (vl-catch-all-apply
    '(lambda ()
       (vlax-for item (setq query (vlax-invoke
                                    (vlax-invoke (vlax-create-object "WbemScripting.SWbemLocator") 'ConnectServer "." "root\\cimv2")
                                    'ExecQuery
                                    (strcat "select * " "from Win32_NetworkAdapterConfiguration " "where IPEnabled = True")
                                  )
                      )
         (setq retval (vlax-get item 'MACAddress))
       )
     )
  )
  (if query
    (vlax-release-object query)
  )
  retval
)

(if (eq 'your_hardcoded_MAC_address' (get_macaddress))
(progn Its your computer )
(progn Your code has been stolen !)
)

Please see following link to see MAC address in Windows :-
https://helpdesk.latech.edu/index.php?option=com_content&task=view&id=207&Itemid=79

Also note that if you have multiple Network Connections such as 'Local Area Connection' , 'Wireless Network Connection1' , 'Wireless Network Connection2' etc the MAC address would be different for each connection.

« Last Edit: January 14, 2017, 08:27:29 AM by mailmaverick »

Grrr1337

  • Swamp Rat
  • Posts: 812
In addition to Lee Mac and mailmaverick, might be better to use this structure (as I've seen before, being used/suggested before by MP and LM) :
Code - Auto/Visual Lisp: [Select]
  1. (defun C:test ( / MyCode )
  2.   (defun MyCode ( / )
  3.     ; <full code here>
  4.   )
  5.   (cond
  6.     ( (not get_macaddress) (princ "\nFunction get_macaddress is not loaded.") )
  7.     ( (not (eq MyMacAddress (get_macaddress))) (princ "\nYou have no permission to run this routine.") )
  8.     ( (not MyCode) (princ "\nThe code is not defined properly.") )
  9.     (T (MyCode) )
  10.   ); cond
  11.   (princ)
  12. ); defun C:test
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

HasanCAD

  • Swamp Rat
  • Posts: 1420
I belive the owner has a network
So it is better to use my option.

Thanks all

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
@HasanCAD:
If you are talking about custom software for one particular client this solution may work. But for software licensing in general I would choose a different option.

HasanCAD

  • Swamp Rat
  • Posts: 1420
@HasanCAD:
If you are talking about custom software for one particular client this solution may work. But for software licensing in general I would choose a different option.
This is a lisp protection only. in most of engineering offices the user want to get a copy of a good lisp. So we trying to be againest that illigal copy.
So wha tis another options you prefere?

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
For the protection of company Lisp files I would:
1. Compile the code (obviously).
2. Hide some 'unlock' data somewhere in the registry (harder to detect than a file).
3. Add a time limit to the code.
4. Perhaps also check (getvar 'loginname) against a (hardcoded/registry) list.

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
...And hash any value stored in the registry to make it harder to find.

HasanCAD

  • Swamp Rat
  • Posts: 1420
Thanks all for your value help.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Your computer has a specific MAC address which you can get from following function :-
As an aside:
I find it strange that the parent 'external' object is not released in the function. I often have doubts about what to release (only the parent or all 'external' objects), but I would always release the parent object.