Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save IceCruelStuff/a4bf49c2b06fa9c883e40279a98d3294 to your computer and use it in GitHub Desktop.

Select an option

Save IceCruelStuff/a4bf49c2b06fa9c883e40279a98d3294 to your computer and use it in GitHub Desktop.

Revisions

  1. @realdirt realdirt revised this gist Oct 5, 2021. No changes.
  2. @realdirt realdirt revised this gist Oct 5, 2021. No changes.
  3. @realdirt realdirt created this gist Oct 5, 2021.
    39 changes: 39 additions & 0 deletions OhNoLunuarClient"Protection"Cracked:(.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    public static void main(String[] args) {
    File origFile = new File(System.getenv("USERPROFILE") + "\\.lunarclient\\offline\\1.8\\lunar-prod-optifine.jar");
    try {
    JarFile jarFile = new JarFile(origFile);
    JarOutputStream jarOutputStream = new JarOutputStream(new FileOutputStream("LunarClient.jar"));
    Enumeration<JarEntry> enumeration = jarFile.entries();
    while (enumeration.hasMoreElements()) {
    JarEntry jarEntry = enumeration.nextElement();

    if (jarEntry.getName().endsWith(".lclass")) {
    System.out.println("Processing " + jarEntry.getName());
    JarEntry jE = new JarEntry(jarEntry.getName().replace(".lclass", ".class"));
    jarOutputStream.putNextEntry(jE);
    } else {
    System.out.println("Copying " + jarEntry.getName());
    jarOutputStream.putNextEntry(jarEntry);
    }
    if (!jarEntry.isDirectory()) {
    jarOutputStream.write(toByteArray(jarFile.getInputStream(jarEntry)));
    }
    jarOutputStream.closeEntry();
    }
    jarOutputStream.close();
    } catch (IOException e) {
    e.printStackTrace();
    }
    }

    public static byte[] toByteArray(InputStream inputStream) throws IOException {
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();

    int nRead;
    byte[] data = new byte[4096];
    while ((nRead = inputStream.read(data, 0, data.length)) != -1) {
    buffer.write(data, 0, nRead);
    }

    return buffer.toByteArray();
    }