Skip to content

Instantly share code, notes, and snippets.

@MrPowerGamerBR
Created August 14, 2016 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrPowerGamerBR/ea4da85a0436424c1acb3cdcdcc68056 to your computer and use it in GitHub Desktop.
Save MrPowerGamerBR/ea4da85a0436424c1acb3cdcdcc68056 to your computer and use it in GitHub Desktop.
@SuppressWarnings("rawtypes")
public boolean isExploit(NbtCompound root) {
// Item
if (root.containsKey("SkullOwner")) {
System.out.println("SkullOwner");
NbtCompound skullOwner = root.getCompound("SkullOwner");
if (skullOwner.containsKey("Properties")) {
NbtCompound properties = skullOwner.getCompound("Properties");
if (properties.containsKey("textures")) {
NbtList<NbtBase> textures = properties.getList("textures");
for (NbtBase texture : textures.asCollection()) {
System.out.println("1. " + texture);
if (texture instanceof NbtCompound) {
if (((NbtCompound) texture).containsKey("Signature")) {
System.out.println("Yes! Signature exists!");
NbtCompound text = (NbtCompound) texture;
System.out.println("Skull signature: " + text.getString("Signature"));
if (text.getString("Signature").equals("")) {
System.out.println("Uh oh... why this is empty? This should never happen!");
root.remove("SkullOwner");
return true;
}
}
System.out.println("2. " + texture);
if (!((NbtCompound) texture).containsKey("Signature")) {
// Check for value
if (((NbtCompound) texture).containsKey("Value")) {
// easy bypass. add to Value "==" and others symbols
if (((NbtCompound) texture).getString("Value").trim().length() > 0) {
return false;
}
}
root.remove("SkullOwner");
return true;
}
}
}
}
}
}
// Block
if (root.containsKey("Owner")) {
System.out.println("Owner");
NbtCompound skullOwner = root.getCompound("Owner");
if (skullOwner.containsKey("Properties")) {
NbtCompound properties = skullOwner.getCompound("Properties");
if (properties.containsKey("textures")) {
NbtList<NbtBase> textures = properties.getList("textures");
for (NbtBase texture : textures.asCollection()) {
System.out.println("1. " + texture);
if (texture instanceof NbtCompound) {
if (((NbtCompound) texture).containsKey("Signature")) {
System.out.println("Yes! Signature exists!");
NbtCompound text = (NbtCompound) texture;
System.out.println("Skull signature: " + text.getString("Signature"));
if (text.getString("Signature").equals("")) {
System.out.println("Uh oh... why this is empty? This should never happen!");
root.remove("SkullOwner");
return true;
}
}
if (!((NbtCompound) texture).containsKey("Signature")) {
if (((NbtCompound) texture).containsKey("Value")) {
if (((NbtCompound) texture).getString("Value").trim().length() > 0) {
return false;
}
}
root.remove("Owner");
return true;
}
}
}
}
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment