Skip to content

Commit

Permalink
better crawl results table, added Time and Host
Browse files Browse the repository at this point in the history
  • Loading branch information
fcavallarin committed Apr 2, 2023
1 parent a02864d commit ff31277
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 19 deletions.
25 changes: 13 additions & 12 deletions lib/src/main/java/org/fcvl/domdig/burp/CrawlResultsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand All @@ -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<DomdigRequest> data = new ArrayList<>();

public int getColumnCount() {
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/main/java/org/fcvl/domdig/burp/DomdigDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public ArrayList<DomdigRequest> 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){
Expand Down
55 changes: 49 additions & 6 deletions lib/src/main/java/org/fcvl/domdig/burp/DomdigRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.net.MalformedURLException;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import org.json.JSONObject;

Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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()) {
Expand All @@ -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;
}
}
}

0 comments on commit ff31277

Please sign in to comment.