Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRITICAL PROGUARD BUG! Very simple code not working! #381

Open
steelswing opened this issue Jan 13, 2024 · 0 comments
Open

CRITICAL PROGUARD BUG! Very simple code not working! #381

steelswing opened this issue Jan 13, 2024 · 0 comments

Comments

@steelswing
Copy link

CRITICAL PROGUARD BUG! Very simple code not working on latest proguard version, I turned off all options and the code still doesn't work.

My proguard config:

-injars 'exampleapp.jar'
-outjars 'exampleapp.jar'

-libraryjars 'C:\Program Files\Java\jdk-17\jmods\java.base.jmod'

-dontskipnonpubliclibraryclassmembers
-dontshrink
-dontoptimize
-dontobfuscate
-dontusemixedcaseclassnames
-dontpreverify
-dontnote
-dontwarn

Java code:

The elements will never be moved after obfuscation

package com.example;

import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;

public class Main {

    public static void main(String[] args) {
        String packageName = Main.class.getPackage().getName();
        String packagePath = packageName.replace('.', '/');
        try {
            Enumeration<URL> urlEnumeration = Main.class.getClassLoader().getResources(packagePath);
            while (urlEnumeration.hasMoreElements()) {
                System.out.println("has more elements! <<<");
                URL resource = urlEnumeration.nextElement();
                System.out.println("resource = " + resource);
                if (resource.getProtocol().equals("file")) {
                    System.out.println(">>> file");
                } else if (resource.getProtocol().equals("jar")) {
                    System.out.println(">>> jar");
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Possible problems:

  • Java bytecode has been changed
  • Line number has been removed
  • astore_0, astore_1 swaped in byte code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant