Jump to content

usb drive serial number


Mike55

Recommended Posts

Is there a way to get the serial number off a usb flash drive using lisp.  I would like to use the serial number to lock my program to a usb flash drive by having lisp match that number.

 

Or add a file to the C drive and have lisp look for it and if it's not stop the program from running. 

(if (= num 025563)(setq run 123))

(if <> num 025563)(setq run 456))

Link to comment
Share on other sites

I'm not sure how to do that but I remember posts a while back asking how to secure a LISP so that others can't read / copy / modify it. i think the basic answer is that you can't do that with just LISPS. So even if you lock a LISP to look for a USB drive serial number someone could open the LISP and modify the code to remove that part.

 

 I might be wrong, of course.

Link to comment
Share on other sites

; 20170115
(defun KGA_Sys_Hardware_MediaIdList ()
  (KGA_Sys_X_Hardware_Query "SELECT * FROM Win32_PhysicalMedia" 'SerialNumber)
)

; 20170115
(defun KGA_Sys_X_Hardware_Query (qry val / loc ret)
  (vl-catch-all-apply
    (function
      (lambda ()
        (vlax-for
          itm
          (vlax-invoke
            (vlax-invoke
              (setq loc (vlax-get-or-create-object "WbemScripting.SWbemLocator"))
              'ConnectServer
              "."
              "root\\cimv2"
            )
            'ExecQuery
            qry
          )
          (setq ret (cons (vlax-get itm val) ret))
        )
      )
    )
  )
  (if loc (vlax-release-object loc))
  (reverse (vl-remove nil ret))
)

 

Link to comment
Share on other sites

3 hours ago, Mike55 said:

Is there a way to get the serial number off a usb flash drive using lisp.  I would like to use the serial number to lock my program to a usb flash drive by having lisp match that number.

 

Or add a file to the C drive and have lisp look for it and if it's not stop the program from running. 

(if (= num 025563)(setq run 123))

(if <> num 025563)(setq run 456))

Why is a flash drive part of protecting your code?

(if (/= num 025563)(setq run 456))

 

Edited by ronjonp
Link to comment
Share on other sites

By add a script to find something that can not be found easily I can use that information to have lisp check for that information and open or not open the program. That way if the usb is copy it will not work if the information is on the computer and not the flash drive or on the flash drive not on the computer.

Link to comment
Share on other sites

Can do same for hard disk get serial number, do ping get IP etc a few other ways.

 

Do a real time check a remote server. Like the way Autocad works now.

(defun pingserver ( / xml str)
(setq server "http://BIGAL.com.au/TestInfo.txt") ; I would change this to get passed a unique filename
(setq xml (vlax-create-object "MSXML2.XMLHTTP.3.0"))
(vlax-invoke-method xml 'open "POST" server :vlax-false
(vlax-invoke-method xml 'send)
(setq str (vlax-get-property xml 'responsetext))
; got your file !!!!!

;do your bit here

)

or this but the drive letter may be a problem as it depends on how many usb are plugged in.

(setq ser (vla-get-Serialnumber (vlax-invoke (vlax-create-object "Scripting.FileSystemObject") 'getdrive "c:")))

 

Link to comment
Share on other sites

@Mike55

 

In answer to your PM:

The KGA_Sys_Hardware_MediaIdList function will return a list of serial numbers (as strings) for all physical media (HD, USB, DVD, etc.). To verify if an USB is connected you would need to check if its serial number is present in the list (with vl-position or member).

(vl-position "abc123" (KGA_Sys_Hardware_MediaIdList))

 

 

Link to comment
Share on other sites

Hi,ROY.

Give the specific serial number and then look it up, so that it becomes the clear code. For cracking, the clear code is most likely to be destroyed.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...