Sign in to follow this  
Followers 0
Zagor

Hwid problem

13 posts in this topic

Hello Im trying to protect my app with online hwid system but Im stuck on this.Program dont read txt file from my website and there is always error msg "HWID NotFound"

can someone help me with this?

#include <Array.au3>
#include <String.au3>

If _GetHWID('7390647.387001DEXIF20') Then
    MsgBox(4096, '', 'HWID Found.')
Else
    MsgBox(4096, '', 'HWID NOT Found.')
    ProcessClose("test.exe")
EndIf

Func _GetHWID($sHWID)
    Local $aArray = StringSplit(BinaryToString(InetRead('http://mywebsite.com/hwid.txt')), @LF)
    If @error Then
        Return SetError(1, 0, 0)
    EndIf
    Return _ArrayBinarySearch($aArray, $sHWID) > 0
EndFunc   ;==>_GetHWID

Func _HWID()
    Local $sOSDrive = StringLeft(@SystemDir, 3)
    Local $sHWID = '0' & @CPUArch & @KBLayout & DriveGetSerial(@HomeDrive) & StringUpper(DriveGetType($sOSDrive)) & DriveSpaceTotal($sOSDrive)
    $sHWID = StringMid($sHWID, Round(StringLen($sHWID) / 2), Round(StringLen($sHWID) / 2))
    $sHWID = _StringReverse($sHWID)
    Return $sHWID
EndFunc   ;==>_HWID



 MsgBox(4096, '', 'Hello this is test.')

Share this post


Link to post
Share on other sites



Test should be:

If _getwhid() = ".." Then

Jos

Still same "HWID NotFound"

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Zagor,

You are returning the HTML from your site, not a .txt file

edit: www.mywebsite.com just happens to be a valid URL.

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

When run like this...

#include <Array.au3>
#include <String.au3>

If _GetHWID('7390647.387001DEXIF20') Then
    MsgBox(4096, '', 'HWID Found.')
Else
    MsgBox(4096, '', 'HWID NOT Found.')
    ProcessClose("test.exe")
EndIf

Func _GetHWID($sHWID)
    Local $aArray = StringSplit(BinaryToString(InetRead('http://mywebsite.com/hwid.txt')), @LF)
    If @error Then
        Return SetError(1, 0, 0)
    EndIf
    ;Return _ArrayBinarySearch($aArray, $sHWID) > 0
    Return true
EndFunc   ;==>_GetHWID

Func _HWID()
    Local $sOSDrive = StringLeft(@SystemDir, 3)
    Local $sHWID = '0' & @CPUArch & @KBLayout & DriveGetSerial(@HomeDrive) & StringUpper(DriveGetType($sOSDrive)) & DriveSpaceTotal($sOSDrive)
    $sHWID = StringMid($sHWID, Round(StringLen($sHWID) / 2), Round(StringLen($sHWID) / 2))
    ;$sHWID = _StringReverse($sHWID)
    Return $sHWID
EndFunc   ;==>_HWID



 MsgBox(4096, '', 'Hello this is test.')

the logic works therefore the HWID you are looking for is not on the file or the file is not being downloaded.


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

j0kky - Yea, I'm still laughing my ass off


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Do have you tried to verify if you can connect to the site and you can download hwid.txt from it?

I can connect and can dl file. Permision is 777

Share this post


Link to post
Share on other sites

Can you post the file or a sample of it?


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Zagor,

_arraybinarysearch requires the input to be sorted.  Use _arraysearch or sort the array before searching...

kylomas

edit:

if you don't want to goof around with arrays you might consider an SRE like this...

Func _GetHWID($sHWID)

    Local $sHWIDS = BinaryToString(InetRead('http://mywebsite.com/hwid.txt'))
    If @error Then
        Return SetError(1, 0, 0)
    EndIf

    return stringregexp($sHWIDs,'(?m)^' & $sHWID & '\R')

EndFunc   ;==>_GetHWID

note - tested against a file only

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I think the errors reside in this line:

Return _ArrayBinarySearch($aArray, $sHWID) > 0

- _ArrayBinarySearch has to be replaced by _ArraySearch

- The right condition is "> -1" instead of "> 0"

So the correct line is:

Return _ArraySearch($aArray, $sHWID, 0, 0, 1) > -1 ;case sensitive match
Edited by j0kky

Share this post


Link to post
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
Sign in to follow this  
Followers 0