Skip to content

Commit

Permalink
Merge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
k4ch0w committed Apr 14, 2017
2 parents 2eb32ff + e408602 commit fe7d423
Show file tree
Hide file tree
Showing 8 changed files with 292 additions and 136 deletions.
18 changes: 0 additions & 18 deletions src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.k4ch0w.pwnback.PwnBackGUI;
import com.k4ch0w.pwnback.PwnBackMediator;
import com.k4ch0w.pwnback.PwnBackSettings;

import javax.swing.*;
import java.awt.*;
Expand All @@ -11,33 +10,16 @@ public class BurpExtender implements IBurpExtender, ITab {
private IBurpExtenderCallbacks callbacks;
private IExtensionHelpers helpers;
private PwnBackGUI panel;
// private DocumentFrame d;

@Override
public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks) {
this.callbacks = callbacks;
helpers = callbacks.getHelpers();
callbacks.setExtensionName("PwnBack");
SwingUtilities.invokeLater(() -> {
PwnBackSettings settings = new PwnBackSettings(); //Singleton Initialization
PwnBackMediator mediator = new PwnBackMediator();
panel = mediator.getGui();
callbacks.customizeUiComponent(panel);

/*
try {
ArrayList<String> temp = new ArrayList<String>();
temp.add("fuckit");
d = new DocumentFrame(temp, "<html>Ain't no way I'mma fail </html>");
} catch (IOException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
}
callbacks.customizeUiComponent(d);
*/
callbacks.addSuiteTab(BurpExtender.this);
});
}
Expand Down
90 changes: 90 additions & 0 deletions src/com.k4ch0w.pwnback/PwnBackDocumentFrame.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Created by JFormDesigner on Mon Apr 10 14:57:16 PDT 2017
*/

package com.k4ch0w.pwnback;

import net.miginfocom.swing.MigLayout;
import org.xml.sax.SAXException;

import javax.swing.*;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.io.IOException;
import java.util.ArrayList;

/**
* @author Paul Ganea
*/
class PwnBackDocumentFrame extends JFrame {
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner commercial license
private JScrollPane scrollPane1;
private JList<PwnBackDocument> list1;
private JPanel panel1;
private JScrollPane scrollPane2;
private JTextPane textPane1;

PwnBackDocumentFrame(ArrayList<PwnBackDocument> docs) throws IOException, SAXException {
initComponents();
DefaultListModel<PwnBackDocument> listModel;
listModel = new DefaultListModel<>();
for (PwnBackDocument doc : docs) {
listModel.addElement(doc);
}
list1.setModel(listModel);
ListSelectionListener listSelectionListener = listSelectionEvent -> {
if (!listSelectionEvent.getValueIsAdjusting()) {
textPane1.setText(listModel.get(list1.getSelectedIndex()).getDocument());
}
};
list1.addListSelectionListener(listSelectionListener);
textPane1.setText(docs.get(0).getDocument());
textPane1.setEditable(false);
}

private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner non-commercial license
scrollPane1 = new JScrollPane();
list1 = new JList<>();
panel1 = new JPanel();
scrollPane2 = new JScrollPane();
textPane1 = new JTextPane();

//======== this ========
setMinimumSize(new Dimension(1000, 700));
Container contentPane = getContentPane();
contentPane.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
"[fill]" +
"[grow]",
// rows
"[grow,fill]"));

//======== scrollPane1 ========
{
scrollPane1.setMinimumSize(new Dimension(250, 148));
scrollPane1.setPreferredSize(new Dimension(250, 148));
scrollPane1.setViewportView(list1);
}
contentPane.add(scrollPane1, "cell 0 0");

//======== panel1 ========
{
panel1.setLayout(new GridLayout());

//======== scrollPane2 ========
{
scrollPane2.setViewportView(textPane1);
}
panel1.add(scrollPane2);
}
contentPane.add(panel1, "cell 1 0,growx");
pack();
setLocationRelativeTo(getOwner());
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - End of variables declaration //GEN-END:variables
}
42 changes: 42 additions & 0 deletions src/com.k4ch0w.pwnback/PwnBackDocumentFrame.jfd
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
JFDML JFormDesigner: "6.0.0.0.84" Java: "1.8.0_112-release" encoding: "UTF-8"

new FormModel {
contentType: "form/swing"
root: new FormRoot {
add( new FormWindow( "javax.swing.JFrame", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[fill][grow]"
"$rowConstraints": "[grow,fill]"
} ) {
name: "this"
"minimumSize": new java.awt.Dimension( 1000, 700 )
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane1"
"minimumSize": new java.awt.Dimension( 250, 148 )
"preferredSize": new java.awt.Dimension( 250, 148 )
add( new FormComponent( "javax.swing.JList" ) {
name: "list1"
auxiliary() {
"JavaCodeGenerator.typeParameters": "String"
}
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.GridLayout ) ) {
name: "panel1"
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane2"
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane1"
} )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0,growx"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 600, 400 )
} )
}
}
40 changes: 20 additions & 20 deletions src/com.k4ch0w.pwnback/PwnBackMediator.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,29 @@

//Wayback documentation located at https://github.com/internetarchive/wayback/tree/master/wayback-cdx-server
public class PwnBackMediator {
private static final String waybackString = "http://web.archive.org/cdx/search/cdx?url=%s&limit=%s&from=%s&to=%s" +
"&showResumeKey=True&collapse=digest";//Remove duplicates based on page digest
public final ReentrantLock treeModelLock = new ReentrantLock();
public final ReentrantLock logTableLock = new ReentrantLock();
private final String waybackString = "http://web.archive.org/cdx/search/cdx?url=%s&limit=%s&from=%s&to=%s" +
"&showResumeKey=True&collapse=digest";//Remove duplicates based on page digest
private final int recordLimit;
private final String yearStart;
private final String yearEnd;
private final int recordLimit = 1000;
private final List<PwnBackTableEntry> tableEntries = new ArrayList<>();
private final PwnBackGUI gui = new PwnBackGUI(this);
private final BlockingQueue<PwnBackDocument> documentsToParse = new ArrayBlockingQueue<>(1000);
private final BlockingQueue<PwnBackURL> urlsToRequest = new ArrayBlockingQueue<>(10000);
private ExecutorService docParsers;
private ExecutorService webDrivers;

public PwnBackMediator() {
recordLimit = 1000;
yearStart = Integer.toString(PwnBackSettings.startYear);
yearEnd = Integer.toString(PwnBackSettings.endYear);
}
private String yearStart = Integer.toString(PwnBackSettings.startYear);
private String yearEnd = Integer.toString(PwnBackSettings.endYear);

void start() {
LOG_INFO("Marty McFly: Wait a minute. Wait a minute, Doc. Ah..." +
" Are you telling me that you built a time machine... out of a DeLorean?");
LOG_INFO("Dr. Emmett Brown: The way I see it, if you're gonna build a time machine into a car," +
" why not do it with some *style?*");

yearStart = Integer.toString(PwnBackSettings.endYear);
yearEnd = Integer.toString(PwnBackSettings.endYear);
docParsers = Executors.newFixedThreadPool(PwnBackSettings.numofHttpResponseParsers);
webDrivers = Executors.newFixedThreadPool(PwnBackSettings.numOfJSWebDrivers);
for (int i = 0; i < PwnBackSettings.numofHttpResponseParsers; i++) {
Expand Down Expand Up @@ -89,8 +87,6 @@ private void LOG(PwnBackTableEntry entry) {
} finally {
logTableLock.unlock();
}


}

void addPath(PwnBackNode entry) {
Expand All @@ -102,16 +98,20 @@ void addPath(PwnBackNode entry) {
}
}

private String generatePath(TreeModel model, Object object, String indent) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) object;
if (node.getParent() != null && node.getParent().equals(model.getRoot())) {
indent = "/"; //root node case otherwise will be // instead of /
private boolean checkIfRootNode(TreeModel model, DefaultMutableTreeNode node) {
return node.getParent() != null && node.getParent().equals(model.getRoot());
}

private String generatePath(TreeModel model, Object currentNode, String path) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) currentNode;
if (checkIfRootNode(model, node)) {
path = "/";
}
StringBuilder myRow = new StringBuilder(indent + object + System.getProperty("line.separator"));
for (int i = 0; i < model.getChildCount(object); i++) {
myRow.append(generatePath(model, model.getChild(object, i), indent + object + "/"));
StringBuilder pathBuilder = new StringBuilder(path + currentNode + System.getProperty("line.separator"));
for (int i = 0; i < model.getChildCount(currentNode); i++) {
pathBuilder.append(generatePath(model, model.getChild(currentNode, i), path + currentNode + "/"));
}
return myRow.toString();
return pathBuilder.toString();
}

boolean exportPathsToFile(TreeModel tree, Path filename) {
Expand Down
4 changes: 2 additions & 2 deletions src/com.k4ch0w.pwnback/PwnBackNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public class PwnBackNode {
/*
Root init only
*/
PwnBackNode(String path) {
this.path = path;
PwnBackNode(String rootPath) {
this.path = rootPath;
}

PwnBackNode(String path, PwnBackDocument doc) {
Expand Down
Loading

0 comments on commit fe7d423

Please sign in to comment.