Mike55 Posted July 9, 2020 Share Posted July 9, 2020 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)) Quote Link to comment Share on other sites More sharing options...
Steven P Posted July 9, 2020 Share Posted July 9, 2020 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. Quote Link to comment Share on other sites More sharing options...
Mike55 Posted July 9, 2020 Author Share Posted July 9, 2020 The hole code is all .vlx or .fas and the usb is write protected. Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted July 9, 2020 Share Posted July 9, 2020 ; 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)) ) Quote Link to comment Share on other sites More sharing options...
ronjonp Posted July 9, 2020 Share Posted July 9, 2020 (edited) 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 July 9, 2020 by ronjonp Quote Link to comment Share on other sites More sharing options...
Mike55 Posted July 9, 2020 Author Share Posted July 9, 2020 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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 10, 2020 Share Posted July 10, 2020 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:"))) Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted July 11, 2020 Share Posted July 11, 2020 @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)) Quote Link to comment Share on other sites More sharing options...
myloveflyer Posted July 12, 2020 Share Posted July 12, 2020 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. Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted July 12, 2020 Share Posted July 12, 2020 You would not give out code you want to protect as open source (obviously). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.