Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 19:23

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



How to send a packet taken from WPE PRO with Winsock control vb2010

Discussion on How to send a packet taken from WPE PRO with Winsock control vb2010 within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
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 ..
sarkoplata is offline  
Old 03/24/2011, 18:50   #2

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
bump
sarkoplata is offline  
Old 03/24/2011, 20:21   #3

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
bump
sarkoplata is offline  
Old 03/24/2011, 20:47   #4
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
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.InterNetworkSocketType.StreamProtocolType.Tcp)

Dim IP As IPAddress IPAddress.Parse("127.0.0.1")
Dim Port As Integer 22580
Dim IPEP 
As IPEndPoint = New IPEndPoint(IPPort)

sroSocket.Connect(IPEP)

//Sub to send a packet:
Sub SendPacket(ByVal OpCode As StringByVal 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 
0 To sData.Length 1
                    w
.Write(CByte("&H" sData.Substring(22)))
                
Next

                w
.BaseStream.Position 0
                w
.Write(CUShort(w.BaseStream.Length 6))
                
w.Flush()

                
sroSocket.Send(buffer.ToArray)
            
End Using
        End Using
    End Sub

//Call the SendPacket-Sub:
SendPacket("YourOpCode""YourData"
Hope it will help you!
Kraizy​ is offline  
Old 03/24/2011, 21:02   #5

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
Quote:
Originally Posted by Fisticuff View Post
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.InterNetworkSocketType.StreamProtocolType.Tcp)

Dim IP As IPAddress IPAddress.Parse("127.0.0.1")
Dim Port As Integer 22580
Dim IPEP 
As IPEndPoint = New IPEndPoint(IPPort)

sroSocket.Connect(IPEP)

//Sub to send a packet:
Sub SendPacket(ByVal OpCode As StringByVal 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 
0 To sData.Length 1
                    w
.Write(CByte("&H" sData.Substring(22)))
                
Next

                w
.BaseStream.Position 0
                w
.Write(CUShort(w.BaseStream.Length 6))
                
w.Flush()

                
sroSocket.Send(buffer.ToArray)
            
End Using
        End Using
    End Sub

//Call the SendPacket-Sub:
SendPacket("YourOpCode""YourData"
Hope it will help you!
Thanks for the reply , btw i wanna send packets to zszc too
I'm pmming you atm , we 2 beginners can make something ^^
sarkoplata is offline  
Old 03/25/2011, 15:09   #6
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
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.
Kraizy​ is offline  
Old 03/25/2011, 20:51   #7

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
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
sarkoplata is offline  
Old 03/25/2011, 21:05   #8
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
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...
Kraizy​ is offline  
Old 03/25/2011, 21:36   #9

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
Quote:
Originally Posted by Fisticuff View Post
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
sarkoplata is offline  
Old 03/26/2011, 10:23   #10
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
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.
Attached Files
File Type: zip phTools.zip (45.7 KB, 196 views)
Kraizy​ is offline  
Thanks
3 Users
Old 03/26/2011, 12:20   #11

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
Quote:
Originally Posted by sarkoplata View Post
Thank you very much , very good explanation.
I will try them and edit my post.
EDIT # It has just worked... Thank you a lot
I will write down if i have problem again
sarkoplata is offline  
Old 03/27/2011, 16:30   #12

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
It didn't take me longer to be back ...
This time I just wanna basicly learn how to read an offset.
I have the offsets..
sarkoplata is offline  
Old 03/27/2011, 17:27   #13
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
You will need the ReadProcessMemory-WinAPI. Just google for it...
Kraizy​ is offline  
Old 03/28/2011, 19:18   #14

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
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
But only charName works with me
sarkoplata is offline  
Old 03/28/2011, 20:29   #15
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
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 IntPtrByVal lpBaseAddress As IntPtrByVal lpBuffer As Byte(), ByVal nSize As UIntPtrByRef lpNumberOfBytesWritten As UInteger) As Boolean
    
Dim bytes 
As Byte() = New Byte(23) {}
            
Dim rw As Integer 0

            
//Pointer
            
ReadProcessMemory(readHandleDirectCast(&HAA0E44Integer), bytesDirectCast(24Integer), rw)
            
Dim pointer As Integer BitConverter.ToInt32(bytes0)

            
//Charname
            
Dim charNameAddress As UInteger = &HA9FB98
            ReadProcessMemory
(readHandleDirectCast(charNameAddressUInteger), bytesDirectCast(24Integer), rw)
            
charName Encoding.UTF8.GetString(bytes)

            
//Current HP
            
ReadProcessMemory(readHandleDirectCast(pointer + &H3BCInteger), bytesDirectCast(24Integer), rw)
            
Dim currHP As Integer BitConverter.ToInt32(bytes0)

            
//Maximal HP
            
ReadProcessMemory(readHandleDirectCast(pointer + &H3B4Integer), bytesDirectCast(24Integer), rw)
            
Dim maxHP As Integer BitConverter.ToInt32(bytes0)

            
//Current MP
            
ReadProcessMemory(readHandleDirectCast(pointer + &H3B0Integer), bytesDirectCast(24Integer), rw)
            
Dim currMP As Integer BitConverter.ToInt32(bytes0)

            
//Maximal MP
            
ReadProcessMemory(readHandleDirectCast(pointer + &H3B8Integer), bytesDirectCast(24Integer), rw)
            
Dim maxMP As Integer BitConverter.ToInt32(bytes0)

            
//Level
            
ReadProcessMemory(readHandleDirectCast(pointer + &H7C8Integer), bytesDirectCast(24Integer), 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...
Kraizy​ is offline  
Reply


Similar Threads Similar Threads
(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..



All times are GMT +1. The time now is 19:24.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.