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

fix: update Quark report format parsing

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