- Inscrit
- 10 Mai 2012
- Messages
- 15
- Reactions
- 0
Bonjour à tous,
Après avoir lu plusieurs fois les tutoriaux présent sur ce site je décide de me lancer et , pour commencer, de mettre à jour les sources d'overedge.
Cependant après quelques modifications j'ai déjà un problème car le programme n’envoie pas le packet 4 après avoir reçu le 3.
Voici la classe HelloConnectMessage :
Et IdentificationMessage :
Puis le case 3 :
Voici ce que j'obtient :
De plus, j'utilise la classe de Maxou pour le cryptage RSA
Voilà je crois que j'ai tout dit
Après avoir lu plusieurs fois les tutoriaux présent sur ce site je décide de me lancer et , pour commencer, de mettre à jour les sources d'overedge.
Cependant après quelques modifications j'ai déjà un problème car le programme n’envoie pas le packet 4 après avoir reçu le 3.
Code:
Namespace Messages.Connection
Public Class HelloConnectMessage
Private _isInitialized As Boolean = False
Public ConnectionType As UInteger = 0
Private _Salt As String
Private _Key As New List(Of Integer)()
Public ProtocolId As UInteger = 3
Public Function HelloConnectMessage()
Return Me
End Function
Public ReadOnly Property Salt() As String
Get
Return _Salt
End Get
End Property
Public ReadOnly Property Key() As List(Of Integer)
Get
Return _Key
End Get
End Property
Public Function get_isInitialized() As Boolean
Return Me._isInitialized
End Function
Public Function getMessageId() As UInteger
Return ProtocolId
End Function
'public function pack(ByVal param1 As Client.Dofus.dofuswriter)
' dim _loc_2 as * = new ByteArray()
' Me.serialize(_loc_2)
' writePacket(param1, Me.getMessageId(), _loc_2)
' Return Me
'End Function
Public Function unpack(ByVal param1 As Dofus.DofusReader)
Me.deserialize(param1)
Return Me
End Function
Public Function deserialize(ByVal param1 As Dofus.DofusReader)
Me.deserializeAs_HelloConnectMessage(param1)
Return Me
End Function
Public Sub deserializeAs_HelloConnectMessage(ByVal reader As Dofus.DofusReader)
_Salt = reader.ReadString()
Dim keyCount As UShort = reader.ReadUnSignedshort()
For i As Integer = 0 To keyCount - 1
_Key.Add(reader.ReadByte())
Next
End Sub
End Class
End Namespace
Et IdentificationMessage :
Code:
Imports WindowsApplication1.Types.Version
Imports WindowsApplication1.Network.Messages.Connexion
Namespace Messages.Connection
Public Class IdentificationMessage
Private _isInitialized As Boolean = False
Public version As Types.Version.Version
Public lang As String = ""
Public login As String = ""
Public credentials As New List(Of Integer)
Public serverId As Integer = 0
Public certificate As New List(Of TrustCertificate)
Public autoconnect As Boolean = True
Public useCertificate As Boolean = False
Public useLoginToken As Boolean = False
Public protocolId As UInteger = 4
Public Function IdentificationMessage()
Me.Version = New Version()
Return Me
End Function
Public Function get_isInitialized() As Boolean
Return Me._isInitialized
End Function
Public Function getMessageId() As UInteger
Return ProtocolId
End Function
Public Function initIdentificationMessage(ByVal param1 As Types.Version.Version, ByVal param2 As String, ByVal param3 As String, ByVal param4 As List(Of Integer), ByVal param5 As Integer, ByVal param6 As Boolean, ByVal param7 As Boolean, ByVal param8 As Boolean) As IdentificationMessage
Me.version = param1
Me.lang = param2
Me.login = param3
Me.credentials = param4
Me.serverId = param5
Me.autoconnect = param6
Me.useCertificate = param7
Me.useLoginToken = param8
Me._isInitialized = True
Return Me
End Function
Public Function pack()
Dim _loc_2 As New Dofus.DofusWriter
Me.serialize(_loc_2)
Dofus.DofusWriter.Send(protocolId)
Return Me
End Function
Public Function unpack(ByVal param1 As Dofus.DofusReader)
Me.deserialize(param1)
Return Me
End Function
Public Function serialize(ByVal param1 As Dofus.DofusWriter)
Me.serializeAs_IdentificationMessage(param1)
Return Me
End Function
Public Function serializeAs_IdentificationMessage(ByVal param1 As Dofus.DofusWriter)
Dim _loc_2 As Integer = 0
Dim flag As jerakine.network.utils.BooleanByteWrapper
flag = New jerakine.network.utils.BooleanByteWrapper
Me.autoconnect = flag.setFlag(_loc_2, 0, Me.autoconnect)
Me.useCertificate = flag.setFlag(_loc_2, 1, Me.useCertificate)
Me.useLoginToken = flag.setFlag(_loc_2, 2, Me.useLoginToken)
param1.WriteByte(_loc_2)
Me.version.serializeAs_Version(param1)
param1.WriteUTF(Me.lang)
param1.WriteUTF(Me.login)
param1.WriteShort(Me.credentials.Count)
Dim lenght As Integer = 0
While lenght < Me.credentials.Count
param1.WriteByte(Me.credentials(lenght))
lenght = lenght + 1
End While
param1.WriteShort(Me.serverId)
Return Me
End Function
Public Function deserialize(ByVal param1 As Dofus.DofusReader)
Me.deserializeAs_IdentificationMessage(param1)
Return Me
End Function
Public Function deserializeAs_IdentificationMessage(ByVal param1 As Dofus.DofusReader)
Dim _loc_5 As Integer = 0
Dim _loc_2 As Byte = param1.ReadByte()
Dim flag As jerakine.network.utils.BooleanByteWrapper
flag = New jerakine.network.utils.BooleanByteWrapper
Me.autoconnect = flag.getFlag(_loc_2, 0)
Me.useCertificate = flag.getFlag(_loc_2, 1)
Me.useLoginToken = flag.getFlag(_loc_2, 2)
Me.version = New Version()
Me.version.deserialize(param1)
Me.lang = param1.ReadUTF()
Me.login = param1.ReadUTF()
Dim _loc_3 As UShort = param1.ReadUnSignedshort()
Dim _loc_4 As Integer
For _loc_4 = 0 To _loc_3
_loc_5 = param1.ReadByte()
Me.credentials.Add(_loc_5)
Next
Me.serverId = param1.ReadShort()
Return Me
End Function
Private Function Sock() As Object
Throw New NotImplementedException
End Function
End Class
End Namespace
Puis le case 3 :
Code:
Case 3
Dim hcm As New Messages.Connection.HelloConnectMessage
hcm.deserialize(PacketData)
' Récupération de la clef
Dim key = hcm.Key()
Dim salt = hcm.Salt()
' Cryptage du pass
Dim Account As String = NdC.Text
Dim Password As String = MdP.Text
Dim EncryptedPassword As List(Of Integer) = RSAManager.Encrypt(salt & Password, key)
' Création de la version
Dim Version_ As New Types.Version.Version
Version_.initVersion(2, 7, 4, 61926, 2, 0)
Dim certificate As New List(Of TrustCertificate)
' Envoi du packet
Dim Message As New Messages.Connection.IdentificationMessage
Message.initIdentificationMessage(Version_, "fr", Account, EncryptedPassword, 0, True, False, False)
Message.pack()
Voici ce que j'obtient :
De plus, j'utilise la classe de Maxou pour le cryptage RSA
Voilà je crois que j'ai tout dit