Skip to content

Instantly share code, notes, and snippets.

@MrPowerGamerBR
Created August 23, 2016 18:14
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/a8528e94360721e29773617c63648bf3 to your computer and use it in GitHub Desktop.
Save MrPowerGamerBR/a8528e94360721e29773617c63648bf3 to your computer and use it in GitHub Desktop.
@SuppressWarnings("rawtypes")
public boolean isExploit(NbtCompound root) {
// Item
if (root.containsKey("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()) {
if (texture instanceof NbtCompound) {
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;
}
if (((NbtCompound) texture).containsKey("Signature")) {
NbtCompound text = (NbtCompound) texture;
if (text.getString("Signature").equals("")) {
root.remove("SkullOwner");
return true;
}
}
if (((NbtCompound) texture).containsKey("Value")) {
NbtCompound text = (NbtCompound) texture;
if (text.getString("Value").equals("")) {
root.remove("SkullOwner");
return true;
}
}
}
}
}
}
}
// Block
if (root.containsKey("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()) {
if (texture instanceof NbtCompound) {
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;
}
if (((NbtCompound) texture).containsKey("Signature")) {
NbtCompound text = (NbtCompound) texture;
if (text.getString("Signature").equals("")) {
root.remove("Owner");
return true;
}
}
if (((NbtCompound) texture).containsKey("Value")) {
NbtCompound text = (NbtCompound) texture;
if (text.getString("Value").equals("")) {
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