Jump to content

Unique PC Identifier


anixon
 Share

Recommended Posts

What serial number can I read that is exclusive to each and every PC . I am familure with @ComputerName, @UserName and DriveGetSerial() but these are all variables which are dynamic even the HDD can be swapped. Given that most motherboards today have inbuilt Network Cards I was thinking perhapes the Serial Number of the card or the motherboard would be ideal. If this is available what AutoIT function would you use to read it or alternatively is their any other unique identifier available.

Asssistance is always appreciated

Ant.. :shocked:

Sorry I have posted this in the wrong area by mistake can it be moved to the General Support Forum. Thanks

Ant

Edited by anixon
Link to comment
Share on other sites

If you're okay with the knowledge that network cards can be swapped out too, MAC addresses are unique (Run(@comspec & " /c getmac>"&@UserProfileDir&"\desktop\mac.txt"). Also, the Date and Time Windows was installed (to the 1/1000th of a second) is stored in the registry...that number would obviously not survive an OS change, but I've used that before.

Any of those sound good?

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

You can probably get the CPU serial number with some API/WMI trickery. Do a search with the words +ExecQuery +CPU

The MAC address of the nicks are easily found with samples from the forum. Use the search page..:shocked:This could be a start

Link to comment
Share on other sites

If you're okay with the knowledge that network cards can be swapped out too, MAC addresses are unique (Run(@comspec & " /c getmac>"&@UserProfileDir&"\desktop\mac.txt"). Also, the Date and Time Windows was installed (to the 1/1000th of a second) is stored in the registry...that number would obviously not survive an OS change, but I've used that before.

Any of those sound good?

Thanks for your help what is the key for the date time windows was instaled?

Ant..

Link to comment
Share on other sites

I think that this is probably unique ID for each PC

RegRead("HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\", "ProductID")

aNT..

IIRC its not always unique because if a volume key is used it would be the same on all PCs that used that key.

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Thanks for your help what is the key for the date time windows was instaled?

Ant..

If you're still interested, you can run the script:
#include <Date.au3>
MsgBox(0,"Date installed",_DateAdd("s",RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "InstallDate"),"1970/01/01 01:00:00"))
to see the date. The pure registry entry is just a long number, representing the number of seconds (maybe 1/1000 of a second) since 1970.

Sorry for the delay, I had to decompile an old script to find it.

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

If you're still interested, you can run the script:

#include <Date.au3>
MsgBox(0,"Date installed",_DateAdd("s",RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "InstallDate"),"1970/01/01 01:00:00"))
to see the date. The pure registry entry is just a long number, representing the number of seconds (maybe 1/1000 of a second) since 1970.

Sorry for the delay, I had to decompile an old script to find it.

Thanks for that I will post my script for comment on these pages when I have it finished

Cheers

Ant..

Link to comment
Share on other sites

This is the code that I have written to generate a 4 x 5 registration code. The key to the code is always postion 4 for 5 characters in the Installation ID. These characters should be unique to each individual PC as they are based on the Windows Installation Date. The other characters in the string making a total of 12 are to give the impression that the code changes. These characters are generated randomly. I have left out "O" as a character so that it is not confused with "0" (zero) The code will also generate a string based on alternative attributes if the installation date is missing. To calculate the registration key you simply read and encrypt the unique 5 character string (stringmid($userid, 4, 5) using the encryption key you have selected. I have also written in beeps and activity flashing although I have not supplied the banner (.jpg) files I have created for this purpose. You will also notice that I have included an administrators back door for testing purposes.

Comments would be appreciated

Ant..

CODE
; Date Time processing

#include <Date.au3>

;Write to File

#include <File.au3>

;Windows Interface

#include <GUIConstants.au3>

;Email Processor

#include <INet.au3>

;Encryption Processing

#include<String.au3>

;Global Variables

Global $font = "times new roman", $message = "", $logo = "", $userid = "", $attr2 = ""

;Backdoor

$adminpw = "your 20 character encrypted code"

;Message Box Subroutine;

Func DisplayMessage()

SplashTextOn("REGISTER", $message, 250, 50, 600, 500, 36, "times new roman", 10, 600)

Sleep(3000)

SplashOff()

EndFunc ;==>DisplayMessage

; Activity Flash Subroutine

Func plmonitoraf()

For $i = 2 To 1 Step - 1

If $logo = 1 Then

$plmaf = @ScriptDir & "\banners\logogrn.jpg"

Else

$plmaf = @ScriptDir & "\banners\logored.jpg"

EndIf

SplashImageOn("", $plmaf, 30, 30, (@DesktopWidth - 60) , (@DesktopHeight - 100), 1)

Sleep(400)

SplashOff()

$plmaf = @ScriptDir & "\banners\logoblink.jpg"

SplashImageOn("", $plmaf, 30, 30, (@DesktopWidth - 60) , (@DesktopHeight - 100), 1)

Sleep(400)

SplashOff()

Next

If $logo = 1 Then

$plmaf = @ScriptDir & "\banners\logogrn.jpg"

Else

$plmaf = @ScriptDir & "\banners\logored.jpg"

EndIf

SplashImageOn("", $plmaf, 30, 30, (@DesktopWidth - 60) , (@DesktopHeight - 100), 1)

Sleep(400)

SplashOff()

$logo = 0

EndFunc ;==>plmonitoraf

;Beep Subroutine

Func plbeep()

For $i = 4 To 1 Step - 1

Beep(500, 50)

Sleep(100)

Next

EndFunc ;==>plbeep

;Calculate Installation ID

If RegRead("HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\", "InstallDate") = "" Then

If StringLen(DriveGetSerial(@HomeDrive & "\")) > 4 Then

$Attrb2 = StringLeft(DriveGetSerial(@HomeDrive & "\"), 5)

ElseIf StringLen(@UserName) > 2 And StringLen(DriveGetSerial(@HomeDrive & "\")) > 2 Then

$Attrb2 = StringLower(StringLeft(@UserName, 1)) & StringRight(DriveGetSerial(@HomeDrive & "\"), 3) & StringUpper(StringRight(@UserName, 1))

ElseIf StringLen(@ComputerName) > 2 And StringLen(DriveGetSerial(@HomeDrive & "\")) > 2 Then

$Attrb2 = StringLower(StringLeft(@ComputerName, 1)) & StringRight(DriveGetSerial(@HomeDrive & "\"), 3) & StringUpper(StringRight(@ComputerName, 1))

Else

$message = " System Failure Call SUPPLIER"

DisplayMessage()

EndIf

ElseIf StringLen(RegRead("HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\", "InstallDate")) > 4 Then

$attr2 = StringRight(RegRead("HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\", "InstallDate"), 5)

Else

$message = " System Failure Call SUPPLIER"

DisplayMessage()

EndIf

If $attr2 <> "" Then

$attr1 = Chr(Random(Asc("p"), Asc("z"), 1)) & StringRight(@SEC, 1) & Chr(Random(Asc("A"), Asc("N"), 1))

$attr3 = Chr(Random(Asc("A"), Asc("N"), 1)) & StringRight(@MIN, 1) & Chr(Random(Asc("p"), Asc("z"), 1)) & StringRight(@SEC, 1)

$userid = $attr1 & $attr2 & $attr3

EndIf

;User interface

While 1

GUICreate("REGISTRATION", 365, 225, -1, -1)

GUISetBkColor(0xE0FFFF)

GUISetState()

GUISetFont(10, 600, 1, $font)

GUICtrlCreateGroup(" Installation ID ", 20, 20, 325, 85)

GUISetFont(10, 400, 1, $font)

GUICtrlCreateLabel(" ID Number: ", 30, 40, 120, 30)

GUISetFont(10, 600, 1, $font)

GUICtrlCreateLabel($userid, 150, 40, 180, 30)

GUISetFont(9, 400, 1, $font)

$record = GUICtrlCreateButton("Record Number", 30, 65, 110, 25)

GUICtrlSetTip(-1, " Click this button to SAVE the Installation ID Number. " & @CRLF & @LF & " " & @ScriptDir & "\LogFiles\plInstallID.txt" & @CRLF, "Help", 1)

$email = GUICtrlCreateButton("Send Email", 225, 65, 110, 25)

GUICtrlSetTip(-1, " Click this button to SEND an Email. " & @CRLF & @LF & " requesting the Registration KEY." & @CRLF, "Help", 1)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetFont(10, 600, 1, $font)

GUICtrlCreateGroup(" Registration Key ", 20, 120, 325, 50)

GUISetFont(9, 400, 1, $font)

$regkey1 = GUICtrlCreateInput("", 30, 140, 60, 20)

GUICtrlSetLimit(-1, 5)

GUICtrlSetState(-1, $GUI_FOCUS)

$regkey2 = GUICtrlCreateInput("", 95, 140, 60, 20)

GUICtrlSetLimit(-1, 5)

$regkey3 = GUICtrlCreateInput("", 160, 140, 60, 20)

GUICtrlSetLimit(-1, 5)

$regkey4 = GUICtrlCreateInput("", 225, 140, 60, 20)

GUICtrlSetLimit(-1, 5)

$process = GUICtrlCreateButton("P", 290, 137, 45, 25)

GUICtrlSetTip(-1, " Click this button to Process " & @CRLF & " the REGISTRATION KEY." & @CRLF, "Help", 1)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$exitbutton = GUICtrlCreateButton("Exit", 225, 185, 110, 25)

While 1

$msg = GUIGetMsg()

$mprocess = 0

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $exitbutton

plexit()

Case $msg = $email

GUIDelete()

$mprocess = 1

ExitLoop

Case $msg = $process

$mprocess = 2

ExitLoop

Case $msg = $record

GUIDelete()

$message = " Writing Installation ID to File"

DisplayMessage()

$file = FileOpen(@ScriptDir & "\LogFiles\plInstallID.txt", 9)

FileWriteLine($file, " ---------------------------------------------")

FileWriteLine($file, " Installation ID: " & $userid)

FileWriteLine($file, " Time: " & (@MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC))

FileWriteLine($file, " ---------------------------------------------")

FileWriteLine($file, " ")

FileClose($file)

ExitLoop

EndSelect

WEnd

While 1

If $mprocess = 1 Then

Opt('RunErrorsFatal', 0)

$Address = "your email address"

$Subject = "Request for Registration Key"

$Body = "Please supply the Registration Key for Installation ID Number: " & $userid

_INetMail($Address, $Subject, $Body)

If @error = 1 Then

$message = " Email Client NOT FOUND"

DisplayMessage()

EndIf

EndIf

ExitLoop

WEnd

While 1

If $mprocess = 2 Then

$regkeyinput1 = GUICtrlRead($regkey1)

If $regkeyinput1 = "" Then

GUIDelete()

$message = " No Data InputBox [1]"

DisplayMessage()

ExitLoop

EndIf

$regkeyinput2 = GUICtrlRead($regkey2)

If $regkeyinput2 = "" Then

GUIDelete()

$message = " No Data InputBox [2]"

DisplayMessage()

ExitLoop

EndIf

$regkeyinput3 = GUICtrlRead($regkey3)

If $regkeyinput3 = "" Then

GUIDelete()

$message = " No Data InputBox [3]"

DisplayMessage()

ExitLoop

EndIf

$regkeyinput4 = GUICtrlRead($regkey4)

If $regkeyinput4 = "" Then

GUIDelete()

$message = " No Data InputBox [4]"

DisplayMessage()

ExitLoop

EndIf

$regkeypw = $regkeyinput1 & $regkeyinput2 & $regkeyinput3 & $regkeyinput4

$regkeychk = (_StringEncrypt(1, StringMid($userid, 4, 5), "yourkey", 1))

If $regkeypw = $regkeychk Or $regkeypw = $adminpw Then

GUIDelete()

$message = " Key Successfully REGISTERED"

DisplayMessage()

;Write registration key to registry

Else

GUIDelete()

$message = " Key NOT VALID"

DisplayMessage()

EndIf

EndIf

ExitLoop

WEnd

WEnd

;Exit

Func plexit()

Exit

EndFunc ;==>plexit

Link to comment
Share on other sites

You can probably get the CPU serial number with some API/WMI trickery. Do a search with the words +ExecQuery +CPU

The MAC address of the nicks are easily found with samples from the forum. Use the search page..:shocked:This could be a start

CPU serial would be good except that in some systems (including mine) you can disable the ability to display the CPU serial in BIOS (I did).

Using WMI to get the BIOS info is probably more reliable.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

This is the code that I ended up with that creates a one time 20 digit installation ID Key

CODE
;Calculate or Read Installation ID

If RegRead("HKLM\SOFTWARE\xxx\xxx\xxx\", "MyInstallID") = "" Then

$id = Round(Random(1000000000, 9999999999))

$rpos1 = Round(Random(2, 3))

$attr1 = Round(Random(1, 9)) & Chr(Random(Asc("A"), Asc("Z"), 1)) & Round(Random(1, 9))

$attr2 = StringMid($id, Round(Random(1, 7)), $rpos1) & Chr(Random(Asc("A"), Asc("Z"), 1)) & StringMid($id, Round(Random(1, 7)), 5 - $rpos1)

$attr3 = Round(Random(1, 9)) & Chr(Random(Asc("A"), Asc("Z"), 1)) & Round(Random(1, 9))

$userid = $attr1 & $attr2 & $attr3

Else

$userid = RegRead("HKLM\SOFTWARE\xxx\xxx\xxx\", "MyInstallID")

EndIf

;Read input

$regkeypw = $regkeyinput1 & $regkeyinput2 & $regkeyinput3 & $regkeyinput4

$regkeyID = RegRead("HKLM\SOFTWARE\xxx\xxx\", "MyInstallID")

If IsNumber(stringmid($regkeyID,7,1)) = 1 Then

$regkeychk = (_StringEncrypt(1, StringMid($regkeyID, 4, 2) & StringMid($regkeyID, 7, 3), "Key", 1))

Else

$regkeychk = (_StringEncrypt(1, StringMid($regkeyID, 4, 3) & StringMid($regkeyID, 8, 2), "Key", 1))

EndIf

If $regkeypw = $regkeychk Then

GUIDelete()

$message = " Key Successfully REGISTERED"

DisplayMessage()

$sStartDate = (_StringEncrypt(0, RegRead("HKLM\SOFTWARE\xxx\", "IDate"), "Key", 1))

$sEndDate = StringLeft($sStartDate, 4) + 1 & StringMid($sStartDate, 5, 6)

$days = _DateDiff("d", $sStartDate, $sEndDate)

$licence = (_StringEncrypt(1, $days, "key", 1))

IniWrite(@WindowsDir & "\my.log", "section1", "value2", $licence) ;Days

RegWrite("HKLM\SOFTWARE\xxx\", "Licence", "REG_SZ", $licence)

RegDelete("HKLM\SOFTWARE\xxx\xxx\xxx\", "MyInstallID")

Else

GUIDelete()

$message = " Key NOT VALID"

DisplayMessage()

EndIf

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...