Skip to content

Commit

Permalink
fix: native RSA modulus searching in newer clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Z-Kris committed Dec 13, 2024
1 parent 3429e38 commit 25e0733
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ internal class RsaModulusProcessor(
if (index == -1) {
throw IllegalStateException("Unable to locate exponent 10001")
}
// Begin searching for the modulus before the exponent.
// In some clients, it comes just before; in most, it comes just after it.
val sliceIndices =
client.bytes.firstSliceIndices(index + 5, 256) { byte ->
client.bytes.firstSliceIndices(index - 300, 256) { byte ->
isHex(byte.toInt().toChar())
}
val slice = client.bytes.sliceArray(sliceIndices)
Expand Down Expand Up @@ -65,7 +67,7 @@ internal class RsaModulusProcessor(
}
end++
}
if (length != -1 && end - start < length) {
if (length != -1 && (end - start) != length) {
start = end
continue
}
Expand Down

2 comments on commit 25e0733

@CloudS3c
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image
@Z-Kris Uhh seems that Native Patcher places bytes in wrong location

@Z-Kris
Copy link
Contributor Author

@Z-Kris Z-Kris commented on 25e0733 Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't the patcher that was the issue, it was the client repository link since RuneWiki recently migrated. It was trying to patch some random 2kb file rather than the ~10mb client, that's why it failed to find it.

Please sign in to comment.