Package org.parosproxy.paros.extension.scanner

Source Code of org.parosproxy.paros.extension.scanner.OptionsScannerPanel

/*
*
* Paros and its related class files.
*
* Paros is an HTTP/HTTPS proxy for assessing web application security.
* Copyright (C) 2003-2004 Chinotec Technologies Company
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Clarified Artistic License
* as published by the Free Software Foundation.
*
* This program 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
* Clarified Artistic License for more details.
*
* You should have received a copy of the Clarified Artistic License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package org.parosproxy.paros.extension.scanner;

import java.awt.CardLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSlider;

import org.parosproxy.paros.Constant;
import org.parosproxy.paros.core.scanner.ScannerParam;
import org.parosproxy.paros.model.OptionsParam;
import org.parosproxy.paros.view.AbstractParamPanel;

/**
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class OptionsScannerPanel extends AbstractParamPanel {

  private static final long serialVersionUID = -7754968166064568722L;

  private JPanel panelSpider = null;
    public OptionsScannerPanel() {
        super();
     initialize();
   }
   
  private JSlider sliderHostPerScan = null;
  private JSlider sliderThreadsPerHost = null;
  /**
   * This method initializes this
   *
   * @return void
   */
  private void initialize() {
        this.setLayout(new CardLayout());
        this.setName("Active Scan")// ZAP: Rename
        this.setSize(314, 245);
        this.add(getPanelSpider(), getPanelSpider().getName());
  }
  /**
   * This method initializes panelSpider 
   *  
   * @return javax.swing.JPanel 
   */   
  private JPanel getPanelSpider() {
    if (panelSpider == null) {
      java.awt.GridBagConstraints gridBagConstraints6 = new GridBagConstraints();

      JLabel jLabel2 = new JLabel();

      GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
      GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
      GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
      GridBagConstraints gridBagConstraints1 = new GridBagConstraints();

      panelSpider = new JPanel();
      JLabel jLabel1 = new JLabel();

      JLabel jLabel = new JLabel();

      panelSpider.setLayout(new GridBagLayout());
      panelSpider.setSize(114, 132);
      panelSpider.setName("");
      jLabel.setText("Number of hosts scan concurrently:");
      jLabel1.setText("Concurrent scanning threads per host:");
      gridBagConstraints1.gridx = 0;
      gridBagConstraints1.gridy = 0;
      gridBagConstraints1.ipadx = 0;
      gridBagConstraints1.ipady = 0;
      gridBagConstraints1.insets = new Insets(2,2,2,2);
      gridBagConstraints1.anchor = GridBagConstraints.NORTHWEST;
      gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
      gridBagConstraints1.weightx = 1.0D;
      gridBagConstraints2.gridx = 0;
      gridBagConstraints2.gridy = 1;
      gridBagConstraints2.weightx = 1.0;
      gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
      gridBagConstraints2.ipadx = 0;
      gridBagConstraints2.ipady = 0;
      gridBagConstraints2.anchor = GridBagConstraints.NORTHWEST;
      gridBagConstraints2.insets = new Insets(2,2,2,2);
      gridBagConstraints3.gridx = 0;
      gridBagConstraints3.gridy = 2;
      gridBagConstraints3.ipadx = 0;
      gridBagConstraints3.ipady = 0;
      gridBagConstraints3.anchor = GridBagConstraints.NORTHWEST;
      gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
      gridBagConstraints3.insets = new Insets(2,2,2,2);
      gridBagConstraints3.weightx = 1.0D;
      gridBagConstraints4.gridx = 0;
      gridBagConstraints4.gridy = 3;
      gridBagConstraints4.weightx = 1.0;
      gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
      gridBagConstraints4.ipadx = 0;
      gridBagConstraints4.ipady = 0;
      gridBagConstraints4.anchor = GridBagConstraints.NORTHWEST;
      gridBagConstraints4.insets = new Insets(2,2,2,2);
      gridBagConstraints6.gridx = 0;
      gridBagConstraints6.gridy = 10;
      gridBagConstraints6.anchor = GridBagConstraints.NORTHWEST;
      gridBagConstraints6.fill = GridBagConstraints.BOTH;
      gridBagConstraints6.insets = new Insets(2,2,2,2);
      gridBagConstraints6.weightx = 1.0D;
      gridBagConstraints6.weighty = 1.0D;
      jLabel2.setText("");
      panelSpider.add(jLabel, gridBagConstraints1);
      panelSpider.add(getSliderHostPerScan(), gridBagConstraints2);
      panelSpider.add(jLabel1, gridBagConstraints3);
      panelSpider.add(getSliderThreadsPerHost(), gridBagConstraints4);
      panelSpider.add(jLabel2, gridBagConstraints6);
    }
    return panelSpider;
  }
  public void initParam(Object obj) {
      OptionsParam options = (OptionsParam) obj;
      ScannerParam param = (ScannerParam) options.getParamSet(ScannerParam.class);
      getSliderHostPerScan().setValue(param.getHostPerScan());
      getSliderThreadsPerHost().setValue(param.getThreadPerHost());
  }
 
  public void validateParam(Object obj) {
      // no validation needed
  }
 
  public void saveParam (Object obj) throws Exception {
      OptionsParam options = (OptionsParam) obj;
      ScannerParam param = (ScannerParam) options.getParamSet(ScannerParam.class);
      param.setHostPerScan(getSliderHostPerScan().getValue());
      param.setThreadPerHost(getSliderThreadsPerHost().getValue());
  }
 
  /**
   * This method initializes sliderHostPerScan 
   *  
   * @return javax.swing.JSlider 
   */   
  private JSlider getSliderHostPerScan() {
    if (sliderHostPerScan == null) {
      sliderHostPerScan = new JSlider();
      sliderHostPerScan.setMaximum(5);
      sliderHostPerScan.setMinimum(1);
      sliderHostPerScan.setMinorTickSpacing(1);
      sliderHostPerScan.setPaintTicks(true);
      sliderHostPerScan.setPaintLabels(true);
      sliderHostPerScan.setName("");
      sliderHostPerScan.setMajorTickSpacing(1);
      sliderHostPerScan.setSnapToTicks(true);
      sliderHostPerScan.setPaintTrack(true);
    }
    return sliderHostPerScan;
  }
  /**
   * This method initializes sliderThreadsPerHost 
   *  
   * @return javax.swing.JSlider 
   */   
  private JSlider getSliderThreadsPerHost() {
    if (sliderThreadsPerHost == null) {
      sliderThreadsPerHost = new JSlider();
      sliderThreadsPerHost.setMaximum(Constant.MAX_HOST_CONNECTION);
      sliderThreadsPerHost.setMinimum(1);
      sliderThreadsPerHost.setValue(1);
      sliderThreadsPerHost.setPaintTicks(true);
      sliderThreadsPerHost.setPaintLabels(true);
      sliderThreadsPerHost.setMinorTickSpacing(1);
      sliderThreadsPerHost.setMajorTickSpacing(1);
      sliderThreadsPerHost.setSnapToTicks(true);
      sliderThreadsPerHost.setPaintTrack(true);
    }
    return sliderThreadsPerHost;
  }
//  @jve:decl-index=0:visual-constraint="10,10"
TOP

Related Classes of org.parosproxy.paros.extension.scanner.OptionsScannerPanel

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.