diff --git a/images/right-click-function.png b/images/right-click-function.png index cce5765..40f825b 100644 Binary files a/images/right-click-function.png and b/images/right-click-function.png differ diff --git a/src/main/java/caa/CaA.java b/src/main/java/caa/CaA.java index 05a74ef..2b80a52 100644 --- a/src/main/java/caa/CaA.java +++ b/src/main/java/caa/CaA.java @@ -18,7 +18,7 @@ public class CaA implements BurpExtension { @Override public void initialize(MontoyaApi api) { // 设置扩展名称 - String version = "1.0.1"; + String version = "1.0.2"; api.extension().setName(String.format("CaA (%s) - Collector and Analyzer", version)); // 加载扩展后输出的项目信息 diff --git a/src/main/java/caa/component/Databoard.java b/src/main/java/caa/component/Databoard.java index ebb58ec..4a2c5d4 100644 --- a/src/main/java/caa/component/Databoard.java +++ b/src/main/java/caa/component/Databoard.java @@ -40,6 +40,8 @@ public class Databoard extends JPanel { @Override public void actionPerformed(ActionEvent e) { String selected = tableComboBox.getSelectedItem().toString(); + dataPanel.removeAll(); + if (selected.contains("All")) { hostTextField.setEnabled(false); handleComboBoxAction(null, "*"); @@ -48,8 +50,8 @@ public void actionPerformed(ActionEvent e) { String host = hostTextField.getText(); if (host.equals("*")) { hostTextField.setText(""); - dataPanel.removeAll(); - } else { + hostTextField.setForeground(Color.BLACK); + } else if (hostTextField.getForeground().equals(Color.BLACK)) { handleComboBoxAction(null, host); } } @@ -180,8 +182,6 @@ private void handleComboBoxAction(ActionEvent e, String host) { handleComboBoxWorker.cancel(true); } - dataPanel.removeAll(); - handleComboBoxWorker = new SwingWorker() { @Override protected Object doInBackground() { diff --git a/src/main/java/caa/component/member/DatatablePanel.java b/src/main/java/caa/component/member/DatatablePanel.java index b9bb2a1..43f9107 100644 --- a/src/main/java/caa/component/member/DatatablePanel.java +++ b/src/main/java/caa/component/member/DatatablePanel.java @@ -145,16 +145,32 @@ public void changedUpdate(DocumentEvent e) { JPopupMenu popupMenu = new JPopupMenu(); JMenuItem generatorPayload = new JMenuItem("Send to Payload Generator"); JMenu copyMenu = new JMenu("Copy Payload"); - JMenuItem rawCopy = new JMenuItem("Raw"); + JMenu rawMenu = new JMenu("Raw"); + JMenuItem rawWithParamCopy = new JMenuItem("Raw with Param"); + JMenuItem rawWithCookieCopy = new JMenuItem("Raw with Cookie"); + JMenuItem rawWithHeaderCopy = new JMenuItem("Raw with Header"); JMenuItem jsonCopy = new JMenuItem("Json"); JMenuItem xmlCopy = new JMenuItem("Xml"); - copyMenu.add(rawCopy); + copyMenu.add(rawMenu); + rawMenu.add(rawWithParamCopy); + rawMenu.add(rawWithCookieCopy); + rawMenu.add(rawWithHeaderCopy); copyMenu.add(jsonCopy); copyMenu.add(xmlCopy); - rawCopy.addActionListener(e -> { + rawWithParamCopy.addActionListener(e -> { String payload = getSelectedDataAtTable(dataTable); - setClipboardContents(generator.generateRawParam(payload)); + setClipboardContents(generator.generateRawParam(payload, "=", "&")); + }); + + rawWithCookieCopy.addActionListener(e -> { + String payload = getSelectedDataAtTable(dataTable); + setClipboardContents(generator.generateRawParam(payload, "=", "; ")); + }); + + rawWithHeaderCopy.addActionListener(e -> { + String payload = getSelectedDataAtTable(dataTable); + setClipboardContents(generator.generateRawParam(payload, ": ","\r\n")); }); jsonCopy.addActionListener(e -> { diff --git a/src/main/java/caa/instances/Generator.java b/src/main/java/caa/instances/Generator.java index 4e09f99..bd215c3 100644 --- a/src/main/java/caa/instances/Generator.java +++ b/src/main/java/caa/instances/Generator.java @@ -243,21 +243,21 @@ private String generateRandomString(int length, int strFlag) { return this.api.utilities().randomUtils().randomString(length, strFlag == 1 ? RandomUtils.CharacterSet.ASCII_LETTERS : RandomUtils.CharacterSet.DIGITS); } - public String generateRawParam(String payload) { + public String generateRawParam(String payload, String formatChar, String delimiter) { List paramValueList = new ArrayList<>(); - String formatString = "{0}={1}"; + String formatString = "{0}{1}{2}"; if (payload.contains("=")) { for (String paramValue : payload.split("\r\n")) { String param = paramValue.split("=")[0]; String value = httpUtils.decodeParameter(paramValue.split("=")[1]); - paramValueList.add(MessageFormat.format(formatString, param, value)); + paramValueList.add(MessageFormat.format(formatString, param, formatChar, value)); } } else { for (String param : payload.split("\r\n")) { - paramValueList.add(MessageFormat.format(formatString, param, generateRandomString(6, 1))); + paramValueList.add(MessageFormat.format(formatString, param, formatChar, generateRandomString(6, 1))); } } - return String.join("&", paramValueList); + return String.join(delimiter, paramValueList); } public String generateJsonParam(String payload) {