diff --git a/lib/src/main/java/org/fcvl/domdig/burp/CrawlResultsPanel.java b/lib/src/main/java/org/fcvl/domdig/burp/CrawlResultsPanel.java index 37f521a..416dfed 100644 --- a/lib/src/main/java/org/fcvl/domdig/burp/CrawlResultsPanel.java +++ b/lib/src/main/java/org/fcvl/domdig/burp/CrawlResultsPanel.java @@ -242,7 +242,7 @@ public void mouseExited(MouseEvent e) { } }); - setColWidths(requestsTable, new int[]{50, 50, 70, 300, 200, 200}); + setColWidths(requestsTable, new int[]{20, 30, 200, 30, 500, 250, 150}); setTableSorter(requestsTable); requestsScrollPane.setViewportView(requestsTable); @@ -251,16 +251,16 @@ public void mouseExited(MouseEvent e) { splitPane.setRightComponent(requestDetailsPanel); requestDetailsPanel.setLayout(new BorderLayout(0, 0)); - JPanel panel_2 = new JPanel(); - FlowLayout flowLayout = (FlowLayout) panel_2.getLayout(); - flowLayout.setAlignment(FlowLayout.LEFT); - requestDetailsPanel.add(panel_2, BorderLayout.NORTH); + JPanel triggerPanel = new JPanel(); + FlowLayout fl_triggerPanel = (FlowLayout) triggerPanel.getLayout(); + fl_triggerPanel.setAlignment(FlowLayout.LEFT); + requestDetailsPanel.add(triggerPanel, BorderLayout.NORTH); requestTriggerLabel = new JLabel(""); - panel_2.add(requestTriggerLabel); + triggerPanel.add(requestTriggerLabel); elementTextField = new JTextField(); - panel_2.add(elementTextField); + triggerPanel.add(elementTextField); elementTextField.setColumns(70); if(burpApi != null) { @@ -280,8 +280,8 @@ public void mouseExited(MouseEvent e) { class RequestsTableModel extends AbstractTableModel { - private String[] columnNames = {"#", "Type", "Method", "URL", "Data", "Trigger"}; - private Class colClasses[] = {Integer.class, String.class, String.class, String.class, String.class, String.class}; + private String[] columnNames = {"#", "Type", "Host", "Method", "URL", "Trigger", "Time"}; + private Class colClasses[] = {Integer.class, String.class, String.class, String.class, String.class, String.class, String.class}; public ArrayList data = new ArrayList<>(); public int getColumnCount() { @@ -303,14 +303,15 @@ public Object getValueAt(int row, int col) { switch(col){ case 0: return req.id; case 1: return req.type; - case 2: return req.method; - case 3: return req.url; - case 4: return req.data; + case 2: return req.getProtocol() + "://" + req.getHost(); + case 3: return req.method; + case 4: return req.getRelativeURL(); case 5: if(req.trigger != null) { return "$(" + req.triggerElement + ")." + req.triggerEvent + "()"; } return ""; + case 6: return req.getTime(); } return null; } diff --git a/lib/src/main/java/org/fcvl/domdig/burp/DomdigDB.java b/lib/src/main/java/org/fcvl/domdig/burp/DomdigDB.java index 685dbbe..e349208 100644 --- a/lib/src/main/java/org/fcvl/domdig/burp/DomdigDB.java +++ b/lib/src/main/java/org/fcvl/domdig/burp/DomdigDB.java @@ -54,7 +54,7 @@ public ArrayList getRequests(int lastID){ ResultSet rs = statement.executeQuery(); while(rs.next()){ - reqList.add(new DomdigRequest(rs.getInt("id"), rs.getString("type"), rs.getString("method"), rs.getString("url"), rs.getString("headers"), rs.getString("data"), rs.getString("trigger"))); + reqList.add(new DomdigRequest(rs.getInt("id"), rs.getString("type"), rs.getString("method"), rs.getString("url"), rs.getString("headers"), rs.getString("data"), rs.getString("trigger"), rs.getString("created_at"))); } return reqList; } catch(SQLException e){ diff --git a/lib/src/main/java/org/fcvl/domdig/burp/DomdigRequest.java b/lib/src/main/java/org/fcvl/domdig/burp/DomdigRequest.java index 07e2d74..253d8b6 100644 --- a/lib/src/main/java/org/fcvl/domdig/burp/DomdigRequest.java +++ b/lib/src/main/java/org/fcvl/domdig/burp/DomdigRequest.java @@ -2,6 +2,8 @@ import java.net.MalformedURLException; import java.net.URL; +import java.text.ParseException; +import java.text.SimpleDateFormat; import org.json.JSONObject; @@ -15,8 +17,10 @@ public class DomdigRequest { public String trigger; public String triggerEvent = ""; public String triggerElement = ""; + public String createdAt; + private URL parsedURL; - public DomdigRequest(int id, String type, String method, String url, String headers, String data, String trigger) { + public DomdigRequest(int id, String type, String method, String url, String headers, String data, String trigger, String createdAt) { super(); this.id = id; this.type = type; @@ -25,6 +29,12 @@ public DomdigRequest(int id, String type, String method, String url, String hea this.headers = headers; this.data = data; this.trigger = trigger.equals("") ? null : trigger; + this.createdAt = createdAt; + try { + this.parsedURL = new URL(this.url); + } catch (MalformedURLException e1) { + this.parsedURL = null; + } try { JSONObject json = new JSONObject(trigger); @@ -36,10 +46,12 @@ public DomdigRequest(int id, String type, String method, String url, String hea } public String getRaw() throws MalformedURLException{ - URL url = new URL(this.url); - String path = url.getFile(); - String raw = this.method.toUpperCase() + " " + (path.equals("") ? "/" : path) + " HTTP/1.1\r\n"; - raw += "host: " + url.getHost() + (url.getPort() != -1 ? ":" + url.getPort() : "") + "\r\n"; + if(parsedURL == null) { + throw new MalformedURLException(); + } + int port = parsedURL.getPort(); + String raw = this.method.toUpperCase() + " " + getRelativeURL() + " HTTP/1.1\r\n"; + raw += "host: " + parsedURL.getHost() + (port != -1 ? ":" + port : "") + "\r\n"; if(headers != null && !headers.equals("")) { JSONObject json = new JSONObject(headers); for(String k : json.keySet()) { @@ -51,7 +63,38 @@ public String getRaw() throws MalformedURLException{ raw += data; } return raw; - } + public String getHost(){ + if(parsedURL == null) { + return ""; + } + + return parsedURL.getHost(); + } + + public String getRelativeURL(){ + if(parsedURL == null) { + return url; + } + String path = parsedURL.getFile(); + return path.equals("") ? "/" : path; + } + + public String getProtocol(){ + if(parsedURL == null) { + return url; + } + return parsedURL.getProtocol(); + } + + public String getTime() { + SimpleDateFormat inFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat outFmt = new SimpleDateFormat("HH:mm:ss MM/dd/yyyy"); + try { + return outFmt.format(inFmt.parse(createdAt)); + } catch (ParseException e) { + return null; + } + } }