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

Index.html page is empty #60

Open
girish3 opened this issue Sep 5, 2019 · 6 comments
Open

Index.html page is empty #60

girish3 opened this issue Sep 5, 2019 · 6 comments

Comments

@girish3
Copy link

girish3 commented Sep 5, 2019

I got the following terminal output after running the command,

Baksmaling classes.dex...
Baksmaling classes2.dex...
Baksmaling classes3.dex...
Baksmaling classes4.dex...
Analyzing dependencies...
Success! Now open index.html in your browser.

But after opening the index.html file, I can see the setting view on top right but the page is empty.

@alexzaitsev
Copy link
Owner

Hello @girish3
Have you modified filters/default.json? If yes - could you provide it?
How do you run the script?

@kuzdu
Copy link

kuzdu commented Sep 13, 2019

I do not think that this an issue. But I ran into the same trap. The package name must not be equal the bundle identifier. I do not know why, but I entered my bundle identifier to the filters/default.json and yeah... then the index.html is empty. Fail to me and my reading skills .. 🤷🏻‍♂️

@Heavylama
Copy link

There is a bug when running on Windows that could explain such behaviour.

A path filter is generated using system path delimiter. This filter is then used both for filtering folders in smali output directory (good) and for parsing found class paths when processing individual smali files (bad).

In the decompiled smali code "/" package delimiter is used thus on a Windows machine filtering out everything since the filter is using "\" system path delimiter.

Modifying the code to use separate filters for system/smali paths fixes the problem. I can imagine this bug does not appear on Linux since the separator is the same.

@ArmanIzad
Copy link

Having the same issue. The output generated seems to be OK, just that the dependencies is empty.

There is a bug when running on Windows that could explain such behaviour.

A path filter is generated using system path delimiter. This filter is then used both for filtering folders in smali output directory (good) and for parsing found class paths when processing individual smali files (bad).

In the decompiled smali code "/" package delimiter is used thus on a Windows machine filtering out everything since the filter is using "" system path delimiter.

Modifying the code to use separate filters for system/smali paths fixes the problem. I can imagine this bug does not appear on Linux since the separator is the same.

Where should I modify this? Any clue?

@kustraslawomir
Copy link

kustraslawomir commented Dec 13, 2019

I run into same issue.

filters.json where "a.b.c" is my applicationId and package:
{ "package-name": "a.b.c", "show-inner-classes": false, "ignored-classes": [".*Dagger.*", ".*Inject.*", ".*ViewBinding$", ".*Factory$", ".*_.*", "^R$", "^R\\$.*"] }

command:
run.bat C:\graph\application.apk C:\graph\filters.json

result:
Baksmaling classes.dex... Analyzing dependencies... Success! Now open gui/index.html in your browser.

analyzed.js:
var dependencies = {links:[ ]};

@kustraslawomir
Copy link

kustraslawomir commented Dec 13, 2019

Following @Heavylama comment I fixed it but changing your code from:

Main.java:

 Filter<String> pathFilter = filterProvider.makePathFilter();
        Filter<String> classFilter = filterProvider.makeClassFilter();
        SmaliAnalyzer analyzer = new SmaliAnalyzer(arguments, filters, 
                                                   pathFilter, classFilter);

to:

Filter<String> smaliPathFilter = filterProvider.makeSmaliPathFilter();
        Filter<String> classFilter = filterProvider.makeClassFilter();
        SmaliAnalyzer analyzer = new SmaliAnalyzer(arguments, filters, smaliPathFilter, classFilter);

where makeSmaliPathFilter() is:

public Filter<String> makeSmaliPathFilter() {
        String replacement = Matcher.quoteReplacement(File.separator);
        replacement = Matcher.quoteReplacement(replacement);
        String packageNameAsPath = inputFilters.getPackageName().replaceAll("/", replacement);
        String packageNameRegex = ".*" + packageNameAsPath + ".*";
        RegexFilter filter = new RegexFilter(packageNameRegex);

        return filter;
    }

Now after recompile I received correct dependencies graph.

@alexzaitsev Windows. tl;dr i replaced \. with / for smali path filter.

LaurieScheepers added a commit to LaurieScheepers/apk-dependency-graph that referenced this issue Sep 6, 2020
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

6 participants