How to change from BIOS Id check to HDD check

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
blickeddd
Posts: 27
Joined: 06 May 2019, 11:12

How to change from BIOS Id check to HDD check

18 May 2019, 12:27

if (getBIOSSerial() != "CNF1203T38") { ;replace CNF1203T38 with BIOS serial from client
MsgBox % Wrong computer, exiting!
ExitApp
}
;insert script here

getBIOSSerial() {
; Get WMI service object.
wmi := ComObjGet("winmgmts:")
queryEnum := wmi.ExecQuery("Select SerialNumber from Win32_BIOS")._NewEnum()
if queryEnum[bios]
serial := bios.SerialNumber
wmi := queryEnum := process := ""
return serial
}


Im trying to get this to look for the HDD and verify. This is working with bios id but its not 100% stable. gives me false id's etc. To be filled by OEM. So the HDD serial is better. If anyone can help me with that i'd be greatly appreciative.
Last edited by blickeddd on 20 May 2019, 18:26, edited 1 time in total.
blickeddd
Posts: 27
Joined: 06 May 2019, 11:12

Re: How to change from BIOS Id check to HDD check

19 May 2019, 11:14

Anyone know how to do this? Sorry
blickeddd
Posts: 27
Joined: 06 May 2019, 11:12

Re: How to change from BIOS Id check to HDD check

19 May 2019, 15:46

gregster wrote:
19 May 2019, 13:42
Have you tried the forum search? What about this: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=30132&hilit=hdd+serial ?
I already have that code. My question was how do I change the verification within my ahk script from BIOS serial check to HDD serial check?
just me
Posts: 9574
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: How to change from BIOS Id check to HDD check

20 May 2019, 05:28

If you already have that code, why don't you use it?

As an option:

Code: Select all

MsgBox, % GetDiskSerialNumber()
GetDiskSerialNumber(Disk := 1) {
   SerialNumber := ""
   For Drive In ComObjGet("winmgmts:").ExecQuery("SELECT * FROM Win32_DiskDrive") {
      If (A_Index = Disk) {
         SerialNumber := Drive.SerialNumber
         Break
      }
   }
   Return SerialNumber
}
blickeddd
Posts: 27
Joined: 06 May 2019, 11:12

Re: How to change from BIOS Id check to HDD check

20 May 2019, 12:07

just me wrote:
20 May 2019, 05:28
If you already have that code, why don't you use it?

As an option:

Code: Select all

MsgBox, % GetDiskSerialNumber()
GetDiskSerialNumber(Disk := 1) {
   SerialNumber := ""
   For Drive In ComObjGet("winmgmts:").ExecQuery("SELECT * FROM Win32_DiskDrive") {
      If (A_Index = Disk) {
         SerialNumber := Drive.SerialNumber
         Break
      }
   }
   Return SerialNumber
}
I already have this code. I'm trying to use this with verification in my own AHK script. My first post showed the verification for BIOS serial not HDD. So i'm asking how do I change the verification within my OWN AHK script in order to check for their HDD serial and not the BIOS number.
just me
Posts: 9574
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: How to change from BIOS Id check to HDD check

20 May 2019, 16:14

blickeddd wrote:... in my own AHK script.
I don't believe that. If you implemented the BIOSID check, you shouldn't need any further assistence.
blickeddd
Posts: 27
Joined: 06 May 2019, 11:12

Re: How to change from BIOS Id check to HDD check

20 May 2019, 17:04

just me wrote:
20 May 2019, 16:14
blickeddd wrote:... in my own AHK script.
I don't believe that. If you implemented the BIOSID check, you shouldn't need any further assistence.
BIOS ID check isn't what i'm asking for. Do I need to speak deutsch for you? I'm not getting why its so hard to understand. I have ahk code that gets the persons HDD serial number and copies it to the clipboard. Now I need to implement the VERIFICATION part of the code into MY OWN script. So when they run my script it will check if the HDD serial key is correct and matches up not the BIOS serial key.
All you have done is tell me what i'v already done. Not any help at all. Is this how you have gotten your 6k post count :bravo:
gregster
Posts: 9111
Joined: 30 Sep 2013, 06:48

Re: How to change from BIOS Id check to HDD check

20 May 2019, 18:06

Perhaps you should dial back your attitude a bit.

You seem to expect that we have magic crystal balls... We directed you to the code you need - if you created some code that you want to secure with it, we can assume that you are able to do a minimal transfer. After all, we don't know your script.

Remember that we are all volunteers here (many contributing more than 10 or 15 years), willing to help - but we are not responsible for doing your work or guessing what you could have meant or what you have already tried.
Your current problem description sounds as if you just need an if-check, like demonstrated above. The clipboard (that you mentioned for the first time in your most recent post) can be accessed or assigned to other variables via the built-in variable of the same name (see clipboard). If that's all you are asking...

Everyone helps as one sees fit, according to one's interests and abilities. If you lack the abilities you need and are not happy with the answers, you are welcome to decribe the problem you are facing in greater detail and to post your current code (at least, the part that is relevant for this question); please explain then what you expected to happen and what really happened. Thank you!
blickeddd
Posts: 27
Joined: 06 May 2019, 11:12

Re: How to change from BIOS Id check to HDD check

20 May 2019, 18:23

gregster wrote:
20 May 2019, 18:06
Perhaps you should dial back your attitude a bit.

You seem to expect that we have magic crystal balls... We directed you to the code you need - if you created some code that you want to secure with it, we can assume that you are able to do a minimal transfer. After all, we don't know your script.

Remember that we are all volunteers here (many contributing more than 10 or 15 years), willing to help - but we are not responsible for doing your work or guessing what you could have meant or what you have already tried.
Your current problem description sounds as if you just need an if-check, like demonstrated above. The clipboard can be accessed or assigned to other variables via the built-in variable of the same name (see clipboard).

Everyone helps as one sees fit, according to one's interests and abilities. If you lack the abilities you need and are not happy with the answers, you are welcome to decribe the problem you are facing in greater detail and to post your current code; please explain then what you expected to happen and what really happened. Thank you!
I didn't anywhere say that I expect help. I said any help is appreciated. Someone coming onto my thread like the posts above laughing and being condescending with remarks like "I don't believe its your own script that you built" isn't what i'm here for.
Obviously there is some sort of language barrier because he hasn't said anything other than what you wrote Greg, he clicked your link and posted the already posted script. I appreciate your help and anyone that gives me some good advice. Other than that I still don't know where to go from this with my script problem and I'm at step 1 still.
I believe I'v explained enough. I have a BIOS HWID check code in my first post. I need it to verify the HDD code. NOT BIOS. I need it to go into my script(You don't need my source code). I DON'T need the script where it grabs the HWID off of another computer(I already have that).
gregster
Posts: 9111
Joined: 30 Sep 2013, 06:48

Re: How to change from BIOS Id check to HDD check

20 May 2019, 18:37

So you want to send information from a client computer via the internet to your computer/server and check it there (instead of checking the information in the script on the client computer itself)?

There are certainly different (non-trivial) solutions for this which have been discussed before in the forum on different occasions, but the solution depends probably on the question if you running your own server or if you will need to use some kind of third-party app or website as an intermediate.

If that is the question, I must say that I couldn't have guessed that from your previous posts... I should really work on my english skills. The topic name was, after all, How to change from BIOS Id check to HDD check
blickeddd
Posts: 27
Joined: 06 May 2019, 11:12

Re: How to change from BIOS Id check to HDD check

20 May 2019, 19:20

gregster wrote:
20 May 2019, 18:37
So you want to send information from a client computer via the internet to your computer/server and check it there (instead of checking the information in the script on the client computer itself)?

There are certainly different solutions for this which have been discussed before in the forum on different occasions, but the (non-trivial) solution depends probably on the question if you running your own server or if you will need to use some kind of third-party app or website as an intermediate.

If that is the question, I must say that I couldn't have guessed that from your previous posts... I should really work on my english skills. The topic name was, after all, How to change from BIOS Id check to HDD check
I want to code their hdd serial into my ahk script so it will only open for them.

I put descriptions on my code in the first post lol. I thought it was obvious as to what I was asking. Sorry
gregster
Posts: 9111
Joined: 30 Sep 2013, 06:48

Re: How to change from BIOS Id check to HDD check

20 May 2019, 21:12

So, you want no check of the id via the internet (like, for example, as forum member guest3456 described here: https://www.autohotkey.com/boards/viewtopic.php?f=17&t=24346&p=115651#p115651) ?!?

Instead, you want to deliver the (setup?) script to someone and on first run it should alter itself or write the id to an ini-file or the registry (possibly encrypted) ?
Or, do you want to get the hardware info beforehand from the user and then hardcode it into your script and then send it to the user?

Well, that is probably not a very reliable method to deter people... of course, everything can be circumvented anyway and it depends on your requirements which we still don't really know, but a normal ahk script (or exe) is not really a safe location to store credentials, especially when hardcoded in plaintext. So, the background of your plans could still help potential helpers... what is the end goal? what kind of effort are you willing to put it into securing your script...? Or is this only meant as a symbolic kind of protection and you don't really care about the effectiveness?
I put descriptions on my code in the first post lol.
I must be blind. Your code below is an (almost) 1:1 copy of https://www.autohotkey.com/boards/viewtopic.php?t=15280#p77616 :
bios.png
bios.png (43.16 KiB) Viewed 7257 times
Also, a quote from there about hardcoding the hardware information, which I would agree with: "I'm assuming you are sending compiled versions of the script, otherwise, this check is extremely easy to bypass (even with compiled script, it can be un-compiled and modified without much hassle if someone is so motivated)." Of course, obfuscation or encryption techniques could make it a little bit harder...

Apart from that, I can only read
Im trying to get this to look for the HDD and verify. [...] So the HDD serial is better.[...]
That's why I linked you to the code you already had, but didn't tell us about... anyway, helpful forum member just me showed you how to get the serial number alone and your original post showed you how to check a variable with If - I also told you about the usage of built-in variable clipboard that you mentioned later. Of course, you can also assign the serial number to any other variable in the same way. Without seeing your script (or least a snippet), I have no idea what the remaining problem is... do you understand the use of functions, expressions etc. ?

I am just trying to understand what the actual question/plan is - but it seems that my security clearance is not good enough. Welp, beats me 8-)

Btw, this is not true:
"Obviously there is some sort of language barrier because he hasn't said anything other than what you wrote Greg, he clicked your link and posted the already posted script."
In reality, just me posted a useful variation of the scripts that I linked to - and labeled it correctly "as an option". But that's not even the point...
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: How to change from BIOS Id check to HDD check

25 May 2019, 15:22

I'm not sure what the OP wants (maybe I need to study English more too), but maybe it's a procedural issue.

1. The script has to get the drive serial number first

getHDDSerial()

2. The script then has to store or send the drive serial number somewhere.

That, or you would have to somehow know what it was prior and hardcode it into the script. The drive serial number could be stored in the registry, encrypted .ini, sent to a server on the network, or sent to a web server where it's stored in a database. If you are sending the drive serial number to a server or webserver, you could hardcode it into the script, but a lot of people would instead retrieve it from a database on the server or webserver. You may also want to encrypt the file, and then have the script decrypt it, when doing verification.

If the user wants to do it more simply, then FileAppend, IniWrite, or RegWrite can work.

IniWrite, Value, Filename, Section, Key

or

RegWrite, ValueType, KeyName

3. The script then checks for the drive serial number whenever it runs, making sure it's on the correct computer.

Pseudo Code Example

Code: Select all

IniRead, OutputVar, Filename, Section, Key , Default

if (getHDDSerial() != OutputVar)
{
MsgBox % Wrong computer, exiting!
ExitApp
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 353 guests