Search in sources :

Example 1 with ProxyDialog

use of org.zaproxy.zap.view.ProxyDialog in project zaproxy by zaproxy.

the class OptionsConnectionPanel method saveParam.

@Override
public void saveParam(Object obj) throws Exception {
    OptionsParam optionsParam = (OptionsParam) obj;
    ConnectionParam connectionParam = optionsParam.getConnectionParam();
    int timeout;
    try {
        timeout = Integer.parseInt(txtTimeoutInSecs.getText());
    } catch (NumberFormatException nfe) {
        txtTimeoutInSecs.requestFocus();
        throw new Exception(Constant.messages.getString("conn.options.timeout.invalid"));
    }
    connectionParam.setProxyChainName(txtProxyChainName.getText());
    // ZAP: Do not allow invalid port numbers
    connectionParam.setProxyChainPort(spinnerProxyChainPort.getValue());
    connectionParam.setProxyExcludedDomains(getProxyExcludedDomainsTableModel().getElements());
    connectionParam.setConfirmRemoveProxyExcludedDomain(!getProxyExcludedDomainsPanel().isRemoveWithoutConfirmation());
    connectionParam.setProxyChainRealm(txtProxyChainRealm.getText());
    connectionParam.setProxyChainUserName(txtProxyChainUserName.getText());
    connectionParam.setProxyChainPrompt(chkProxyChainPrompt.isSelected());
    // ZAP: Added prompt option
    if (chkUseProxyChain.isSelected() && chkProxyChainAuth.isSelected() && chkProxyChainPrompt.isSelected()) {
        if (View.isInitialised()) {
            // And prompt now
            ProxyDialog dialog = new ProxyDialog(View.getSingleton().getMainFrame(), true);
            dialog.init(Model.getSingleton().getOptionsParam());
            dialog.setVisible(true);
        }
    } else {
        connectionParam.setProxyChainPassword(new String(txtProxyChainPassword.getPassword()));
    }
    connectionParam.setTimeoutInSecs(timeout);
    connectionParam.setSingleCookieRequestHeader(checkBoxSingleCookieRequestHeader.isSelected());
    connectionParam.setUseProxyChain(chkUseProxyChain.isSelected());
    connectionParam.setUseProxyChainAuth(chkProxyChainAuth.isSelected());
    connectionParam.setDnsTtlSuccessfulQueries(dnsTtlSuccessfulQueriesNumberSpinner.getValue());
    connectionParam.setSecurityProtocolsEnabled(securityProtocolsPanel.getSelectedProtocols());
    connectionParam.setDefaultUserAgent(defaultUserAgent.getText());
}
Also used : ProxyDialog(org.zaproxy.zap.view.ProxyDialog) OptionsParam(org.parosproxy.paros.model.OptionsParam) ConnectionParam(org.parosproxy.paros.network.ConnectionParam)

Example 2 with ProxyDialog

use of org.zaproxy.zap.view.ProxyDialog in project zaproxy by zaproxy.

the class GuiBootstrap method promptForProxyDetailsIfNeeded.

private static void promptForProxyDetailsIfNeeded(OptionsParam options) {
    if (options.getConnectionParam().isProxyChainPrompt()) {
        final ProxyDialog dialog = new ProxyDialog(null, true);
        dialog.init(options);
        dialog.setVisible(true);
    }
}
Also used : ProxyDialog(org.zaproxy.zap.view.ProxyDialog)

Aggregations

ProxyDialog (org.zaproxy.zap.view.ProxyDialog)2 OptionsParam (org.parosproxy.paros.model.OptionsParam)1 ConnectionParam (org.parosproxy.paros.network.ConnectionParam)1