mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-24 22:39:07 +00:00
Fix LoginMessage and ConnectToWorldReqMsg token
The decoding was wrong. ASCII was the wrong choice. We needed a cstring and to add padding instead of assuming a fixed size. Fixes and closes #2
This commit is contained in:
parent
f1fae83548
commit
5ed40e73b3
3 changed files with 6 additions and 4 deletions
|
|
@ -8,6 +8,7 @@ import scodec.codecs._
|
|||
// NOTE: this packet has a ton of bytes left over at the end and is usually all zeros
|
||||
// except for the server name and a 0x80 near the end
|
||||
final case class ConnectToWorldRequestMessage(server : String,
|
||||
token : String,
|
||||
majorVersion : Long,
|
||||
minorVersion : Long,
|
||||
revision : Long,
|
||||
|
|
@ -21,7 +22,7 @@ final case class ConnectToWorldRequestMessage(server : String,
|
|||
object ConnectToWorldRequestMessage extends Marshallable[ConnectToWorldRequestMessage] {
|
||||
implicit val codec : Codec[ConnectToWorldRequestMessage] = (
|
||||
("server_name" | PacketHelpers.encodedString) ::
|
||||
("unknown" | ignore(32*8)) ::
|
||||
("token" | paddedFixedSizeBytes(32, cstring, ignore(8))) :: // must be an ignore 8 as the memory might not be 0x00
|
||||
("major_version" | uint32L) ::
|
||||
("minor_version" | uint32L) ::
|
||||
("revision" | uint32L) ::
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ final case class LoginMessage(majorVersion : Long,
|
|||
object LoginMessage extends Marshallable[LoginMessage] {
|
||||
private def username = PacketHelpers.encodedStringAligned(7)
|
||||
private def password = PacketHelpers.encodedString
|
||||
private def tokenPath = fixedSizeBytes(32, ascii) :: username
|
||||
private def tokenPath = paddedFixedSizeBytes(32, cstring, ignore(8)) :: username
|
||||
private def passwordPath = username :: password
|
||||
|
||||
type Struct = String :: Option[String] :: Option[String] :: HNil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue