ironmankho Posted November 5, 2008 Share Posted November 5, 2008 Getting USB unique ID i know very well in auto it a function named get serial # is also available ........my question is it is unique or not .e.g when i format it will change ?how it is possible to get this type of info via autoit .................OR another possible method to getting unique # info . i have Kingston data traveler 4 GB DTI Thanks for reading waiting for answer Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 5, 2008 Share Posted November 5, 2008 Serial numbers usually are unique,at least per machine. Why do you need this information? Perhaps someone here can think of a better method to do what you want, or a simpler one if not better. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
ironmankho Posted November 5, 2008 Author Share Posted November 5, 2008 (edited) thanks for kind reply .... actually i want develop dongle type application .... it only run from Authorized USB ...what is your Idea ? Edited November 5, 2008 by ironmankho Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 5, 2008 Share Posted November 5, 2008 (edited) Well a few ideas would be to setup a database and check the data from the drive against that or have a registration file inside the drive. Those can't be reproduced because they're unique for each computer/drive. CODE;========================================================================================== ========= ==================================================================================================== ================================================================================================= #include <date.au3> #include <string.au3> #include <array.au3> Global $Debugit = 1 Local $securityCodeEncryptionKey = "somepassword";this must match the key generator Global $mac = StringUpper (StringReplace (_GetMAC(),":","") & StringRight ( Hex(@mon),1)); this makes the mac address only valid during this month or registration, so if they discover the fake dll and delete it, the code only registers during this month of cousre they could figure on putting it back to the original registration month Global $Generate = StringRight ($mac,5) Global $restore = StringUpper (_StringEncrypt (1, $Generate, $securityCodeEncryptionKey , 1 )) Global $myFakeDll = @Windowsdir & "\CBfu11.dll"; I suggest using a prefix of T for Trial software in the dllname and be sure it's not a dll name that is going to already exist you could hide it in the windows directory or anywhere else really Global $trialPeriod = -1;days (use -1 if not trial software just regkey licenced) Global $applicationName = "Choas Bot" Global $dllEncKey = "O59yuey93";you can change this to whatever you like it is the ini encryption if made too long and it takes longer to read and write Global $dlliniSection = Encrypt("iniSectionName");you can change this too if you really want to If NOT FileExists ($myFakeDll) then EnterNewCode() EndIf $validation = CheckValidation() ;============================================Main app Starts here============================================ If $validation <> -1 then Msgbox(0,"","This is the main application start point" & @crlf & "If you can see this then you have a successfully registered application" & @crlf & "You have " & $validation & " Days left to evaluate this software") Else Msgbox(0,"","This is the main application start point" & @crlf & "If you can see this then you have a successfully registered application") EndIf Func EnterNewCode() ClipPut ($mac & "F") $entered = InPutBox ("Register", "This software is not freeware. Please email" & @crlf & "chaosbotncp@hotmail.com to obtain a registration code." & @crlf & "Please quote the following Code: " & @crlf & @crlf & $mac & "F" & @crlf & @crlf & "It has been placed on the clipboard for easy usage." & @CRLF & @CRlf & "Enter the unlock code below:","","",-1,250) If @error = 1 then Exit;CANCEL WAS PRESSED If $entered = $restore then MsgBox (262144,$applicationName,"Successfully Registered") IniWrite ($myFakeDll,$dlliniSection,Encrypt ("DecodeKey"),Encrypt ($restore)) IniWrite ($myFakeDll,$dlliniSection,Encrypt ("GeneratedMac"),Encrypt ($Mac)) If $trialPeriod <> -1 then IniWrite ($myFakeDll,$dlliniSection,Encrypt ("RegDate"),Encrypt (_NowCalcDate())) $sysprep = _DateAdd ( "D", $trialPeriod, _NowCalcDate() ) IniWrite ($myFakeDll,$dlliniSection,Encrypt ("FinalDate"),Encrypt ($sysprep)) IniWrite ($myFakeDll,$dlliniSection,Encrypt ("LastRunDate"),Encrypt (_NowCalcDate())) IniWrite ($myFakeDll,$dlliniSection,Encrypt ("Count"),Encrypt (0)) endif Else MsgBox (262144,"Error","Registration code is incorrect") Exit EndIf EndFunc;==> EnterNewRegCode() Func CheckValidation() $RecordedMacCheck = StringLeft (StringRight (Decrypt (IniRead ($myFakeDll,$dlliniSection,Encrypt ("GeneratedMac"),"Eric")),5),4) $MacCheck = StringLeft (StringRight ($mac,5),4) If $RecordedMacCheck <> $MacCheck then Debug ("Recorded Mac = " & $RecordedMacCheck) Debug ("Macaddress = " & $MacCheck ) Debug ("The Mac code didn't match") If FileExists ($myFakeDll) then FileDelete($myFakeDll) EnterNewCode() Return -1 EndIf If $trialPeriod = -1 then return -1 Splashtexton ($applicationName,@crlf & "This is evaluation software",250,60) $finalDateCheck = Decrypt ( IniRead ($myFakeDll,$dlliniSection, Encrypt("FinalDate"),"")) $RegDateCheck = Decrypt ( IniRead ($myFakeDll,$dlliniSection, Encrypt("RegDate"),"")) $LastRunDateCheck = Decrypt ( IniRead ($myFakeDll,$dlliniSection, Encrypt("LastRunDate"),"")) $CountCheck = Number( Decrypt ( IniRead ($myFakeDll,$dlliniSection, Encrypt("Count"),"")) ) If _DateDiff ("D", _NowCalcDate(),$finalDateCheck) < 0 Then ;the date is 14 days past the registration date Debug ("passed the " & $trialPeriod & " days Expired " & _DateDiff ("D",$finalDateCheck, _NowCalcDate() ) ) SplashOff() Msgbox (262144,$applicationName,"Evaluation Expired") IniWrite ($myFakeDll,$dlliniSection,Encrypt ("Count"),Encrypt ($trialPeriod + 1)) Exit EndIf If _DateDiff ("D",$LastRunDateCheck,_NowCalcDate()) < 0 Then ;they have changed the clock bacwards so expire Debug ("Clock date is set before last run date") SplashOff() Msgbox (262144,$applicationName,"Date tampering detected Evaluation Expired") IniWrite ($myFakeDll,$dlliniSection,Encrypt ("Count"),Encrypt ($trialPeriod + 1)) Exit EndIf If $CountCheck >= $trialPeriod then;second method for checking days used ;trialPeriod days are up so expire Debug ("Count is greater than " & $trialPeriod) SplashOff() Msgbox (262144,$applicationName,"Evaluation Expired") Exit EndIf If _NowCalcDate() <> $LastRunDateCheck Then;if the date is different to the last ran date then increase the days used by 1 $CountCheck += 1 Debug ("Increase the used count; Count is now " & $CountCheck) IniWrite ($myFakeDll,$dlliniSection,Encrypt ("Count"),Encrypt ($CountCheck)) IniWrite ($myFakeDll,$dlliniSection,Encrypt ("LastRunDate"),Encrypt (_NowCalcDate()));log the new last run date EndIf Sleep (2000) SplashOff() Return ($trialPeriod - $CountCheck) EndFunc;==> CheckValidation() Func Encrypt ($string) Return _StringEncrypt (1, $String, $dllEncKey , 1 ) EndFunc;==> Encrypt() Func Decrypt ($String) Return _StringEncrypt (0, $String, $dllEncKey , 1 ) EndFunc;==> Decrypt() Func Debug ($var) If $Debugit then ConsoleWrite ($var & @crlf) EndFunc;==> Debug to Scite() Func _GetMAC($getmacindex = 1) $ipHandle = Run(@ComSpec & ' /c ipconfig /all', '', @SW_HIDE, 2) $read = "" Do $read &= StdoutRead($ipHandle) Until @error $read = StringStripWS($read,7) $macdashed = StringRegExp( $read , '([0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2})', 3) If Not IsArray($macdashed) Then Return 0 If $getmacindex < 1 Then Return 0 If $getmacindex > UBound($macdashed) Or $getmacindex = -1 Then $getmacindex = UBound($macdashed) $macnosemicolon = StringReplace($macdashed[$getmacindex - 1], '-', ':', 0) Return $macnosemicolon EndFunc;==>_GetMAC keygenerator: (not really needed if incorporated but helpful to keep separate to ensure only authorized devices run) #Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=chaos.ico #AutoIt3Wrapper_outfile=Chaos Bot Keygen.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Allow_Decompile=n #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** ; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.2.4.9 ; Author: Chris Lambert ; ; Script Function: KeyGen for trial/licensed software ; Template AutoIt script. ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include<string.au3> Local $securityCodeEncryptionKey = "somepassword";this must match the applications key $str = InputBox ("ISS Drive Check Registration","Input code") $str = StringTrimRight( $str, 1) If @error = 1 then exit $Generate = StringUpper (StringRight ($str,5)) $restore = StringUpper(_StringEncrypt (1, $Generate, $securityCodeEncryptionKey , 1 )) ClipPut ($restore) Msgbox (0,"ISS Drive Check","The registration code is: " & $restore & @crlf & @crlf & "The code has been placed on the clipboard") All you need to do is change "somepassword" to whatever you want your password to be (make sure it's the saem in the keygen and program) and then your program won't work withouth authorization. Also change my registration email to whatever you want yours to be. This is much easier to read in SciTE so it will make more sense there. Edited November 5, 2008 by dbzfanatic Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
torels Posted November 5, 2008 Share Posted November 5, 2008 Easyer: File streams or File Contents or File Presence or Drive's Serial maybe combined with drive's total space and label Maybe not the safest thing in the world but it's very simple Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
ironmankho Posted November 5, 2008 Author Share Posted November 5, 2008 above code really help full and more in detail .but i am sorry to say it not fulfill my work ..................i want only get Uinque ID of USB than it pass to multimedia builder http://mmb.mediachance.com/index.html..... Link to comment Share on other sites More sharing options...
Kip Posted November 5, 2008 Share Posted November 5, 2008 Cool, you're from mmb too? Haven't used in years, but thats how I got here. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ironmankho Posted November 5, 2008 Author Share Posted November 5, 2008 creating a GUI apllication in MMB is very easy as comparare to Autoit .........but it is almost true Autoit is more powerful Link to comment Share on other sites More sharing options...
torels Posted November 5, 2008 Share Posted November 5, 2008 chrome says the link you posted is infected and not safe Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
Richard Robertson Posted November 5, 2008 Share Posted November 5, 2008 Have you tried DriveGetSerial? Link to comment Share on other sites More sharing options...
ironmankho Posted November 5, 2008 Author Share Posted November 5, 2008 Have you tried DriveGetSerial?dbzfanaticSerial numbers usually are unique,at least per machine Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 5, 2008 Share Posted November 5, 2008 I haven't really needed to check serials between machines so they may not be,but afaik they are, so that honestly should work. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
spudw2k Posted November 6, 2008 Share Posted November 6, 2008 (edited) How about the PNPDeviceID? *The example below only works with Fixed or Removable drives. CDrom and Network drives fail because of WMI calls.expandcollapse popup$drive = StringLeft(FileSelectFolder("Pick a Drive",""),2) $id = _GetPNPDeviceID($drive) msgbox(0,$id,"") Func _GetPNPDeviceID($drive,$fullid=0) $objWMIService = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\.\root\cimv2") If Not IsObj($objWMIService) Then Return -1 ;Failed to Connect to WMI on Local Machine $colDevice = $objWMIService.ExecQuery("SELECT * from Win32_LogicalDiskToPartition") $var="" For $objItem in $colDevice If StringInStr($objItem.Dependent,$drive) Then $var=StringTrimLeft($objItem.Antecedent,stringInstr($objItem.Antecedent,"=")) EndIf Next If Not $var Then Return -2 ;Failed to Find Drive Letter $colDevice = $objWMIService.ExecQuery("SELECT * from Win32_DiskDriveToDiskPartition") $diskpartition = $var $var="" For $objItem in $colDevice If StringInStr($objItem.Dependent,$diskpartition) Then $var=StringTrimLeft($objItem.Antecedent,stringInstr($objItem.Antecedent,"=")) EndIf Next If Not $var Then Return -3 ;Failed to Find Physical Drive # $colDevice = $objWMIService.ExecQuery("SELECT * from Win32_DiskDrive") $physicaldrive = StringReplace(StringReplace($var,"\\","\"),'"',"") $var="" For $objItem in $colDevice If $objItem.DeviceID = $physicaldrive Then $var=$objItem.PNPDeviceID EndIf Next If Not $var Then Return -4 ;Failed to Find PNPDeviceID If Not $fullid Then $var = StringTrimLeft($var,StringInstr($var,"\",0,-1)) ;Return Ugly Full PNPDeviceID Return $var EndFunc Edited November 6, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF  Link to comment Share on other sites More sharing options...
ironmankho Posted November 6, 2008 Author Share Posted November 6, 2008 Thanks ..... i get value from this "5B721B8A98A4&0" ....BTW it is unique means it is depended on my USB flash drive or OS Link to comment Share on other sites More sharing options...
spudw2k Posted November 6, 2008 Share Posted November 6, 2008 (edited) It is dependent of the device, yes. I tested this on many PCs and got the same ID. Updated example. Edited November 6, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF  Link to comment Share on other sites More sharing options...
ironmankho Posted November 6, 2008 Author Share Posted November 6, 2008 Just waiting for your kind reply Link to comment Share on other sites More sharing options...
spudw2k Posted November 6, 2008 Share Posted November 6, 2008 Just waiting for your kind reply Who me? see last post on first page. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF  Link to comment Share on other sites More sharing options...
ironmankho Posted November 6, 2008 Author Share Posted November 6, 2008 (edited) Yes !!! you ............ first i read "updating" now i read "updated" .......my result "5B721B8A98A4&0" on 1st PCmy result "5B721B8A98A4&0" on 2nd PCworking good !!! Thanks for help Edited November 6, 2008 by ironmankho Link to comment Share on other sites More sharing options...
spudw2k Posted November 6, 2008 Share Posted November 6, 2008 (edited) No prob. Now, you may get the same ID if two of the same USB drives are used. I haven't tested that as I do not have two of the same type of thumb drives.I was able to test this using two GeekSquad 1GB sticks that were purchased from the same store within a week apart from each other.USBSTOR\DISK&VEN_BEST_BUY&PROD_GEEK_SQUAD_U3&REV_6.50\0C11096090E2199F&0USBSTOR\DISK&VEN_BEST_BUY&PROD_GEEK_SQUAD_U3&REV_6.50\0CD1096091420B8B&0ID's appears to be unique for each device as well. edit:tested with two more similar drives. Unique. I assume they have to be, otherwise, how would the pc know how to identify each one accurately. Edited November 10, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF  Link to comment Share on other sites More sharing options...
ironmankho Posted November 6, 2008 Author Share Posted November 6, 2008 (edited) ok !!! next day i will post more result ......hope magic will work 988000000000000045B46330-&0 - kingston DT100 1GB 5B871B-000031-&0 - kingston DTi-1014GB 5B721B-8A98A4-&0 kingston DTI 4 GB 200809010000000000000027&0 -kingston 8 GB DTI 5B841E0044C3&0 - kingston 1 GB DTI Edited December 9, 2008 by ironmankho Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now