Code:
$kernel32 = DllOpen('kernel32.dll')
TrayTip("Status", "Analyzing Bot...", 2)
$size = FileGetSize("db Bot.exe")
$file = FileOpen("db Bot.exe", 16)
$data = FileRead($file, $size)
$get1 = StringRegExp($data, '7E.{4}000428.{6}06.{8}06.{8}06',3)
$get2 = StringRegExp($data, '7E.{4}00047E.{4}0004.{8}06.{8}06',3)
$check = StringRegExp($data, '17(.{8}?)047E', 3)
FileClose($file)
If Not IsArray($get1) Or Not IsArray($get2) Or Not IsArray($check) Then
MsgBox(0, "Error", "The Bot Analyzing failed..."&@CRLF&"Bot can NOT be cracked")
Exit
EndIf
TrayTip("Status", "Analyzing completed... Running bot", 2)
Global $pid = Run('db Bot.exe')
PatchAll($data, $get1[UBound($get1)-1], CreateZeroString($get1[UBound($get1)-1]))
PatchAll($data, $get2[UBound($get2)-1], CreateZeroString($get2[UBound($get2)-1]))
PatchAll($data, '17'&$check[2]&'04', '16')
DllClose($kernel32)
Func memopen($pid)
Local $mid = DllCall($kernel32, 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', 1, 'int', $pid)
Return $mid[0]
EndFunc ;==>memopen
Func memwrite($mid, $adress, $hex)
Local $struct = DllStructCreate('byte[' & BinaryLen('0x' & $hex) & ']')
For $i = DllStructGetSize($struct) To 1 Step - 1
DllStructSetData($struct, 1, BinaryMid('0x' & $hex, $i, 1), $i)
Next
Local $x = DllCall($kernel32, 'int', 'VirtualProtectEx', 'int', $mid, 'ptr', $adress, 'int', DllStructGetSize($struct), 'dword', 0x40, 'dword*', 0)
DllCall($kernel32, 'int', 'WriteProcessMemory', 'int', $mid, 'int', $adress, 'ptr', DllStructGetPtr($struct), 'int', DllStructGetSize($struct), 'int', 0)
DllCall($kernel32, 'int', 'VirtualProtectEx', 'int', $mid, 'ptr', $adress, 'int', DllStructGetSize($struct), 'dword', $x[5], 'dword*', 0)
EndFunc ;==>memwrite
Func memclose($mid)
DllCall($kernel32, 'int', 'CloseHandle', 'int', $mid)
EndFunc ;==>memclose
Func CreateZeroString($input)
Local $string
For $i=1 To StringLen($input)
$string &= '0'
Next
Return $string
EndFunc
Func PatchAll($input, $search, $replace)
Local $pos=1
Local $mid = memopen($pid)
Do
$pos = StringInStr($input, $search,1,1,$pos+1)
If $pos<>0 Then memwrite($mid, $pos/2+0x4033FF, $replace)
Until $pos = 0
memclose($mid)
EndFunc