Open girish3 opened 5 years ago
Hello @girish3
Have you modified filters/default.json
? If yes - could you provide it?
How do you run the script?
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 .. 🤷🏻♂️
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.
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?
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:[ ]};
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.
I got the following terminal output after running the command,
But after opening the index.html file, I can see the setting view on top right but the page is empty.