[Autoit]using opcodes

03/06/2012 12:54 kondos#1
I don't know how to send packet like this I copied some codes from "acer2000" but i don't know how to convert packet like this
[C -> S][704F]
04
To binary like he did


btw sorry for bad English.
that's code
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
local $edit
$g_IP 
"127.0.0.1"
$stan "0x704F04"
;$ss "0x04004570010004020000"  ;start talk
;$s1 "0x0500467001000402000003"   deposite
;$s2 "0x070034700100020D0004020000"   put item #1 at inventory to storage
TCPStartUp()
$socket TCPConnect($g_IP16000)
$Form1 GUICreate("Form1"624449191114)
$Button1 GUICtrlCreateButton("start"20837619357)
$Button2 GUICtrlCreateButton("Button2"40032814549)
 
$edit GUICtrlCreateEdit(""1010280180)
#EndRegion ### END Koda GUI section ###
if $socket = -1 Then
MsgBox
(0"Ops""Run proxy and program will close after 3 sec")
Sleep(3000)

else
   
GUISetState(@SW_SHOW)


   
While 
1
   
    $nMsg 
GUIGetMsg(0)
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
         case 
$Button1
          $recv 
TCPRecv($socket 8)    
        
$binFirst BinaryMid($recv110)
         If @
error Then MsgBox(0"Ops""Run proxy and program will close after 3 sec")
            If 
$recv <> "" Then GUICtrlSetData($edit_
               $g_IP 
" > " $binFirst & @CRLF GUICtrlRead($edit))
              case 
$Button2
TCPSend
($socket,$stan)
;
Sleep(2000)
;
TCPSend($socket,$s1)
;
Sleep(2000)
;
TCPSend($socket,$s2)
    EndSwitch
WEnd
EndIf 
when i send it i got crash can anyone help me and thx
03/06/2012 15:02 jremy#2
You have to reverse byte order, and build the packet like:

Code:
"0100" = data length
"4F70" = opcode
"0100" = security, for nu/phConnector used to tell direction/encryption
"04" = packet data
So the sit packet would be "0x01004F70010004". To make life little easier, you should use functions like:

Code:
Func Rev($val)
	$result = ""
	For $i = 1 To StringLen($val) / 2
		$byte = StringRight($val, 2)
		$val = StringTrimRight($val, 2)
		$result &= $byte
	Next
	Return $result
EndFunc

Func SendPacket($opcode, $data)
	$opcode = Rev($opcode)
	$size = Rev(Hex(StringLen($data)/2, 4))
	TCPSend($socket, "0x" & $size & $opcode & "0100" & $data)
EndFunc
Usage: SendPacket("704F", "04")
03/06/2012 18:40 bothpro#3
Thank you kondo for topic and jremy for the functions, helped me a lot.

But i cant connect i think...

i try phconnector with a default options:
HTML Code:
[phConnector]
IP=121.128.133.30
Port=15779
LoginListenPort=15778
WorldListenPort=15777
BotPort=22580
ServerBlock=
ClientBlock=
Dev=0
OK Connection of phconnector: OK

AutoIt i try:
HTML Code:
$socket = TCPConnect("127.0.0.1", 15779)
And to send:
HTML Code:
SendPacket("704F", "04")
with a function....Like jremy said...

But nothing happen

I will need use a pather for client or program for hackshield? ...

Waiting for anserws
03/06/2012 23:03 kondos#4
thx jremy
03/08/2012 19:24 srutownik#5
@bothpro
If you want to use client, you have to redirect your client to "127.0.0.1", 15779
Then connect your program to bot port (BotPort=22580)

If you don't want to use client, that topic should help you:
[Only registered and activated users can see links. Click Here To Register...]
Just use phConnector instead of edxsilkroadproxy
03/10/2012 01:20 bothpro#6
Dont work for me :/
I tried use new and old version of phconnector ...
I tried use edxloader v5 or v6..and only config redirect..and patch seed...
I tried in a Vsro...

When i send a packet..my client get DC... :(

Im using a win 64 bits, have any problem using this?

Thanks waiting answers
03/10/2012 23:15 kondos#7
@jremy
when i send packet
Quote:
SendPacket("704F", "04")
i got dc why !?!?
03/10/2012 23:58 srutownik#8
The problem is in using Hex() function.
The proper functioning requires integer arguments.
When you divide a number, foating number was returned.
You have to convert it to integer like this:
Code:
Func SendPacket($opcode, $data)
	$opcode = Rev($opcode)
	$size = Rev(Hex(Int(StringLen($data)/2), 4))
	TCPSend($socket, "0x" & $size & $opcode & "0100" & $data)
EndFunc
03/11/2012 01:04 kondos#9
Quote:
Originally Posted by srutownik View Post
The problem is in using Hex() function.
The proper functioning requires integer arguments.
When you divide a number, foating number was returned.
You have to convert it to integer like this:
Code:
Func SendPacket($opcode, $data)
	$opcode = Rev($opcode)
	$size = Rev(Hex(Int(StringLen($data)/2), 4))
	TCPSend($socket, "0x" & $size & $opcode & "0100" & $data)
EndFunc
it's work thx
03/11/2012 01:31 bothpro#10
Yes itīs work !!!! Thanks!!!