Jump to content

Recommended Posts

Posted

 the problem is  : I put the HWID generated in my website (hwid.txt), but the script does not read the HWID text , and get the error HWID Not Found , Any fix? thx

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

MsgBox(4096, '', 'HWID: ' & _HWID())

Local $sHWID = _HWID()
If _GetHWID($sHWID) Then
    MsgBox(4096, '', 'HWID Found.')
Else
    MsgBox(4096, '', 'HWID Not Found.')
    ProcessClose ( "Program.exe" )
    ProcessClose ( "Program2.exe" )
EndIf

Func _GetHWID($sHWID)
    Local $aArray = StringSplit(StringToBinary(InetRead('http://XXX/hwid.txt')), @LS)
    If @error Then
        Return SetError(1, 0, 0)
    EndIf
    Return _ArraySearch($aArray, $sHWID) > -1
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
Posted (edited)

This might be your issue:

Local $aArray = StringSplit(StringToBinary(InetRead('http://XXX/hwid.txt')), @LS)

Should be @LF not @LS. Unless for some reason that you have a "@LS" delimiter in there.

Edit:

Local $aArray = StringSplit(BinaryToString(InetRead('http://xxx/HWID.txt')), @LF)

I think you want to do it that way to read the file as if it was opened in notepad. You can change to binary in a loop later line by line if you need to.

Edited by 0xdefea7
Posted (edited)

This might be your issue:

Local $aArray = StringSplit(StringToBinary(InetRead('http://XXX/hwid.txt')), @LS)

Should be @LF not @LS. Unless for some reason that you have a "@LS" delimiter in there.

Edit:

Local $aArray = StringSplit(BinaryToString(InetRead('http://xxx/HWID.txt')), @LF)

I think you want to do it that way to read the file as if it was opened in notepad. You can change to binary in a loop later line by line if you need to.

 

Thx for reply , but same problem , is not working , HWID not found :/

Edited by Alpino
Posted

Alpino,

I don't think you are getting anything from the inetget.  Hence my earlier question

This is your Web site?

 

Can you post a sample of HWID.txt?

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

Posted

What does your output look like when you are reading it? Use ConsoleWrite() then check against your $HWID value.

 

Thx , now is working , i change

Func _GetHWID($sHWID)
    Local $aArray = StringSplit(StringToBinary(InetRead('http://XXX/hwid.txt')), @LS)
    If @error Then
        Return SetError(1, 0, 0)
    EndIf
    Return _ArraySearch($aArray, $sHWID) > -1
EndFunc   ;==>_GetHWID

to :

Func _GetHWID($sHWID)
    Local $aArray = StringSplit (BinaryToString(InetRead('http://MywebPage.com/hwid.txt')), @LF)
    Return _ArraySearch($aArray, $sHWID) > -1
ConsoleWrite($sHWID)
EndFunc   ;==>_GetHWID
Posted

Because, you removed error checking.

That error checking was telling you there were no line feeds in the string.

#include <Array.au3>
_GetHWID("Line")

Func _GetHWID($sHWID)
    Local $aArray = StringSplit("Myhwidisthiswithnolinefeeddelininators", @LF)
    If @error Then
        MsgBox(0,"Error","No @LF found to split at")
    EndIf
    _ArrayDisplay($aArray)
    Return _ArraySearch($aArray, $sHWID) > -1
EndFunc   ;==>_GetHWID

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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
  • Recently Browsing   0 members

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