Skip to content

Commit

Permalink
fix: vanilla fingerprinting on pre-releases
Browse files Browse the repository at this point in the history
fix: vanilla fingerprinting on pre-releases
fix: server version mismatch detection
  • Loading branch information
Sch8ill committed Mar 21, 2024
1 parent c7b4176 commit 772ebbd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions fingerprint/fingerprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ func (m *DisconnectMsg) Fingerprint() (string, error) {
m.With[0],
"Internal Exception: io.netty.handler.codec.DecoderException: java.io.IOException: Packet ")

re := regexp.MustCompile(" was larger than I expected, found \\d+ bytes extra whilst reading packet \\d+$")
re := regexp.MustCompile(
" was larger than I expected, found (?:\\d+|serverbound/minecraft:hello) bytes extra whilst reading packet (?:\\d+|serverbound/minecraft:hello)$")
msg = re.ReplaceAllString(msg, "")

if msg == "login/0 (PacketLoginInStart)" {
Expand All @@ -176,8 +177,8 @@ func (m *DisconnectMsg) Fingerprint() (string, error) {
return Forge, nil
}

// vanilla e.g.: login/0 (afu)
vanillaRe := regexp.MustCompile("^login/0 \\(.{2,3}?\\)$")
// vanilla e.g.: login/0 (afu) or login/serverbound/minecraft:hello (aio)
vanillaRe := regexp.MustCompile("^login/(serverbound/minecraft:hello|0) \\(.{2,3}?\\)$")
if vanillaRe.MatchString(msg) {
return Vanilla, nil
}
Expand All @@ -192,7 +193,11 @@ func (m *DisconnectMsg) Fingerprint() (string, error) {
}

func (m *DisconnectMsg) VersionMismatch() (bool, string) {
if m.Translate == "multiplayer.disconnect.incompatible" {
switch m.Translate {
case "multiplayer.disconnect.incompatible":
fallthrough

case "multiplayer.disconnect.outdated_client":
if len(m.With) < 1 {
return true, ""
}
Expand Down

0 comments on commit 772ebbd

Please sign in to comment.