Skip to content

Commit

Permalink
oh yeah this too
Browse files Browse the repository at this point in the history
  • Loading branch information
Spigey committed May 8, 2024
1 parent 78c9e56 commit 1a77208
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/main/java/spigey/asteroide/mixin/HandshakeC2SMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package spigey.asteroide.mixin;

import com.google.gson.JsonObject;
import spigey.asteroide.modules.BungeeSpoofModule;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.utils.network.Http;
import net.minecraft.network.NetworkState;
import net.minecraft.network.packet.c2s.handshake.ConnectionIntent;
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import spigey.asteroide.util;

import static spigey.asteroide.AsteroideAddon.gson;
import static meteordevelopment.meteorclient.MeteorClient.mc;

@Mixin(HandshakeC2SPacket.class)
public abstract class HandshakeC2SMixin {
@Shadow
public abstract NetworkState getNewNetworkState();

@Mutable
@Shadow
@Final
private String address;

@Inject(method = "<init>(ILjava/lang/String;ILnet/minecraft/network/packet/c2s/handshake/ConnectionIntent;)V", at = @At("RETURN"))
private void onHandshakeC2SPacket(int i, String string, int j, ConnectionIntent connectionIntent, CallbackInfo ci) {
BungeeSpoofModule bungeeSpoofModule = Modules.get().get(BungeeSpoofModule.class);
if (!bungeeSpoofModule.isActive()) return;
if (this.getNewNetworkState() != NetworkState.LOGIN) return;
String spoofedUUID = mc.getSession().getUuidOrNull().toString();
String spoofedIP = bungeeSpoofModule.spoofedAddress.get();
if(bungeeSpoofModule.randomize.get()) spoofedIP = util.randomNum(0,255) + "." + util.randomNum(0,255) + "." + util.randomNum(0,255) + "." + util.randomNum(0,255);

String URL = "https://api.mojang.com/users/profiles/minecraft/" + mc.getSession().getUsername();

Http.Request request = Http.get(URL);
String response = request.sendString();
if (response != null) {
JsonObject jsonObject = gson.fromJson(response, JsonObject.class);

if (jsonObject != null && jsonObject.has("id")) {
spoofedUUID = jsonObject.get("id").getAsString();
}
}
this.address += "\u0000" + spoofedIP + "\u0000" + spoofedUUID;
}
}

0 comments on commit 1a77208

Please sign in to comment.