未验证 提交 43944681 编写于 作者: S Skylot

fix: update Quark report format parsing

上级 94010866
...@@ -15,7 +15,7 @@ public class QuarkReportData { ...@@ -15,7 +15,7 @@ public class QuarkReportData {
public List<String> permissions; public List<String> permissions;
List<Method> native_api; List<Method> native_api;
List<Method> combination; List<String[]> combination;
List<Map<String, InvokePlace>> register; List<Map<String, InvokePlace>> register;
} }
......
...@@ -56,21 +56,24 @@ public class QuarkReportNode extends JNode { ...@@ -56,21 +56,24 @@ public class QuarkReportNode extends JNode {
@Override @Override
public ContentPanel getContentPanel(TabbedPane tabbedPane) { public ContentPanel getContentPanel(TabbedPane tabbedPane) {
QuarkReportData data;
try { try {
data = GSON.fromJson(Files.newBufferedReader(apkFile), QuarkReportData.class); QuarkReportData data = GSON.fromJson(Files.newBufferedReader(apkFile), QuarkReportData.class);
return new QuarkReportPanel(tabbedPane, this, data);
} catch (Exception e) { } catch (Exception e) {
LOG.error("Quark report parse error", e); LOG.error("Quark report parse error", e);
StringEscapeUtils.Builder builder = StringEscapeUtils.builder(StringEscapeUtils.ESCAPE_HTML4); StringEscapeUtils.Builder builder = StringEscapeUtils.builder(StringEscapeUtils.ESCAPE_HTML4);
builder.append("<h2>"); builder.append("<h2>");
builder.escape("Quark analysis failed!"); builder.escape("Quark analysis failed!");
builder.append("</h2><pre>"); builder.append("</h2>");
builder.append("<h3>");
builder.append("Error: ").escape(e.getMessage());
builder.append("</h3>");
builder.append("<pre>");
builder.escape(ExceptionUtils.getStackTrace(e)); builder.escape(ExceptionUtils.getStackTrace(e));
builder.append("</pre>"); builder.append("</pre>");
errorContent = builder.toString(); errorContent = builder.toString();
return new HtmlPanel(tabbedPane, this); return new HtmlPanel(tabbedPane, this);
} }
return new QuarkReportPanel(tabbedPane, this, data);
} }
@Override @Override
......
...@@ -8,6 +8,7 @@ import java.awt.event.MouseEvent; ...@@ -8,6 +8,7 @@ import java.awt.event.MouseEvent;
import java.util.Comparator; import java.util.Comparator;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.IdentityHashMap; import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
...@@ -238,20 +239,25 @@ public class QuarkReportPanel extends ContentPanel { ...@@ -238,20 +239,25 @@ public class QuarkReportPanel extends ContentPanel {
if (Utils.notEmpty(crime.permissions)) { if (Utils.notEmpty(crime.permissions)) {
add(new TextTreeNode("Permissions: " + Strings.join(", ", crime.permissions))); add(new TextTreeNode("Permissions: " + Strings.join(", ", crime.permissions)));
} }
if (Utils.notEmpty(crime.combination)) { if (Utils.notEmpty(crime.native_api)) {
TextTreeNode node = new TextTreeNode("Native API"); TextTreeNode node = new TextTreeNode("Native API");
for (QuarkReportData.Method method : crime.combination) { for (QuarkReportData.Method method : crime.native_api) {
node.add(new TextTreeNode(method.toString())); node.add(new TextTreeNode(method.toString()));
} }
add(node); add(node);
} else { }
if (Utils.notEmpty(crime.native_api)) { List<String[]> combination = crime.combination;
TextTreeNode node = new TextTreeNode("Native API"); if (Utils.notEmpty(combination)) {
for (QuarkReportData.Method method : crime.native_api) { TextTreeNode node = new TextTreeNode("Combination");
node.add(new TextTreeNode(method.toString())); int size = combination.size();
for (int i = 0; i < size; i++) {
TextTreeNode set = new TextTreeNode("Set " + i);
for (String mth : combination.get(i)) {
set.add(resolveMethod(mth));
} }
add(node); node.add(set);
} }
add(node);
} }
if (Utils.notEmpty(crime.register)) { if (Utils.notEmpty(crime.register)) {
TextTreeNode node = new TextTreeNode("Invocations"); TextTreeNode node = new TextTreeNode("Invocations");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册