Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 17:44

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

Advertisement



VB Packets Help ( Again :D )

Discussion on VB Packets Help ( Again :D ) within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
DeXeee's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 218
Received Thanks: 171
Question VB Packets Help ( Again :D )

Hi guys

Here i am again with the same question like last time, just the last time that was a project in AutoIt.

I decided to learn VB becouse it look very easy. I have already learned some basic things, thanks to YouTube and the guy called "TeachMeComputer". I watched all 50+ of his tutorials, so for now i just know some basic things.

For now, i make the connection to srProxy


Code:
Imports System.Net.Sockets
Imports System.Text
Public Class Form1

    Dim clientSocket As New System.Net.Sockets.TcpClient()

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        clientSocket.Connect("127.0.0.1", 9000)
        If clientSocket.Connected Then
            Label2.Text = "Connected"
        End If
    End Sub

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
    End Sub
End Class
Now the question is how do I send packets ?

Thanks in advance, cheers !
DeXeee is offline  
Old 08/11/2011, 00:47   #2

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,341
Received Thanks: 2,661
Quote:
Originally Posted by lordfeling View Post
Hi, thanks for you responce.

I've captured somes packet :

Code:
Sit-stand up :
[C -> S][704F]
04
Code:
pick gold :
[C -> S][7074]
01                                                
02                                                
01                                                
6E 05 1A 00

I never programmed a tool with packet.
That why I require help for learn how to use Packet.

Thanks.
Ok, First of all we should import our class.
Just write the top of the class :

PHP Code:
Imports System.Net.Sockets 
Now we are able to use system.net.sockets class.

Lets declare our socket :

PHP Code:
    Public Client As Socket = New Socket(AddressFamily.InterNetworkSocketType.StreamProtocolType.Tcp
Now , we are should connect to our proxy to inject packets.
You can basicly use phConnector for this.
(And you will redirect your ip to 127.0.0.1 : 15778 from loader. )

Lets connect our socket :

PHP Code:
Client.Connect("localhost"xyour phConnector botport 
Now we connected to proxy and we can send packets.
Packets are in raw form at fact , but we convert em to easier structure.

Client.Send("x") will send raw packets.
So we should make our packet raw at first.
Here is my func. to do that. This func. is written by xKraizy.

PHP Code:
Public Sub SendPacket(ByVal OpCode As StringByVal sData As StringByVal Enc As Boolean)
        
Using buffer As New IO.MemoryStream
            Using w 
As New IO.BinaryWriter(buffer)
                
w.Write(CUShort(0))
                
w.Write(CUShort("&H" OpCode))
                If 
Enc True Then
                    w
.Write(CUShort(3))
                Else
                    
w.Write(CUShort(1))
                
End If
                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()
                
Client.Send(buffer.ToArray)
            
End Using
        End Using
    End Sub 
You can call this function anywhere you want now.
For example , add client connecting thingy to form_load , and add a button and write this.

PHP Code:
SendPacket("704F","04",False
First parameter is your opcode
Second parameter is your packet data
Third packet is a boolean , if you make it True , you will be able to send encrypted packets.(They are a bit intermediate part.)

And about gold packet ;

I dont really remember but every byte in packet has a meaning.

PHP Code:
[-> S][7074// Opcode
01 // Some Flag                                               
02 // Some Flag                                                      
01 // Some Flag                                                      
6E 05 1A 00  // UniqueID of gold. 
Have fun and ask when you needed !
sarkolata
sarkoplata is offline  
Thanks
3 Users
Old 08/11/2011, 00:50   #3
 
DeXeee's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 218
Received Thanks: 171
Quote:
Originally Posted by sarkoplata View Post
Ok, First of all we should import our class.
Just write the top of the class :

PHP Code:
Imports System.Net.Sockets 
Now we are able to use system.net.sockets class.

Lets declare our socket :

PHP Code:
    Public Client As Socket = New Socket(AddressFamily.InterNetworkSocketType.StreamProtocolType.Tcp
Now , we are should connect to our proxy to inject packets.
You can basicly use phConnector for this.
(And you will redirect your ip to 127.0.0.1 : 15778 from loader. )

Lets connect our socket :

PHP Code:
Client.Connect("localhost"xyour phConnector botport 
Now we connected to proxy and we can send packets.
Packets are in raw form at fact , but we convert em to easier structure.

Client.Send("x") will send raw packets.
So we should make our packet raw at first.
Here is my func. to do that. This func. is written by xKraizy.

PHP Code:
Public Sub SendPacket(ByVal OpCode As StringByVal sData As StringByVal Enc As Boolean)
        
Using buffer As New IO.MemoryStream
            Using w 
As New IO.BinaryWriter(buffer)
                
w.Write(CUShort(0))
                
w.Write(CUShort("&H" OpCode))
                If 
Enc True Then
                    w
.Write(CUShort(3))
                Else
                    
w.Write(CUShort(1))
                
End If
                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()
                
Client.Send(buffer.ToArray)
            
End Using
        End Using
    End Sub 
You can call this function anywhere you want now.
For example , add client connecting thingy to form_load , and add a button and write this.

PHP Code:
SendPacket("704F","04",False
First parameter is your opcode
Second parameter is your packet data
Third packet is a boolean , if you make it True , you will be able to send encrypted packets.(They are a bit intermediate part.)

And about gold packet ;

I dont really remember but every byte in packet has a meaning.

PHP Code:
[-> S][7074// Opcode
01 // Some Flag                                               
02 // Some Flag                                                      
01 // Some Flag                                                      
6E 05 1A 00  // UniqueID of gold. 
Have fun and ask when you needed !
sarkolata
Ty for this, i will take a look at this codes

I rly don't understand this part

Code:
Public Sub SendPacket(ByVal OpCode As String, ByVal sData As String, ByVal Enc As Boolean)
        Using buffer As New IO.MemoryStream
            Using w As New IO.BinaryWriter(buffer)
                w.Write(CUShort(0))
                w.Write(CUShort("&H" + OpCode))
                If Enc = True Then
                    w.Write(CUShort(3))
                Else
                    w.Write(CUShort(1))
                End If
                For n = 0 To sData.Length / 2 - 1
                    w.Write(CByte("&H" & sData.Substring(n * 2, 2)))
                Next

                w.BaseStream.Position = 0
                w.Write(CUShort(w.BaseStream.Length - 6))
                w.Flush()
                Client.Send(buffer.ToArray)
            End Using
        End Using
    End Sub
Can you explain me a little bit more ?
DeXeee is offline  
Old 08/11/2011, 10:48   #4
 
lesderid's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 2,400
Received Thanks: 1,517
Quote:
Originally Posted by DeXeee View Post
I rly don't understand this part

Code:
Public Sub SendPacket(ByVal OpCode As String, ByVal sData As String, ByVal Enc As Boolean)
        Using buffer As New IO.MemoryStream
            Using w As New IO.BinaryWriter(buffer)
                w.Write(CUShort(0)) ' Size is 0 because it 'cannot' be known yet.
                w.Write(CUShort("&H" + OpCode)) ' Converts the string Opcode to a UInt16, reading the Opcode as a hexadecimal representation
                If Enc = True Then
                    w.Write(CUShort(3)) ' Encryption flag phConnector
                Else
                    w.Write(CUShort(1)) ' No-encryption flag phConnector
                End If
                For n = 0 To sData.Length / 2 - 1 ' Each byte is two characters and starting from 0 so decreasing by 1
                    w.Write(CByte("&H" & sData.Substring(n * 2, 2))) ' Writes every byte
                Next

                w.BaseStream.Position = 0 ' Resets the position to write the size
                w.Write(CUShort(w.BaseStream.Length - 6)) ' Writes the size to the '0' placeholder
                w.Flush() ' Makes sure the data is written to the buffer
                Client.Send(buffer.ToArray) ' Sends the buffer to the Socket
            End Using
        End Using
    End Sub
Can you explain me a little bit more ?
Added some comments.
lesderid is offline  
Thanks
2 Users
Old 08/11/2011, 11:17   #5
 
DeXeee's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 218
Received Thanks: 171
Oh, so this example is for phConnector ..

How can i send packet with srProxy ?
DeXeee is offline  
Old 08/11/2011, 11:55   #6
 
lesderid's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 2,400
Received Thanks: 1,517
Quote:
Originally Posted by DeXeee View Post
Oh, so this example is for phConnector ..

How can i send packet with srProxy ?
Sorry, no idea what header format they use.
lesderid is offline  
Old 08/11/2011, 13:54   #7

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,341
Received Thanks: 2,661
Quote:
Originally Posted by DeXeee View Post
Oh, so this example is for phConnector ..

How can i send packet with srProxy ?
Why ?
sarkoplata is offline  
Old 08/11/2011, 21:39   #8
 
DeXeee's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 218
Received Thanks: 171
Quote:
Originally Posted by sarkoplata View Post
Why ?
Becouse i want to use srProxy
DeXeee is offline  
Old 08/11/2011, 23:08   #9

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,341
Received Thanks: 2,661
Quote:
Originally Posted by DeXeee View Post
Becouse i want to use srProxy
too explanatory
sarkoplata is offline  
Old 08/11/2011, 23:21   #10
 
DeXeee's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 218
Received Thanks: 171
Quote:
Originally Posted by sarkoplata View Post
too explanatory
I am sure that i need to change something here :

Code:
Public Sub SendPacket(ByVal OpCode As String, ByVal sData As String, ByVal Enc As Boolean)
        Using buffer As New IO.MemoryStream
            Using w As New IO.BinaryWriter(buffer)
                w.Write(CUShort(0)) ' Size is 0 because it 'cannot' be known yet.
                w.Write(CUShort("&H" + OpCode)) ' Converts the string Opcode to a UInt16, reading the Opcode as a hexadecimal representation
                If Enc = True Then
                    w.Write(CUShort(3)) ' Encryption flag phConnector
                Else
                    w.Write(CUShort(1)) ' No-encryption flag phConnector
                End If
                For n = 0 To sData.Length / 2 - 1 ' Each byte is two characters and starting from 0 so decreasing by 1
                    w.Write(CByte("&H" & sData.Substring(n * 2, 2))) ' Writes every byte
                Next

                w.BaseStream.Position = 0 ' Resets the position to write the size
                w.Write(CUShort(w.BaseStream.Length - 6)) ' Writes the size to the '0' placeholder
                w.Flush() ' Makes sure the data is written to the buffer
                Client.Send(buffer.ToArray) ' Sends the buffer to the Socket
            End Using
        End Using
    End Sub
I will try something

Tnx for help anyway
DeXeee is offline  
Old 08/24/2011, 17:00   #11
 
DeXeee's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 218
Received Thanks: 171
I tried everything and i can't send packet :S

I am using SrProxy

I was trying something like this :

Code:
Public Client As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Client.Connect("127.0.0.1", 9000)
        If Client.Connected Then
            Label2.Text = "Connected"
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Client.Send("0x01004F70020004")   <<<---- Here is the problem !!
    End Sub
Is there any other way to just send packet, becouse this .Send don't want to work


With AutoIT its working :

Code:
TCPSend($socket, "0x01004F70020004")
DeXeee is offline  
Old 08/24/2011, 22:11   #12
 
elite*gold: 0
Join Date: Aug 2011
Posts: 11
Received Thanks: 4
use SendPacket code in page one it should work well with u
slider2009 is offline  
Thanks
1 User
Old 08/25/2011, 00:37   #13
 
DeXeee's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 218
Received Thanks: 171
Quote:
Originally Posted by slider2009 View Post
use SendPacket code in page one it should work well with u
Not working =/ Its only for phConnector

Loool ! Bro ty so much i find what i need to change

HAHAH , the problem was in :
Code:
If Enc = True Then
                    w.Write(CUShort(3))
                Else
                    w.Write(CUShort(2)) <<<---- For SrProxy this have to be 2 !!! For ph its 1
                End If
DeXeee is offline  
Old 08/25/2011, 19:00   #14
 
s2k's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 194
Received Thanks: 1,091
The Packet structure in PhConnector is same as in SrProxy and Nuconnector:
Quote:
LENGTH (Int16) OPCODE(Int16) ENCRYPTION(Int16) DATA

For encryption you have these options:
"0100 - Send to SERVER"
"0200 - Send to CLIENT"
"0300 - Send to SERVER encrypted"
"0400 - Send to CLIENT encrypted"
your old code has a bug because you are sending a string, you have to send bytes.
something like this:

Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  
        '01004F70020004
        Dim Packet As Byte() = {1, 0, 79, 112, 2, 0, 4}

        
        Client.Send(Packet)
    End Sub

btw: you are injecting the packet to sr_client. in the "SendPacket" code you only can choose the encryption, but not the direction.

i changed that code so you can define the direction:

Code:
 Public Sub SendPacket(ByVal OpCode As String, ByVal sData As String, ByVal direction As Byte, ByVal Enc As Boolean)
        Using buffer As New IO.MemoryStream
            Using w As New IO.BinaryWriter(buffer)
                w.Write(CUShort(0)) ' Size is 0 because it 'cannot' be known yet.
                w.Write(CUShort("&H" + OpCode)) ' Converts the string Opcode to a UInt16, reading the Opcode as a hexadecimal representation
                If Enc = True Then
                    If direction = 1 Then 'send to server
                        w.Write(CUShort(3)) ' Encryption flag phConnector
                    ElseIf direction = 2 Then 'send to client
                        w.Write(CUShort(4))
                    End If
                Else
                    If direction = 1 Then 'send to server
                        w.Write(CUShort(1)) ' Encryption flag phConnector
                    ElseIf direction = 2 Then 'send to client
                        w.Write(CUShort(2))
                    End If
                End If

                For n As Integer = 0 To sData.Length / 2 - 1 ' Each byte is two characters and starting from 0 so decreasing by 1
                    w.Write(CByte("&H" & sData.Substring(n * 2, 2))) ' Writes every byte
                Next

                w.BaseStream.Position = 0 ' Resets the position to write the size
                w.Write(CUShort(w.BaseStream.Length - 6)) ' Writes the size to the '0' placeholder
                w.Flush() ' Makes sure the data is written to the buffer
                Client.Send(buffer.ToArray) ' Sends the buffer to the Socket
            End Using
        End Using
    End Sub
you can use it this way:

Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  
        '0100 4F70 0200 04

        'dont use encryption unless you know what you are doing
        'direction= 1 send to server, 2= send to client
        SendPacket("704F", "04", 2, False)

    End Sub
s2k is offline  
Thanks
1 User
Old 08/29/2011, 00:13   #15
 
DeXeee's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 218
Received Thanks: 171
About receiving packets :

I am trying on this way, but i only get " ? " or nothing ...

Code:
  Public Client As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Load Sub
        Client.Connect("127.0.0.1", 9000)
        
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


        Dim inStream(10024) As Byte
        Client.Receive(inStream, 0, CInt(Client.ReceiveBufferSize), SocketFlags.None)
        Dim returndata As String = _
        System.Text.Encoding.ASCII.GetString(inStream)
        MsgBox("Data from Server : " + returndata)

       
    End Sub
I am working on this for 2 - 3 days and i don't know where i'am wrong :S
DeXeee is offline  
Reply


Similar Threads Similar Threads
[Packets] Wie änder ich flyff packets?
07/16/2011 - Flyff Private Server - 19 Replies
HeyHo, Ich würde sehr gerne wissen wie man die Flyff Packets ändert... ich denke mal Zahlen ändern werden nicht ausreichen oder?
WHICH PACKETS....
04/24/2011 - Conquer Online 2 - 28 Replies
mind if anyone tell me which specific packets are used to send and receive packing of dbs into dbscrolls cuz i cant seem to get wpepro record packets for me..
[Packets]
06/19/2009 - Kal Online - 11 Replies
Hallo, so geht an die letzten Feinheiten meines Magebots. Wir sieht es mit Skillanimationen aus? Nehmen wir mal an Ice Magic ist 0x10 b 2, muss ich dann für das animationspacket (0x21 ka weis es gerade net auswendig) auch 2 senden? bzw gibt es fälle in dennen sich das unterscheidet? 2. Das Alte Thema Z-Coord... gibt es nen funktionierendes HeightDetour irgendwo im forum, oder nix public? Bin im mom in der Uni, wie sieht mit dem hier aus: 3. Weis einer die Nr vom Expell-Packet? Ich...
Need help with packets
07/28/2007 - Conquer Online 2 - 3 Replies
hello all When u use something in conquer. it sends a packet to conquer right? Whats something good to see what this packet is. Also how can u send this packet again, im new to this so i need some help.
Packets
07/17/2007 - Cabal Online - 7 Replies
Ok, I recorded some packets. I was sitting in desert scream with a level 1 blader. It had level 1 impact stab. After three impact stab casts without moving at all, this is what I get: 55 81 8E BF 04 1E 95 22 31 6D 19 49 F4 05 A1 3A 7B A8 8E 68 BA F1 74 68 C5 AD 4A 57 16 FF DF 02 A7 75 89 27 CF C5 E5 6C 43 5C 68 F0 AE 8E 9F 8C D3 2C 70 DA 54 78 D3 B3 74 CF 72 5F 8F 16 B8 5C 0B 13 28 A0 68 Five normal attacks in a row.



All times are GMT +1. The time now is 17:44.


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.