Skip to content

Commit

Permalink
Fix realm version checking
Browse files Browse the repository at this point in the history
  • Loading branch information
fjaros committed Dec 6, 2020
1 parent 1c3f2d7 commit 490b79d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@ Even though this bot does not do anything malicious, some servers may not like a
OR to compile yourself:
1. WoW Chat is written in Scala and compiles to a Java executable using [maven](https://maven.apache.org).
2. It uses Java JDK 1.8 and Scala 2.12.12.
3. Run `mvn clean package` which will produce a file in the target folder called `wowchat-1.3.6.zip`
4. unzip `wowchat-1.3.6.zip`, edit the configuration file and run `java -jar wowchat.jar <config file>`
3. Run `mvn clean package` which will produce a file in the target folder called `wowchat-1.3.7.zip`
4. unzip `wowchat-1.3.7.zip`, edit the configuration file and run `java -jar wowchat.jar <config file>`
* If no config file is supplied, the bot will try to use `wowchat.conf`
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>wowchat</groupId>
<artifactId>wowchat</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>

<properties>
<java.version>1.8</java.version>
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/wowchat/WoWChat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import scala.io.Source

object WoWChat extends StrictLogging {

private val RELEASE = "v1.3.6"
private val RELEASE = "v1.3.7"

def main(args: Array[String]): Unit = {
logger.info(s"Running WoWChat - $RELEASE")
Expand Down
25 changes: 23 additions & 2 deletions src/main/scala/wowchat/realm/RealmPacketHandler.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package wowchat.realm

import java.security.MessageDigest

import wowchat.common._
import com.typesafe.scalalogging.StrictLogging
import io.netty.buffer.{ByteBuf, PooledByteBufAllocator}
Expand All @@ -15,6 +17,21 @@ class RealmPacketHandler(realmConnectionCallback: RealmConnectionCallback)
private var expectedDisconnect = false
private var sessionKey: Array[Byte] = _

private val buildCrcHashes = Map(
(5875, Platform.Mac)
-> Array(0x8D, 0x17, 0x3C, 0xC3, 0x81, 0x96, 0x1E, 0xEB, 0xAB, 0xF3, 0x36, 0xF5, 0xE6, 0x67, 0x5B, 0x10, 0x1B, 0xB5, 0x13, 0xE5).map(_.toByte),
(5875, Platform.Windows)
-> Array(0x95, 0xED, 0xB2, 0x7C, 0x78, 0x23, 0xB3, 0x63, 0xCB, 0xDD, 0xAB, 0x56, 0xA3, 0x92, 0xE7, 0xCB, 0x73, 0xFC, 0xCA, 0x20).map(_.toByte),
(8606, Platform.Mac)
-> Array(0xD8, 0xB0, 0xEC, 0xFE, 0x53, 0x4B, 0xC1, 0x13, 0x1E, 0x19, 0xBA, 0xD1, 0xD4, 0xC0, 0xE8, 0x13, 0xEE, 0xE4, 0x99, 0x4F).map(_.toByte),
(8606, Platform.Windows)
-> Array(0x31, 0x9A, 0xFA, 0xA3, 0xF2, 0x55, 0x96, 0x82, 0xF9, 0xFF, 0x65, 0x8B, 0xE0, 0x14, 0x56, 0x25, 0x5F, 0x45, 0x6F, 0xB1).map(_.toByte),
(12340, Platform.Mac)
-> Array(0xB7, 0x06, 0xD1, 0x3F, 0xF2, 0xF4, 0x01, 0x88, 0x39, 0x72, 0x94, 0x61, 0xE3, 0xF8, 0xA0, 0xE2, 0xB5, 0xFD, 0xC0, 0x34).map(_.toByte),
(12340, Platform.Windows)
-> Array(0xCD, 0xCB, 0xBD, 0x51, 0x88, 0x31, 0x5E, 0x6B, 0x4D, 0x19, 0x44, 0x9D, 0x49, 0x2D, 0xBC, 0xFA, 0xF1, 0x56, 0xA3, 0x47).map(_.toByte)
)

override def channelInactive(ctx: ChannelHandlerContext): Unit = {
if (!expectedDisconnect) {
realmConnectionCallback.disconnected
Expand Down Expand Up @@ -107,10 +124,14 @@ class RealmPacketHandler(realmConnectionCallback: RealmConnectionCallback)

sessionKey = srpClient.K.asByteArray()

val aArray = srpClient.A.asByteArray(32)
val ret = PooledByteBufAllocator.DEFAULT.buffer(74, 74)
ret.writeBytes(srpClient.A.asByteArray(32))
ret.writeBytes(srpClient.M.asByteArray(20, false))
ret.writeBytes(aArray)
ret.writeBytes(srpClient.M.asByteArray(20, false))
val md = MessageDigest.getInstance("SHA1")
md.update(aArray)
md.update(buildCrcHashes.getOrElse((WowChatConfig.getBuild, Global.config.wow.platform), new Array[Byte](20)))
ret.writeBytes(md.digest)
ret.writeByte(0)
ret.writeByte(0)

Expand Down

0 comments on commit 490b79d

Please sign in to comment.