All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sittinglittleduck.DirBuster.gui.JDialogViewResponce Maven / Gradle / Ivy

Go to download

DirBuster is a multi threaded java application designed to brute force directories and files names on web/application servers. Often is the case now of what looks like a web server in a state of default installation is actually not, and has pages and applications hidden within. DirBuster attempts to find these.

The newest version!
/*
 * JDialogViewResponce.java
 *
 * Created on 30 June 2006, 21:40
 *
 * Copyright 2007 James Fisher
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 */

package com.sittinglittleduck.DirBuster.gui;

import com.sittinglittleduck.DirBuster.BaseCase;
import com.sittinglittleduck.DirBuster.Config;
import com.sittinglittleduck.DirBuster.diff.Diff;
import com.sittinglittleduck.DirBuster.diff.DiffPrint;

import edu.stanford.ejalbert.BrowserLauncher;
import edu.stanford.ejalbert.exception.BrowserLaunchingInitializingException;
import edu.stanford.ejalbert.exception.UnsupportedOperatingSystemException;

/**
 *
 * @author  James
 */
public class JDialogViewResponce extends javax.swing.JDialog
{
    private BaseCase baseCaseObj;
    
    /** Creates new form JDialogViewResponce */
    public JDialogViewResponce(java.awt.Frame parent, boolean modal, String Responce, String Request, String baseCase, String rawResponce, BaseCase baseCaseObj)
    {
        super(parent, modal);
        initComponents();
        this.setTitle("DirBuster " + Config.version + " View Response");
        this.jTextAreaResponce.setText(rawResponce);
        jTextAreaResponce.setCaretPosition(0);
        this.baseCaseObj = baseCaseObj;
        //System.out.println("View Dialog");
        //System.out.println(Responce);
        this.jLabelURL.setText("Responce for " + Request);
        if(baseCase == null)
        {
           jTabbedPane1.setEnabledAt(2, false);
           jTabbedPane1.setEnabledAt(3, false);
        }
        else
        {
            jTabbedPane1.setEnabledAt(2, true);
            jTabbedPane1.setEnabledAt(3, true);
            jTextAreaResponceCompear.setText(Responce);
            jTextAreaResponceCompear.setCaretPosition(0);
            jTextAreaBaseCompear.setText(baseCase);
            jTextAreaBaseCompear.setCaretPosition(0);
            
            
            
            String temp1a[] = baseCase.split("\r?\n");
            String temp2a[] = Responce.split("\r?\n");
            
            Diff d = new Diff(temp1a, temp2a);
            
            Diff.change script = d.diff_2(false);
            DiffPrint.Base p;
            //p = new DiffPrint.ContextPrint(temp1a, temp2a);
            //p = new DiffPrint.NormalPrint(temp1a, temp2a);
            //p = new DiffPrint.EdPrint(temp1a, temp2a);
            p = new DiffPrint.UnifiedPrint(temp1a, temp2a);
            //p.print_header("temp1","temp2");
            jTextPaneDiff.setText(p.print_script(script));
            jTextPaneDiff.setCaretPosition(0);
        }
        if(baseCaseObj != null)
        {
            jLabelBaseCaseURL.setText(baseCaseObj.getBaseCaseRequestURL().toString());
            jLabelHTTPResponceCode.setText(String.valueOf(baseCaseObj.getFailCode()));
        }
        
        //this.jScrollPane1.setViewport(null);
        
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // //GEN-BEGIN:initComponents
    private void initComponents() {

        jLabelURL = new javax.swing.JLabel();
        jButtonClose = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextAreaResponce = new javax.swing.JTextArea();
        jPanelBaseCase = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabelBaseCaseURL = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabelHTTPResponceCode = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jSplitPane1 = new javax.swing.JSplitPane();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextAreaResponceCompear = new javax.swing.JTextArea();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextAreaBaseCompear = new javax.swing.JTextArea();
        jScrollPaneDiff = new javax.swing.JScrollPane();
        jTextPaneDiff = new javax.swing.JTextPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabelURL.setText("jLabel1");

        jButtonClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/sittinglittleduck/DirBuster/gui/icons/fileclose.png"))); // NOI18N
        jButtonClose.setText("Close");
        jButtonClose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCloseActionPerformed(evt);
            }
        });

        jTabbedPane1.setFont(new java.awt.Font("Arial", 0, 12));

        jTextAreaResponce.setColumns(20);
        jTextAreaResponce.setFont(new java.awt.Font("Arial", 0, 12));
        jTextAreaResponce.setRows(5);
        jScrollPane1.setViewportView(jTextAreaResponce);

        jTabbedPane1.addTab("Raw Response", jScrollPane1);

        jPanelBaseCase.setLayout(null);

        jLabel1.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel1.setText("Base Case Obtained From:");
        jPanelBaseCase.add(jLabel1);
        jLabel1.setBounds(10, 10, 170, 14);

        jLabelBaseCaseURL.setFont(new java.awt.Font("Arial", 0, 11));
        jLabelBaseCaseURL.setText("No Information");
        jPanelBaseCase.add(jLabelBaseCaseURL);
        jLabelBaseCaseURL.setBounds(10, 40, 570, 14);

        jLabel2.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel2.setText("HTTP Responce Code For Base Case: ");
        jPanelBaseCase.add(jLabel2);
        jLabel2.setBounds(10, 70, 220, 14);

        jLabelHTTPResponceCode.setFont(new java.awt.Font("Arial", 0, 11));
        jLabelHTTPResponceCode.setText("No Information");
        jPanelBaseCase.add(jLabelHTTPResponceCode);
        jLabelHTTPResponceCode.setBounds(220, 70, 200, 14);

        jButton1.setFont(new java.awt.Font("Arial", 0, 11));
        jButton1.setText("View In Browser");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanelBaseCase.add(jButton1);
        jButton1.setBounds(170, 10, 130, 20);

        jTabbedPane1.addTab("Base Case Information", jPanelBaseCase);

        jSplitPane1.setDividerLocation(300);
        jSplitPane1.setDividerSize(2);

        jTextAreaResponceCompear.setColumns(20);
        jTextAreaResponceCompear.setFont(new java.awt.Font("Arial", 0, 12));
        jTextAreaResponceCompear.setRows(5);
        jScrollPane2.setViewportView(jTextAreaResponceCompear);

        jSplitPane1.setLeftComponent(jScrollPane2);

        jTextAreaBaseCompear.setColumns(20);
        jTextAreaBaseCompear.setFont(new java.awt.Font("Arial", 0, 12));
        jTextAreaBaseCompear.setRows(5);
        jScrollPane3.setViewportView(jTextAreaBaseCompear);

        jSplitPane1.setRightComponent(jScrollPane3);

        jTabbedPane1.addTab("Raw Response vs Base Case", jSplitPane1);

        jScrollPaneDiff.setFont(new java.awt.Font("Arial", 0, 12));
        jScrollPaneDiff.setViewportView(jTextPaneDiff);

        jTabbedPane1.addTab("Diff Raw vs Base", jScrollPaneDiff);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(12, 12, 12)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabelURL)
                    .add(layout.createSequentialGroup()
                        .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 627, Short.MAX_VALUE)
                        .add(10, 10, 10))
                    .add(jButtonClose)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(10, 10, 10)
                .add(jLabelURL)
                .add(10, 10, 10)
                .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 434, Short.MAX_VALUE)
                .add(15, 15, 15)
                .add(jButtonClose)
                .add(10, 10, 10))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-657)/2, (screenSize.height-548)/2, 657, 548);
    }// //GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton1ActionPerformed
    {//GEN-HEADEREND:event_jButton1ActionPerformed
        try
        {
            BrowserLauncher launcher = new BrowserLauncher(null);
            launcher.openURLinBrowser(baseCaseObj.getBaseCaseRequestURL().toString());
        } 
        catch (UnsupportedOperatingSystemException ex)
        {
            ex.printStackTrace();
        } 
        catch (BrowserLaunchingInitializingException ex)
        {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButtonCloseActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonCloseActionPerformed
    {//GEN-HEADEREND:event_jButtonCloseActionPerformed
        this.dispose();
    }//GEN-LAST:event_jButtonCloseActionPerformed
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButtonClose;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabelBaseCaseURL;
    private javax.swing.JLabel jLabelHTTPResponceCode;
    private javax.swing.JLabel jLabelURL;
    private javax.swing.JPanel jPanelBaseCase;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPaneDiff;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextArea jTextAreaBaseCompear;
    private javax.swing.JTextArea jTextAreaResponce;
    private javax.swing.JTextArea jTextAreaResponceCompear;
    private javax.swing.JTextPane jTextPaneDiff;
    // End of variables declaration//GEN-END:variables
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy