How to send a packet taken from WPE PRO with Winsock control vb2010
Hi all , here's my code
Code:
Public Class Form1
Private Sub AxWinsock1_ConnectEvent(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Winsock1.ConnectEvent
Me.Text = "Connected to bot"
MsgBox("Connection Successful")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Winsock1.RemoteHost = "localhost"
Winsock1.RemotePort = "9000"
Winsock1.Connect()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pckt as Object = "03 80 57 4B 7D A5 56 51 94 49"
Winsock1.SendData(pckt)
End Sub
End Class
I added Winsock control to visual studio 2010 so i can use it on vb,
i connected sro on srproxy with localhost:9000
i tried some hextostring commands or tried some byte arrays but i couldn't be successfull.
So I hope someone will help me ..
Hey,
first: I think it's not allowed to bump a thread so many times in 2 hours..
Well, I am also working on sending packets to SRO but I am using the phConnector (it also decrypts/encrypts the packets) and the phAnalyzer (to see all in-/outcoming packets). And I don't play iSRO, only ZSZC, so I don't know if it will also work there, just try it out:
PHP Code:
Imports System.Net Imports System.Net.Sockets
Dim sroSocket As Socket
//Connect to phConnector: sroSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim IP As IPAddress = IPAddress.Parse("127.0.0.1") Dim Port As Integer = 22580 Dim IPEP As IPEndPoint = New IPEndPoint(IP, Port)
sroSocket.Connect(IPEP)
//Sub to send a packet: Sub SendPacket(ByVal OpCode As String, ByVal sData As String) Using buffer As New IO.MemoryStream Using w As New IO.BinaryWriter(buffer) w.Write(CUShort(0)) w.Write(CUShort("&H" + OpCode)) w.Write(CUShort(1))
For i = 0 To sData.Length / 2 - 1 w.Write(CByte("&H" & sData.Substring(i * 2, 2))) Next
Hey,
first: I think it's not allowed to bump a thread so many times in 2 hours..
Well, I am also working on sending packets to SRO but I am using the phConnector (it also decrypts/encrypts the packets) and the phAnalyzer (to see all in-/outcoming packets). And I don't play iSRO, only ZSZC, so I don't know if it will also work there, just try it out:
PHP Code:
Imports System.Net
Imports System.Net.Sockets
Dim sroSocket As Socket
//Connect to phConnector:
sroSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim IP As IPAddress = IPAddress.Parse("127.0.0.1")
Dim Port As Integer = 22580
Dim IPEP As IPEndPoint = New IPEndPoint(IP, Port)
sroSocket.Connect(IPEP)
//Sub to send a packet:
Sub SendPacket(ByVal OpCode As String, ByVal sData As String)
Using buffer As New IO.MemoryStream
Using w As New IO.BinaryWriter(buffer)
w.Write(CUShort(0))
w.Write(CUShort("&H" + OpCode))
w.Write(CUShort(1))
For i = 0 To sData.Length / 2 - 1
w.Write(CByte("&H" & sData.Substring(i * 2, 2)))
Next
What do you mean with "something"?
I don't wanna help via PM/IM, and I don't need anyone to make my own little "bot" at the moment, sry..just posted you how to send a packet.
well than , I changed the codes as me ; like this
when I hit button to send packet it just starts debugging -.-"
I think opcode and data section is wrong
Code:
Imports System.Net
Imports System.Net.Sockets
Public Class Form1
Dim sroSocket As Socket
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sroSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim IP As IPAddress = IPAddress.Parse("127.0.0.1")
Dim Port As Integer = 9000
Dim IPEP As IPEndPoint = New IPEndPoint(IP, Port)
sroSocket.Connect(IPEP)
End Sub
Sub SendPacket(ByVal OpCode As String, ByVal sData As String)
Using buffer As New IO.MemoryStream
Using w As New IO.BinaryWriter(buffer)
w.Write(CUShort(0))
w.Write(CUShort("&H" + OpCode))
w.Write(CUShort(1))
For i = 0 To sData.Length / 2 - 1
w.Write(CByte("&H" & sData.Substring(i * 2, 2)))
Next
w.BaseStream.Position = 0
w.Write(CUShort(w.BaseStream.Length - 6))
w.Flush()
sroSocket.Send(buffer.ToArray)
End Using
End Using
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SendPacket("1820", "038020186B9F5D512155")
End Sub
End Class
Where did you get this Packet from? Try this:
Opcode: 704F
Data: 04
Your character should sit down/stand up...
For all other Packets you need to analyze the Packets which are shown in the phAnalyzer...
Where did you get this Packet from? Try this:
Opcode: 704F
Data: 04
Your character should sit down/stand up...
For all other Packets you need to analyze the Packets which are shown in the phAnalyzer...
I get packets from WPE PRO
I will try , i will turn back , btw i am on zszc retro.
Thanks for helping )
EDIT : It didn't work.
It gives error at this line ;
"sroSocket.Send(buffer.ToArray)"
error is : "Established connection was aborted by the main computer software"
I connect on localhost:9000 via srproxy
EDIT 2 : This time i solved that problem , but smth wrong with the packet so I get dc immediatly.
This is my packet to use XLarge HP POT , "03 80 09 51 01 C1 CF A3 B1 19"
What should i write to opcode and data section?
I thought opcode should be 5109
Use phConnector + phAnalyzer...I will upload them here
Put them in your ZSZC Folder, open the .ini-File and change the IP=72.55.143.209 to the Retro Server's IP. Start phConnector, start your own Tool which connects on 127.0.0.1:9000 (you will get the message "Bot connection accepted"). Then start SRO_Client.exe (not Silkroad.exe) and u will get the message "Connection to Silkroad established" or something like that. After that open the phAnalyzer and u will get the right packets (don't use WPEPro)..after that try some simple packets first, like sit down/stand up, because taking some HP Pots is quite difficult because u first need to search the slot where the pots are and so on..
To analyze the packets in the phAnalyzer, click on "C->S" to receive packets which u have sent to the server, for example walking, sit down/stand up, cast skills/buffs/select mobs etc.
I've just succeed , but having some problems.
This is my code to read offset ,
Code:
Private Sub useAddressButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles useAddressButton.Click
Dim address As Integer = &HA9FB98&
'Get your process handle as you wish...
Dim proc As Process = Process.GetCurrentProcess
For Each proc In Process.GetProcesses
If proc.MainWindowTitle = "SRO_Client" Then
Dim floatvalueinmemory As String = New String("", 20)
ReadProccessMemoryString(proc.Handle.ToInt32(), address, floatvalueinmemory, 20, 0)
Label6.Text = (floatvalueinmemory)
Exit For
End If
Next
End Sub
And here are the functions
Code:
Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As Integer, ByVal nSize As Integer, ByVal lpNumberOfBytesWritten As Integer) As Integer
Declare Function ReadProccessMemoryString Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByVal lpNumberOfBytesWritten As Integer) As Integer
With theese , I can read the char name.
But other offsets doesn't work for me , my friend can read them with auto-it so offsets are not wrong .
Here are the offsets if you need ,
Code:
Global $charCurHpOffset = 0x3BC, $charMaxHpOffset = 0x3B4
Global $charCurMpOffset = 0x3B0, $charMaxMpOffset = 0x3B8
Global $charStatusOffset = 0x228 ;byte
Global $charZerkOffset = 0x7E6 ;byte
Global $charLevelOffset = 0x7C8 ;byte
Global $charStrOffset = 0x7DC ;byte
Global $charIntOffset = 0x7DE ;byte
Global $charSpOffset = 0x7E0, $charSxpOffset = 0x7D8
Global $charExpOffset = 0x7D0
Global $charName = 0xA9FB98
Global $guildName = 0xAA0680
You need to use the ReadProcessMemory for the other offsets, not ReadProcessMemoryString..
I found an old project but I don't know if it still works..just try it:
PHP Code:
//ReadProcessMemory-API Private Declare Function ReadProcessMemory Lib "kernel32.dll" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal nSize As UIntPtr, ByRef lpNumberOfBytesWritten As UInteger) As Boolean
Dim bytes As Byte() = New Byte(23) {} Dim rw As Integer = 0
//Pointer ReadProcessMemory(readHandle, DirectCast(&HAA0E44, Integer), bytes, DirectCast(24, Integer), rw) Dim pointer As Integer = BitConverter.ToInt32(bytes, 0)
//Charname Dim charNameAddress As UInteger = &HA9FB98 ReadProcessMemory(readHandle, DirectCast(charNameAddress, UInteger), bytes, DirectCast(24, Integer), rw) charName = Encoding.UTF8.GetString(bytes)
//Current HP ReadProcessMemory(readHandle, DirectCast(pointer + &H3BC, Integer), bytes, DirectCast(24, Integer), rw) Dim currHP As Integer = BitConverter.ToInt32(bytes, 0)
//Maximal HP ReadProcessMemory(readHandle, DirectCast(pointer + &H3B4, Integer), bytes, DirectCast(24, Integer), rw) Dim maxHP As Integer = BitConverter.ToInt32(bytes, 0)
//Current MP ReadProcessMemory(readHandle, DirectCast(pointer + &H3B0, Integer), bytes, DirectCast(24, Integer), rw) Dim currMP As Integer = BitConverter.ToInt32(bytes, 0)
//Maximal MP ReadProcessMemory(readHandle, DirectCast(pointer + &H3B8, Integer), bytes, DirectCast(24, Integer), rw) Dim maxMP As Integer = BitConverter.ToInt32(bytes, 0)
//Level ReadProcessMemory(readHandle, DirectCast(pointer + &H7C8, Integer), bytes, DirectCast(24, Integer), rw) Dim level As Byte = bytes(0)
"readHandle" ist the SRO-Process Handle, which you can get by using Process.GetProcessesByName:
PHP Code:
Dim readHandle As IntPtr = Process.GetProcessesByName("SRO_Client")(0).MainWindowHandle
Hope it helps you..
BTW: Why do you use the Memory to get the Char information? You could also do it with the packets, if you enter the world with your char, you will receive a packet (don't know which opcode) where are all information about your char...
(Winsock hook) replace/filter packet bytes 11/18/2010 - General Coding - 3 Replies Hi guys
Please, can someone explain me or help me about my winsock hook?!
I need to change the first and second bytes of the packet I've received...
example:
I'm receiving the packet:
Play sound via Packet Send?? [Question String Packet] 07/14/2010 - CO2 Private Server - 5 Replies Yow im trying to figure out why i cant play music with the string packet
What im doin is;
MyChar.Client.SendPacket(Game.Packet.String(MyCha r.UID, 20, Splitter));
My Packet is:
public byte String(long CharId, byte Type, string name)
Control Send... 05/07/2010 - AutoIt - 7 Replies Hi zusammen,
ich möchte gerne bei meinem Script ControlSend benutzen und das läuft ja nach diesem:
ControlSend ( "title", "text", controlID, "string" )
Schema ab. Jetzt stellt sich mir die Frage, was ich wenn ich das ans LC fenster schicken muss bei controlID eintragen muss kann mir da jemand vlt weiterhelfen?
LG
Need Help about (Winsock Packet Editor (WPE) Pro 0.9a) 09/26/2009 - CO2 Programming - 18 Replies Hey All
I need help to know some thing about
( Winsock Packet Editor (WPE) Pro 0.9a in Network Monitors )
need to know..
How Can i open one Sv in different User account at One Pc
How is it work..?
Thankz any way
i w8 Replies
Plz don't avoid me
[VB6]Winsock Packet Sending Program & [C++] ws_32 Hook&DLL 06/07/2009 - C/C++ - 1 Replies Hi.. im trying to create a program that send packet to the server..
someone told me to hook my program using the ws_32 hook and dll
can someone give me or teach me how to do these codes?
the client i need to attach to is "KhanClient.exe"
i hope you can help me..