diff --git a/src/main/java/burp/vaycore/common/utils/ClassUtils.java b/src/main/java/burp/vaycore/common/utils/ClassUtils.java index ec299cd..f1f8f9e 100644 --- a/src/main/java/burp/vaycore/common/utils/ClassUtils.java +++ b/src/main/java/burp/vaycore/common/utils/ClassUtils.java @@ -33,13 +33,21 @@ public static Object getValueByFieldId(Object obj, int fieldId) { return getFieldStringValue(obj, field); } + public static String getNameByFieldId(Class clz, int fieldId) { + Field[] fields = clz.getDeclaredFields(); + if (fieldId >= fields.length) { + return null; + } + Field field = fields[fieldId]; + return field.getName(); + } + public static Class getTypeByFieldId(Class clz, int fieldId) { Field[] fields = clz.getDeclaredFields(); if (fieldId >= fields.length) { return String.class; } Field field = fields[fieldId]; - // 返回 Integer 类型,否则无法正确排序 if (field.getType() == int.class) { return Integer.class; } else if (field.getType() == boolean.class) { diff --git a/src/main/java/burp/vaycore/onescan/bean/TaskData.java b/src/main/java/burp/vaycore/onescan/bean/TaskData.java index 89e6f0f..1d56126 100644 --- a/src/main/java/burp/vaycore/onescan/bean/TaskData.java +++ b/src/main/java/burp/vaycore/onescan/bean/TaskData.java @@ -18,9 +18,9 @@ public class TaskData { private int length; private String fingerprint; private String comment; - // 辅助的数据 - private Object reqResp; private String highlight; + // 请求响应数据 + private Object reqResp; public int getId() { return id; @@ -110,14 +110,6 @@ public void setComment(String comment) { this.comment = comment; } - public Object getReqResp() { - return reqResp; - } - - public void setReqResp(Object reqResp) { - this.reqResp = reqResp; - } - public String getHighlight() { return highlight; } @@ -125,4 +117,12 @@ public String getHighlight() { public void setHighlight(String highlight) { this.highlight = highlight; } + + public Object getReqResp() { + return reqResp; + } + + public void setReqResp(Object reqResp) { + this.reqResp = reqResp; + } } diff --git a/src/main/java/burp/vaycore/onescan/ui/widget/TaskTable.java b/src/main/java/burp/vaycore/onescan/ui/widget/TaskTable.java index bab12b9..adb2deb 100644 --- a/src/main/java/burp/vaycore/onescan/ui/widget/TaskTable.java +++ b/src/main/java/burp/vaycore/onescan/ui/widget/TaskTable.java @@ -207,8 +207,9 @@ private void initColumnWidth() { setColumnWidth(6, 125); setColumnWidth(7, 50); setColumnWidth(8, 100); - setColumnWidth(9, 300); + setColumnWidth(9, 200); setColumnWidth(10, 200); + setColumnWidth(11, 85); } private void setColumnWidth(int columnIndex, int width) { @@ -285,6 +286,34 @@ private Color findColorByName(String colorName) { return null; } + private static int findColorLevelByName(String colorName) { + if (StringUtils.isEmpty(colorName)) { + return 0; + } + switch (colorName) { + case "red": + return 9; + case "orange": + return 8; + case "yellow": + return 7; + case "green": + return 6; + case "cyan": + return 5; + case "blue": + return 4; + case "pink": + return 3; + case "magenta": + return 2; + case "gray": + return 1; + default: + return 0; + } + } + private Color darkerColor(Color color) { return new Color(Math.max((int) (color.getRed() * 0.85D), 0), Math.max((int) (color.getGreen() * 0.85D), 0), @@ -368,7 +397,7 @@ public interface OnTaskTableEventListener { public static class TaskTableModel extends AbstractTableModel { public static final String[] COLUMN_NAMES = new String[]{ - "#", "From", "Method", "Host", "Url", "Title", "IP", "Status", "Length", "Fingerprint", "Comment"}; + "#", "From", "Method", "Host", "Url", "Title", "IP", "Status", "Length", "Fingerprint", "Comment", "Color-level"}; private final ArrayList mData; public TaskTableModel() { @@ -408,6 +437,15 @@ public int getColumnCount() { @Override public Object getValueAt(int rowIndex, int columnIndex) { TaskData data = mData.get(rowIndex); + String fieldName = ClassUtils.getNameByFieldId(TaskData.class, columnIndex); + if ("highlight".equals(fieldName)) { + int level = findColorLevelByName(data.getHighlight()); + String levelStr = String.valueOf(level == 0 ? "" : level); + if (StringUtils.isNotEmpty(levelStr)) { + return String.format("%s(%s)", levelStr, data.getHighlight()); + } + return levelStr; + } return ClassUtils.getValueByFieldId(data, columnIndex); }