diff --git a/src/PoC/LineEntryMenu.java b/src/PoC/LineEntryMenu.java index de9a14e..a5b8983 100644 --- a/src/PoC/LineEntryMenu.java +++ b/src/PoC/LineEntryMenu.java @@ -17,7 +17,6 @@ import javax.swing.JOptionPane; import javax.swing.JPopupMenu; -import GUI.MainGUI; import burp.BurpExtender; import burp.Commons; import run.RunNucleiAction; @@ -57,7 +56,7 @@ public void actionPerformed(ActionEvent actionEvent) { if (rows.length >=50) { return; } - LineEntry selecteEntry = lineTable.getModel().getLineEntries().getValueAtIndex(rows[0]); + LineEntry selecteEntry = lineTable.getLineTabelModel().getLineEntries().getValueAtIndex(rows[0]); String path = selecteEntry.getPocFileFullPath(); Commons.editWithVSCode(path); } @@ -70,7 +69,7 @@ public void actionPerformed(ActionEvent e) { try { //JOptionPane.showMessageDialog(null,"Not found editor(code.exe idle.bat) in environment."); if (rows != null && rows.length >=0){ - LineEntry entry = lineTable.getModel().getLineEntries().getValueAtIndex(rows[0]); + LineEntry entry = lineTable.getLineTabelModel().getLineEntries().getValueAtIndex(rows[0]); String path = entry.getPocFileFullPath(); String dir = new File(path).getParent(); Commons.OpenFolder(dir); @@ -90,7 +89,7 @@ public void actionPerformed(ActionEvent actionEvent) { } List paths = new ArrayList(); for (int row:rows) { - LineEntry entry = lineTable.getModel().getLineEntries().getValueAtIndex(row); + LineEntry entry = lineTable.getLineTabelModel().getLineEntries().getValueAtIndex(row); String path = entry.getPocFileFullPath(); paths.add(path); } @@ -101,21 +100,21 @@ public void actionPerformed(ActionEvent actionEvent) { } }); - - + + /** * nuclei -u 127.0.0.1 */ JMenuItem genAllPoCCmd = new JMenuItem(new AbstractAction("Generate Command For All PoC") { @Override public void actionPerformed(ActionEvent actionEvent) { - LineEntry entry = lineTable.getModel().getLineEntries().getValueAtIndex(rows[0]); + LineEntry entry = lineTable.getLineTabelModel().getLineEntries().getValueAtIndex(rows[0]); String path = entry.getPocFileFullPath(); List targets = Commons.getLinesFromTextArea(PoCPanel.getTitleTable().getTextAreaTarget()); - + String Command = RunNucleiAction.genCommandRunAll(targets); Commons.writeToClipboard(Command.trim()); - + } }); @@ -125,27 +124,27 @@ public void actionPerformed(ActionEvent actionEvent) { JMenuItem runAllPoC = new JMenuItem(new AbstractAction("Run All PoC") { @Override public void actionPerformed(ActionEvent actionEvent) { - LineEntry entry = lineTable.getModel().getLineEntries().getValueAtIndex(rows[0]); + LineEntry entry = lineTable.getLineTabelModel().getLineEntries().getValueAtIndex(rows[0]); String path = entry.getPocFileFullPath(); List targets = Commons.getLinesFromTextArea(PoCPanel.getTitleTable().getTextAreaTarget()); String Command = RunNucleiAction.genCommandRunAll(targets); - + RunNucleiAction.run(Command); } }); - - + + /** * nuclei -u 127.0.0.1 -t CVE-2020-3580.yaml */ JMenuItem genSinglePoCCmd = new JMenuItem(new AbstractAction("Generate Command Of This PoC") { @Override public void actionPerformed(ActionEvent actionEvent) { - LineEntry entry = lineTable.getModel().getLineEntries().getValueAtIndex(rows[0]); + LineEntry entry = lineTable.getLineTabelModel().getLineEntries().getValueAtIndex(rows[0]); String path = entry.getPocFileFullPath(); List targets = Commons.getLinesFromTextArea(PoCPanel.getTitleTable().getTextAreaTarget()); - + String Command; if (entry.isWorkflow()) { Command = RunNucleiAction.genWorkflowCommand(targets, path); @@ -153,7 +152,7 @@ public void actionPerformed(ActionEvent actionEvent) { Command = RunNucleiAction.genCommand(targets, path); } Commons.writeToClipboard(Command.trim()); - + } }); @@ -163,7 +162,7 @@ public void actionPerformed(ActionEvent actionEvent) { JMenuItem runSinglePoC = new JMenuItem(new AbstractAction("Run This PoC") { @Override public void actionPerformed(ActionEvent actionEvent) { - LineEntry entry = lineTable.getModel().getLineEntries().getValueAtIndex(rows[0]); + LineEntry entry = lineTable.getLineTabelModel().getLineEntries().getValueAtIndex(rows[0]); String path = entry.getPocFileFullPath(); List targets = Commons.getLinesFromTextArea(PoCPanel.getTitleTable().getTextAreaTarget()); String Command; @@ -172,11 +171,11 @@ public void actionPerformed(ActionEvent actionEvent) { }else { Command = RunNucleiAction.genCommand(targets, path); } - + RunNucleiAction.run(Command); } }); - + /** * * nuclei -u 127.0.0.1 -tags cisco @@ -184,20 +183,20 @@ public void actionPerformed(ActionEvent actionEvent) { JMenuItem genCmdWithTags = new JMenuItem(new AbstractAction("Generate Command With Tags") { @Override public void actionPerformed(ActionEvent actionEvent) { - LineEntry entry = lineTable.getModel().getLineEntries().getValueAtIndex(rows[0]); + LineEntry entry = lineTable.getLineTabelModel().getLineEntries().getValueAtIndex(rows[0]); String tags = entry.getTags(); tags = getTags(tags); List targets = Commons.getLinesFromTextArea(PoCPanel.getTitleTable().getTextAreaTarget()); String Command = RunNucleiAction.genTagsCommand(targets, tags); Commons.writeToClipboard(Command.trim()); } - + public String getTags(String tags) { String resulttags = JOptionPane.showInputDialog("tags to use", tags).trim(); return resulttags; } }); - + /** * * nuclei -u 127.0.0.1 -tags cisco @@ -205,15 +204,15 @@ public String getTags(String tags) { JMenuItem runMultipluePoC = new JMenuItem(new AbstractAction("Run PoCs With Tags") { @Override public void actionPerformed(ActionEvent actionEvent) { - LineEntry entry = lineTable.getModel().getLineEntries().getValueAtIndex(rows[0]); + LineEntry entry = lineTable.getLineTabelModel().getLineEntries().getValueAtIndex(rows[0]); String tags = entry.getTags(); tags = getTags(tags); List targets = Commons.getLinesFromTextArea(PoCPanel.getTitleTable().getTextAreaTarget()); String Command = RunNucleiAction.genTagsCommand(targets, tags); - + RunNucleiAction.run(Command); } - + public String getTags(String tags) { String resulttags = JOptionPane.showInputDialog("tags to use", tags).trim(); return resulttags; diff --git a/src/PoC/LineTable.java b/src/PoC/LineTable.java index f7bccca..243c879 100644 --- a/src/PoC/LineTable.java +++ b/src/PoC/LineTable.java @@ -38,7 +38,6 @@ public class LineTable extends JTable * */ private static final long serialVersionUID = 1L; - private LineTableModel lineTableModel; private TableRowSorter rowSorter;//TableRowSorter vs. RowSorter PrintWriter stdout; @@ -90,7 +89,6 @@ public LineTable(LineTableModel lineTableModel) stderr = new PrintWriter(System.out, true); } - this.lineTableModel = lineTableModel; this.setFillsViewportHeight(true);//在table的空白区域显示右键菜单 //https://stackoverflow.com/questions/8903040/right-click-mouselistener-on-whole-jtable-component this.setModel(lineTableModel); @@ -103,24 +101,22 @@ public LineTable(LineTableModel lineTableModel) tableAndDetailSplitPane = tableAndDetailPanel(); } + public LineTableModel getLineTabelModel() { + return (LineTableModel)this.getModel(); + } + @Override public void changeSelection(int row, int col, boolean toggle, boolean extend) { // show the log entry for the selected row - LineEntry Entry = this.lineTableModel.getLineEntries().getValueAtIndex(super.convertRowIndexToModel(row)); + LineEntry Entry = getLineTabelModel().getLineEntries().getValueAtIndex(super.convertRowIndexToModel(row)); - this.lineTableModel.setCurrentlyDisplayedItem(Entry); + getLineTabelModel().setCurrentlyDisplayedItem(Entry); String detail = Entry.getDetail(); textAreaPoCDetail.setText(detail); super.changeSelection(row, col, toggle, extend); } - @Override - public LineTableModel getModel(){ - //return (LineTableModel) super.getModel(); - return lineTableModel; - } - public JSplitPane tableAndDetailPanel(){ JSplitPane splitPane = new JSplitPane();//table area + detail area @@ -151,7 +147,7 @@ public JSplitPane tableAndDetailPanel(){ if (config != null) { textAreaTarget.getDocument().addDocumentListener(new textAreaDocumentListener(textAreaTarget,config)); } - + JTabbedPane ResponsePanel = new JTabbedPane(); RequestDetailPanel.setRightComponent(ResponsePanel); @@ -193,7 +189,7 @@ public void tableinit(){ public void addClickSort() {//双击header头进行排序 - rowSorter = new TableRowSorter(lineTableModel);//排序和搜索 + rowSorter = new TableRowSorter(getLineTabelModel());//排序和搜索 LineTable.this.setRowSorter(rowSorter); JTableHeader header = this.getTableHeader(); @@ -213,14 +209,14 @@ public void mouseClicked(MouseEvent e) { //搜索功能函数 public void search(String Input) { History.getInstance().addRecord(Input);//记录搜索历史,单例模式 - + final RowFilter filter = new RowFilter() { @Override public boolean include(Entry entry) { //entry --- a non-null object that wraps the underlying object from the model int row = (int) entry.getIdentifier(); LineEntry line = rowSorter.getModel().getLineEntries().getValueAtIndex(row); - + //目前只处理&&(and)逻辑的表达式 if (Input.contains("&&")) { String[] searchConditions = Input.split("&&"); @@ -257,7 +253,7 @@ public void mouseClicked(MouseEvent e) { //int row = ((LineTable) e.getSource()).rowAtPoint(e.getPoint()); // 获得行位置 int col = ((LineTable) e.getSource()).columnAtPoint(e.getPoint()); // 获得列位置 - LineEntry selecteEntry = LineTable.this.lineTableModel.getLineEntries().getValueAtIndex(rows[0]); + LineEntry selecteEntry = LineTable.this.getLineTabelModel().getLineEntries().getValueAtIndex(rows[0]); if (col==0) {//双击Index 搜索CVE字段 String cve = selecteEntry.getCVE(); String url= "https://www.google.com/search?q="+cve; @@ -274,7 +270,7 @@ public void mouseClicked(MouseEvent e) { String path = selecteEntry.getPocFileFullPath(); Commons.editWithVSCode(path); }else{ - String value = LineTable.this.lineTableModel.getValueAt(rows[0],col).toString(); + String value = LineTable.this.getLineTabelModel().getValueAt(rows[0],col).toString(); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); StringSelection selection = new StringSelection(value); clipboard.setContents(selection, null);