MrKinau / FishingBot

1.8 - 1.20.6 Fishing bot for Minecraft
GNU General Public License v3.0
321 stars 67 forks source link

Support spoofing forge #38

Open matthewfcarlson opened 4 years ago

matthewfcarlson commented 4 years ago

When trying to sign into a forge server, this error presents itself.

java.net.SocketException: Software caused connection abort: recv failed
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.io.FilterInputStream.read(Unknown Source)
        at systems.kinau.fishingbot.network.protocol.Packet.readVarInt(Packet.java:108)
        at systems.kinau.fishingbot.network.protocol.NetworkHandler.readUncompressed(NetworkHandler.java:425)
        at systems.kinau.fishingbot.network.protocol.NetworkHandler.readData(NetworkHandler.java:419)
        at systems.kinau.fishingbot.FishingBot.connect(FishingBot.java:210)
        at systems.kinau.fishingbot.FishingBot.start(FishingBot.java:143)
        at systems.kinau.fishingbot.Main.main(Main.java:12)
[2020-04-05 12:09:44] [WARNING] Could not receive packet! Shutting down!
[2020-04-05 12:09:44] [INFO   ] Module "ClientDefaultsModule" disabled!
[2020-04-05 12:09:44] [INFO   ] Module "FishingModule" disabled!
[2020-04-05 12:09:44] [INFO   ] FishingBot restarts in 3 seconds...
[2020-04-05 12:09:47] [INFO   ] Module "FishingModule" enabled!
[2020-04-05 12:09:47] [INFO   ] Module "HandshakeModule" enabled!
[2020-04-05 12:09:47] [INFO   ] Module "LoginModule" enabled!
[2020-04-05 12:09:47] [INFO   ] Module "ChatCommandModule" enabled!
[2020-04-05 12:09:47] [INFO   ] Module "ClientDefaultsModule" enabled!
[2020-04-05 12:09:47] [SEVERE ] Login failed: {"text":"This server has mods that require Forge to be installed on the client. Contact your server admin for more details."}
[2020-04-05 12:09:47] [INFO   ] Module "ClientDefaultsModule" disabled!
[2020-04-05 12:09:47] [INFO   ] Module "FishingModule" disabled!
[2020-04-05 12:09:47] [INFO   ] FishingBot restarts in 3 seconds...
Exception in thread "Thread-5" Exception in thread "Thread-3" java.lang.NullPointerException
        at systems.kinau.fishingbot.FishingBot.lambda$connect$0(FishingBot.java:202)
        at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
        at systems.kinau.fishingbot.FishingBot.lambda$connect$0(FishingBot.java:202)
        at java.lang.Thread.run(Unknown Source)

https://wiki.vg/Minecraft_Forge_Handshake#Pre-1.13

https://github.com/PrismarineJS/node-minecraft-protocol-forge this is an offering for node-protocol (which doesn't support 1.15 grumble grumble).

I might take a look into implementing this, but we'll see

seupedro commented 4 years ago

Hi, I'm facing the same issue. How could I contribute to fix this? And why did the update was postponed to 1.16 version? Couldn't implement that as a new feature in 1.15.2 ?

MrKinau commented 4 years ago

I am not.sure if this is fixable at all (skipping all mod handshakes may cause issues), if you want to write this Forge spoofing bypass you are welcome to create a Pull Request :) It's under the 1.16 milestone, because this is the next time I will touch the code. If someone else will create a PR for it, it could be earlier.

seupedro commented 4 years ago

Good. Do you know how does the mod handshake works? If I knew I could work on it and create a pull request.

MrKinau commented 4 years ago

They are described at the wiki.vg article (I think) above. Atm I dont have much time to really check this. I will work on it after the 1.16 release or someone else (Maybe you) have to figure it out and create a PR

MrKinau commented 4 years ago

Tried it out today. After adding the "\0FML\0" to the Handshake packet I'll get a 0x1b packet (which normally is not valid in the login procedure) which disconnects the client with {"translate":"disconnect.genericReason","with":["Internal Exception: java.lang.NumberFormatException: For input string: \"\""]}. I am not quite sure why this happens or what I am doing wrong, but I won't receive any forge handshakes :( trying it out later on