I have an ASM code :
PUSHAD()
MOV_ECX(CALL_PACKET)
MOV_EAX(Address) // packet array
PUSH_EAX()
MOV_EDX(0X0048D330)
CALL_EDX()
POPAD()
RET()
My packet array :
Then I create an Alloc address and write packet into.
I was successful to send it, but sometime the game will be disconnected.....
I try to use WPE PRO to check the packet which send to server by ASM Injection, it's the same as the packet in WPE PRO!
What should I do now ? :( Sorry if my English isnt good....thank you so much....
This is my full code:
PUSHAD()
MOV_ECX(CALL_PACKET)
MOV_EAX(Address) // packet array
PUSH_EAX()
MOV_EDX(0X0048D330)
CALL_EDX()
POPAD()
RET()
My packet array :
Code:
[0X80,0X54,0X61,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X60,0X00,0X02,0X00,0X00]
I was successful to send it, but sometime the game will be disconnected.....
I try to use WPE PRO to check the packet which send to server by ASM Injection, it's the same as the packet in WPE PRO!
What should I do now ? :( Sorry if my English isnt good....thank you so much....
This is my full code:
Code:
$Address = _AllocEX($Process,100)
$Address_Inject = _AllocEX($Process,1024)
Func _SEND_EX($LENGTH,$PACKET)
For $i = 0 To ($LENGTH - 1) Step +1
_WRITEPACKET($i,$PACKET[$i])
Next
$OPcode = ""
PUSHAD()
MOV_ECX($CALL_PACKET)
MOV_EAX($Address)
PUSH_EAX()
MOV_EDX(0X0048D330)
CALL_EDX()
POPAD()
RET()
InjectCode($OPcode)
Sleep(50)
_CLEAN_PACKET($LENGTH)
EndFunc ;==>_SEND_EX
Func _CLEAN_PACKET($LENGTH)
For $i = 0 To ($LENGTH - 1) Step +1
_WRITEPACKET($i,0X00)
Next
EndFunc ;==>_CLEAN_PACKET
Func _WRITEPACKET($i,$PACKET)
While 1
_MEMORYWRITE($Address + $i,$MEMID,$PACKET,"byte")
IF "0X" & Hex(_MEMORYREAD($Address + $i,$MEMID,"BYTE"),2) = $PACKET Then ExitLoop
WEnd
EndFunc ;==>_WRITEPACKET
Func InjectCode($OPcode)
Local $Address = 0,$Thread = 0,$Data = 0
Local $Data = DllStructCreate("byte[" & StringLen($OPcode) / 2 & "]")
For $i = 1 To DllStructGetSize($Data)
DllStructSetData($Data,1,Dec(StringMid($OPcode,($i - 1) * 2 + 1,2)),$i)
Next
_WriteMemory($Process,$Data,$Address_Inject)
$Thread = _CreateRemoteThread($Process,$Address_Inject)
_WaitForSingelObject($Thread)
_FreeAllocEX($Process,$Data,$Thread)
Local $Data = DllStructCreate("byte[" & StringLen($OPcode) / 2 & "]")
For $i = 1 To DllStructGetSize($Data)
DllStructSetData($Data,1,0X00,$i)
Next
_WriteMemory($Process,$Data,$Address_Inject)
$OPcode = ""
EndFunc ;==>InjectCode
#Region INJECTION
Func _AllocEX($Process,$Data)
$Alloc = DllCall("Kernel32.dll","ptr","VirtualAllocEx","int",$Process,"ptr",0,"int",$Data,"int",0x1000,"int",0x40)
Return $Alloc[0]
EndFunc ;==>_AllocEX
Func _WriteMemory($Process,$Data,$Address)
DllCall("Kernel32.dll","int","WriteProcessMemory","int",$Process,"ptr",$Address,"ptr",DllStructGetPtr($Data),"int",DllStructGetSize($Data),"int",0)
EndFunc ;==>_WriteMemory
Func _CreateRemoteThread($Process,$Address)
$ThreadRemote = DllCall("Kernel32.dll","int","CreateRemoteThread","int",$Process,"ptr",0,"int",0,"int",$Address,"ptr",0,"int",0,"int",0)
Return $ThreadRemote[0]
EndFunc ;==>_CreateRemoteThread
Func _WaitForSingelObject($Thread)
DllCall("Kernel32.dll","int","WaitForSingleObject","int",$Thread,"int",5000)
EndFunc ;==>_WaitForSingelObject
Func _FreeAllocEX($Process,$Data,$Thread)
DllCall("Kernel32.dll","int","CloseHandle","int",$Thread)
$RESULT = DllCall("Kernel32.dll","ptr","VirtualFreeEx","hwnd",$Process,"ptr",DllStructGetPtr($Data),"int",DllStructGetSize($Data),"int",32768)
EndFunc ;==>_FreeAllocEX
Func _ProcessOpen($PID)
$hProcess = DllCall("Kernel32.dll","int","OpenProcess","int",0x1F0FFF,"int",0,"int",$PID)
Return $hProcess[0]
EndFunc ;==>_ProcessOpen
#EndRegion INJECTION